mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
Add code to not indent enum, per Tom Lane.
This commit is contained in:
parent
99a9f2f6f4
commit
8c1f4e574b
@ -34,10 +34,24 @@ do
|
||||
\2;g' |
|
||||
detab -t4 -qc |
|
||||
# work around bug where function that defines no local variables misindents
|
||||
# switch() case lines and line after #else
|
||||
sed 's,^{$,{\
|
||||
int pgindent_func_no_var_fix;\
|
||||
,g' |
|
||||
# switch() case lines and line after #else. Do not do with for struct/enum.
|
||||
awk ' BEGIN {line1 = ""; line2 = ""}
|
||||
{
|
||||
line2 = $0;
|
||||
if (NR >= 2 &&
|
||||
line2 ~ "^{[ ]*$" &&
|
||||
line1 !~ "^struct" &&
|
||||
line1 !~ "^enum" &&
|
||||
line1 !~ "^typedef")
|
||||
printf "int pgindent_func_no_var_fix;";
|
||||
if (NR >= 2)
|
||||
print line1;
|
||||
line1 = line2;
|
||||
}
|
||||
END {
|
||||
if (NR >= 1)
|
||||
print line1;
|
||||
}' |
|
||||
# protect backslashes in DATA()
|
||||
sed 's;^DATA(.*$;/*&*/;' |
|
||||
# protect wrapping in CATALOG()
|
||||
@ -1277,153 +1291,153 @@ int pgindent_func_no_var_fix;\
|
||||
-Tyy_state_type \
|
||||
-Tz_stream \
|
||||
-Tz_streamp \
|
||||
-T BOOKMARK \
|
||||
-T BOOL \
|
||||
-T BYTE \
|
||||
-T BindInfoClass \
|
||||
-T COL_INFO \
|
||||
-T CONN_Status \
|
||||
-T ColumnInfoClass \
|
||||
-T ConnInfo \
|
||||
-T ConnectionClass \
|
||||
-T DATE_STRUCT \
|
||||
-T DWORD \
|
||||
-T DataSourceToDriverProc \
|
||||
-T DriverToDataSourceProc \
|
||||
-T EnvironmentClass \
|
||||
-T FIELD_INFO \
|
||||
-T FILE \
|
||||
-T GLOBAL_VALUES \
|
||||
-T HDBC \
|
||||
-T HENV \
|
||||
-T HSTMT \
|
||||
-T HWND \
|
||||
-T LO_ARG \
|
||||
-T LPARAM \
|
||||
-T Oid \
|
||||
-T PTR \
|
||||
-T ParameterInfoClass \
|
||||
-T ProtocolVersion \
|
||||
-T QResultClass \
|
||||
-T QueryInfo \
|
||||
-T QueryResultCode \
|
||||
-T RETCODE \
|
||||
-T SDOUBLE \
|
||||
-T SDWORD \
|
||||
-T SFLOAT \
|
||||
-T SIMPLE_TIME \
|
||||
-T SQLBIGINT \
|
||||
-T SQLCHAR \
|
||||
-T SQLDOUBLE \
|
||||
-T SQLFLOAT \
|
||||
-T SQLGUID \
|
||||
-T SQLINTEGER \
|
||||
-T SQLINTERVAL \
|
||||
-T SQLREAL \
|
||||
-T SQLSCHAR \
|
||||
-T SQLSMALLINT \
|
||||
-T SQLUBIGINT \
|
||||
-T SQLUINTEGER \
|
||||
-T SQLUSMALLINT \
|
||||
-T SQL_DATE_STRUCT \
|
||||
-T SQL_DAY_SECOND_STRUCT \
|
||||
-T SQL_INTERVAL_STRUCT \
|
||||
-T SQL_TIMESTAMP_STRUCT \
|
||||
-T SQL_TIME_STRUCT \
|
||||
-T SQL_YEAR_MONTH_STRUCT \
|
||||
-T SSHOR \
|
||||
-T STMT_Status \
|
||||
-T SWORD \
|
||||
-T SocketClass \
|
||||
-T StartupPacket \
|
||||
-T StartupPacket6_2 \
|
||||
-T StatementClass \
|
||||
-T StatementOptions \
|
||||
-T TABLE_INFO \
|
||||
-T TIMESTAMP_STRUCT \
|
||||
-T TIME_STRUCT \
|
||||
-T TupleField \
|
||||
-T TupleListClass \
|
||||
-T TupleNode \
|
||||
-T UCHAR \
|
||||
-T UDWORD \
|
||||
-T UWORD \
|
||||
-T WORD \
|
||||
-T WPARAM \
|
||||
-T _LIB_VERSION_TYPE \
|
||||
-T _RuneEntry \
|
||||
-T _RuneLocale \
|
||||
-T _RuneRange \
|
||||
-T caddr_t \
|
||||
-T char \
|
||||
-T clock_t \
|
||||
-T clockid_t \
|
||||
-T daddr_t \
|
||||
-T dev_t \
|
||||
-T div_t \
|
||||
-T double \
|
||||
-T fd_mask \
|
||||
-T fd_set \
|
||||
-T fixpt_t \
|
||||
-T float \
|
||||
-T fpos_t \
|
||||
-T gid_t \
|
||||
-T in_addr_t \
|
||||
-T in_port_t \
|
||||
-T ino_t \
|
||||
-T int \
|
||||
-T int16_t \
|
||||
-T int16m_t \
|
||||
-T int32_t \
|
||||
-T int32m_t \
|
||||
-T int64_t \
|
||||
-T int64m_t \
|
||||
-T int8_t \
|
||||
-T int8m_t \
|
||||
-T key_t \
|
||||
-T ldiv_t \
|
||||
-T mode_t \
|
||||
-T nlink_t \
|
||||
-T off_t \
|
||||
-T pid_t \
|
||||
-T q128_t \
|
||||
-T qaddr_t \
|
||||
-T quad_t \
|
||||
-T register_t \
|
||||
-T rune_t \
|
||||
-T sa_family_t \
|
||||
-T segsz_t \
|
||||
-T sig_atomic_t \
|
||||
-T sig_t \
|
||||
-T sigset_t \
|
||||
-T size_t \
|
||||
-T slock_t \
|
||||
-T socklen_t \
|
||||
-T ssize_t \
|
||||
-T stack_t \
|
||||
-T swblk_t \
|
||||
-T time_t \
|
||||
-T u_char \
|
||||
-T u_int \
|
||||
-T u_int16_t \
|
||||
-T u_int16m_t \
|
||||
-T u_int32_t \
|
||||
-T u_int32m_t \
|
||||
-T u_int64_t \
|
||||
-T u_int64m_t \
|
||||
-T u_int8_t \
|
||||
-T u_int8m_t \
|
||||
-T u_long \
|
||||
-T u_quad_t \
|
||||
-T u_short \
|
||||
-T uid_t \
|
||||
-T uint \
|
||||
-T ushort \
|
||||
-T va_list \
|
||||
-T vm_offset_t \
|
||||
-T vm_size_t \
|
||||
-T void \
|
||||
-T wchar_t \
|
||||
-TBOOKMARK \
|
||||
-TBOOL \
|
||||
-TBYTE \
|
||||
-TBindInfoClass \
|
||||
-TCOL_INFO \
|
||||
-TCONN_Status \
|
||||
-TColumnInfoClass \
|
||||
-TConnInfo \
|
||||
-TConnectionClass \
|
||||
-TDATE_STRUCT \
|
||||
-TDWORD \
|
||||
-TDataSourceToDriverProc \
|
||||
-TDriverToDataSourceProc \
|
||||
-TEnvironmentClass \
|
||||
-TFIELD_INFO \
|
||||
-TFILE \
|
||||
-TGLOBAL_VALUES \
|
||||
-THDBC \
|
||||
-THENV \
|
||||
-THSTMT \
|
||||
-THWND \
|
||||
-TLO_ARG \
|
||||
-TLPARAM \
|
||||
-TOid \
|
||||
-TPTR \
|
||||
-TParameterInfoClass \
|
||||
-TProtocolVersion \
|
||||
-TQResultClass \
|
||||
-TQueryInfo \
|
||||
-TQueryResultCode \
|
||||
-TRETCODE \
|
||||
-TSDOUBLE \
|
||||
-TSDWORD \
|
||||
-TSFLOAT \
|
||||
-TSIMPLE_TIME \
|
||||
-TSQLBIGINT \
|
||||
-TSQLCHAR \
|
||||
-TSQLDOUBLE \
|
||||
-TSQLFLOAT \
|
||||
-TSQLGUID \
|
||||
-TSQLINTEGER \
|
||||
-TSQLINTERVAL \
|
||||
-TSQLREAL \
|
||||
-TSQLSCHAR \
|
||||
-TSQLSMALLINT \
|
||||
-TSQLUBIGINT \
|
||||
-TSQLUINTEGER \
|
||||
-TSQLUSMALLINT \
|
||||
-TSQL_DATE_STRUCT \
|
||||
-TSQL_DAY_SECOND_STRUCT \
|
||||
-TSQL_INTERVAL_STRUCT \
|
||||
-TSQL_TIMESTAMP_STRUCT \
|
||||
-TSQL_TIME_STRUCT \
|
||||
-TSQL_YEAR_MONTH_STRUCT \
|
||||
-TSSHOR \
|
||||
-TSTMT_Status \
|
||||
-TSWORD \
|
||||
-TSocketClass \
|
||||
-TStartupPacket \
|
||||
-TStartupPacket6_2 \
|
||||
-TStatementClass \
|
||||
-TStatementOptions \
|
||||
-TTABLE_INFO \
|
||||
-TTIMESTAMP_STRUCT \
|
||||
-TTIME_STRUCT \
|
||||
-TTupleField \
|
||||
-TTupleListClass \
|
||||
-TTupleNode \
|
||||
-TUCHAR \
|
||||
-TUDWORD \
|
||||
-TUWORD \
|
||||
-TWORD \
|
||||
-TWPARAM \
|
||||
-T_LIB_VERSION_TYPE \
|
||||
-T_RuneEntry \
|
||||
-T_RuneLocale \
|
||||
-T_RuneRange \
|
||||
-Tcaddr_t \
|
||||
-Tchar \
|
||||
-Tclock_t \
|
||||
-Tclockid_t \
|
||||
-Tdaddr_t \
|
||||
-Tdev_t \
|
||||
-Tdiv_t \
|
||||
-Tdouble \
|
||||
-Tfd_mask \
|
||||
-Tfd_set \
|
||||
-Tfixpt_t \
|
||||
-Tfloat \
|
||||
-Tfpos_t \
|
||||
-Tgid_t \
|
||||
-Tin_addr_t \
|
||||
-Tin_port_t \
|
||||
-Tino_t \
|
||||
-Tint \
|
||||
-Tint16_t \
|
||||
-Tint16m_t \
|
||||
-Tint32_t \
|
||||
-Tint32m_t \
|
||||
-Tint64_t \
|
||||
-Tint64m_t \
|
||||
-Tint8_t \
|
||||
-Tint8m_t \
|
||||
-Tkey_t \
|
||||
-Tldiv_t \
|
||||
-Tmode_t \
|
||||
-Tnlink_t \
|
||||
-Toff_t \
|
||||
-Tpid_t \
|
||||
-Tq128_t \
|
||||
-Tqaddr_t \
|
||||
-Tquad_t \
|
||||
-Tregister_t \
|
||||
-Trune_t \
|
||||
-Tsa_family_t \
|
||||
-Tsegsz_t \
|
||||
-Tsig_atomic_t \
|
||||
-Tsig_t \
|
||||
-Tsigset_t \
|
||||
-Tsize_t \
|
||||
-Tslock_t \
|
||||
-Tsocklen_t \
|
||||
-Tssize_t \
|
||||
-Tstack_t \
|
||||
-Tswblk_t \
|
||||
-Ttime_t \
|
||||
-Tu_char \
|
||||
-Tu_int \
|
||||
-Tu_int16_t \
|
||||
-Tu_int16m_t \
|
||||
-Tu_int32_t \
|
||||
-Tu_int32m_t \
|
||||
-Tu_int64_t \
|
||||
-Tu_int64m_t \
|
||||
-Tu_int8_t \
|
||||
-Tu_int8m_t \
|
||||
-Tu_long \
|
||||
-Tu_quad_t \
|
||||
-Tu_short \
|
||||
-Tuid_t \
|
||||
-Tuint \
|
||||
-Tushort \
|
||||
-Tva_list \
|
||||
-Tvm_offset_t \
|
||||
-Tvm_size_t \
|
||||
-Tvoid \
|
||||
-Twchar_t \
|
||||
/tmp/$$a >/tmp/$$ 2>&1
|
||||
if [ "$?" -ne 0 -o -s /tmp/$$ ]
|
||||
then echo "$FILE"
|
||||
@ -1439,7 +1453,7 @@ int pgindent_func_no_var_fix;\
|
||||
# pull in #endif comments
|
||||
sed 's;^#endif[ ][ ]*/\*;#endif /*;' |
|
||||
# add space after comments that start on tab stops
|
||||
sed 's:\([^ ]\)/\*.*\*/\)$:\1 \2:' |
|
||||
sed 's:\([^ ]\)\(/\*.*\*/\)$:\1 \2:' |
|
||||
# work around #else indenting next line if #ifdef defines variables at top
|
||||
# work around misindenting of function with no variables defined
|
||||
awk '
|
||||
@ -1458,7 +1472,7 @@ int pgindent_func_no_var_fix;\
|
||||
sed 's;^\([A-Za-z_][^ ]*\)[ ][ ]*\*$;\1 *;' |
|
||||
# remove un-needed braces around single statements
|
||||
awk '
|
||||
{
|
||||
{
|
||||
line3 = $0;
|
||||
if (skips > 0)
|
||||
skips--;
|
||||
@ -1478,14 +1492,14 @@ int pgindent_func_no_var_fix;\
|
||||
line2 = line3;
|
||||
}
|
||||
END {
|
||||
if (skips <= 1)
|
||||
if (NR > 1 && skips <= 1)
|
||||
print line1;
|
||||
if (skips <= 2)
|
||||
if (NR > 2 && skips <= 2)
|
||||
print line2;
|
||||
}' |
|
||||
# remove blank line between opening brace and block comment
|
||||
awk '
|
||||
{
|
||||
{
|
||||
line3 = $0;
|
||||
if (skips > 0)
|
||||
skips--;
|
||||
@ -1506,14 +1520,14 @@ int pgindent_func_no_var_fix;\
|
||||
line2 = line3;
|
||||
}
|
||||
END {
|
||||
if (skips <= 1)
|
||||
if (NR > 1 && skips <= 1)
|
||||
print line1;
|
||||
if (skips <= 2)
|
||||
if (NR > 2 && skips <= 2)
|
||||
print line2;
|
||||
}' |
|
||||
# remove blank line before #endif
|
||||
awk ' BEGIN {line1 = ""; line2 = ""; skips = 0}
|
||||
{
|
||||
{
|
||||
line2 = $0;
|
||||
if (skips > 0)
|
||||
skips--;
|
||||
@ -1530,19 +1544,19 @@ int pgindent_func_no_var_fix;\
|
||||
line1 = line2;
|
||||
}
|
||||
END {
|
||||
if (skips <= 1)
|
||||
if (NR > 1 && skips <= 1)
|
||||
print line1;
|
||||
}' |
|
||||
# add blank line before #endif if it is the last line in the file
|
||||
awk ' BEGIN {line1 = ""; line2 = ""}
|
||||
{
|
||||
{
|
||||
line2 = $0;
|
||||
if (NR >= 2)
|
||||
print line1;
|
||||
line1 = line2;
|
||||
}
|
||||
END {
|
||||
if (line2 ~ "^#endif")
|
||||
if (NR > 1 && line2 ~ "^#endif")
|
||||
printf "\n";
|
||||
print line1;
|
||||
}' |
|
||||
|
Loading…
Reference in New Issue
Block a user