1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-01 21:31:19 +03:00

Phase 2 of pgindent updates.

Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.

Commit e3860ffa4d wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code.  The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there.  BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs.  So the
net result is that in about half the cases, such comments are placed
one tab stop left of before.  This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.

Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:18:54 -04:00
parent f669c09989
commit c7b8998ebb
1107 changed files with 3433 additions and 3514 deletions

View File

@@ -26,4 +26,4 @@ extern void ClientAuthentication(Port *port);
typedef void (*ClientAuthentication_hook_type) (Port *, int);
extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook;
#endif /* AUTH_H */
#endif /* AUTH_H */

View File

@@ -34,4 +34,4 @@ extern void AtEOXact_LargeObject(bool isCommit);
extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid,
SubTransactionId parentSubid);
#endif /* BE_FSSTUBS_H */
#endif /* BE_FSSTUBS_H */

View File

@@ -120,4 +120,4 @@ extern int check_usermap(const char *usermap_name,
bool case_sensitive);
extern bool pg_isblank(const char c);
#endif /* HBA_H */
#endif /* HBA_H */

View File

@@ -27,4 +27,4 @@ extern int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask,
extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data);
#endif /* IFADDR_H */
#endif /* IFADDR_H */

View File

@@ -32,7 +32,7 @@
#include <gssapi.h>
#else
#include <gssapi/gssapi.h>
#endif /* HAVE_GSSAPI_H */
#endif /* HAVE_GSSAPI_H */
/*
* GSSAPI brings in headers that set a lot of things in the global namespace on win32,
* that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore,
@@ -41,7 +41,7 @@
#ifdef _MSC_VER
#undef HAVE_GETADDRINFO
#endif
#endif /* ENABLE_GSS */
#endif /* ENABLE_GSS */
#ifdef ENABLE_SSPI
#define SECURITY_WIN32
@@ -61,7 +61,7 @@ typedef struct
int length;
} gss_buffer_desc;
#endif
#endif /* ENABLE_SSPI */
#endif /* ENABLE_SSPI */
#include "datatype/timestamp.h"
#include "libpq/hba.h"
@@ -124,7 +124,7 @@ typedef struct Port
char *remote_hostname; /* name (not ip addr) of remote host, if
* available */
int remote_hostname_resolv; /* see above */
int remote_hostname_errcode; /* see above */
int remote_hostname_errcode; /* see above */
char *remote_port; /* text rep of remote port */
CAC_state canAcceptConnections; /* postmaster connection status */
@@ -148,7 +148,7 @@ typedef struct Port
* but since it gets used by elog.c in the same way as database_name and
* other members of this struct, we may as well keep it here.
*/
TimestampTz SessionStartTime; /* backend start time */
TimestampTz SessionStartTime; /* backend start time */
/*
* TCP keepalive settings.
@@ -223,4 +223,4 @@ extern int pq_setkeepalivesidle(int idle, Port *port);
extern int pq_setkeepalivesinterval(int interval, Port *port);
extern int pq_setkeepalivescount(int count, Port *port);
#endif /* LIBPQ_BE_H */
#endif /* LIBPQ_BE_H */

View File

@@ -21,4 +21,4 @@
#define INV_WRITE 0x00020000
#define INV_READ 0x00040000
#endif /* LIBPQ_FS_H */
#endif /* LIBPQ_FS_H */

View File

@@ -99,4 +99,4 @@ extern char *SSLCipherSuites;
extern char *SSLECDHCurve;
extern bool SSLPreferServerCiphers;
#endif /* LIBPQ_H */
#endif /* LIBPQ_H */

View File

@@ -57,7 +57,7 @@ struct sockaddr_storage
#define ss_len ss_stuff.sa.sa_len
#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1
#endif
#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
typedef struct
{
@@ -133,19 +133,19 @@ typedef uint32 PacketLen;
#define SM_DATABASE 64
#define SM_USER 32
/* We append database name if db_user_namespace true. */
#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */
#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */
#define SM_OPTIONS 64
#define SM_UNUSED 64
#define SM_TTY 64
typedef struct StartupPacket
{
ProtocolVersion protoVersion; /* Protocol version */
ProtocolVersion protoVersion; /* Protocol version */
char database[SM_DATABASE]; /* Database name */
/* Db_user_namespace appends dbname */
char user[SM_USER]; /* User name */
char options[SM_OPTIONS]; /* Optional additional args */
char unused[SM_UNUSED]; /* Unused */
char unused[SM_UNUSED]; /* Unused */
char tty[SM_TTY]; /* Tty for debug output */
} StartupPacket;
@@ -192,7 +192,7 @@ typedef uint32 AuthRequest;
typedef struct CancelRequestPacket
{
/* Note that each field is stored in network byte order! */
MsgType cancelRequestCode; /* code to identify a cancel request */
MsgType cancelRequestCode; /* code to identify a cancel request */
uint32 backendPID; /* PID of client's backend */
uint32 cancelAuthCode; /* secret key to authorize cancel */
} CancelRequestPacket;
@@ -204,4 +204,4 @@ typedef struct CancelRequestPacket
*/
#define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679)
#endif /* PQCOMM_H */
#endif /* PQCOMM_H */

View File

@@ -47,4 +47,4 @@ extern const char *pq_getmsgstring(StringInfo msg);
extern const char *pq_getmsgrawstring(StringInfo msg);
extern void pq_getmsgend(StringInfo msg);
#endif /* PQFORMAT_H */
#endif /* PQFORMAT_H */

View File

@@ -21,4 +21,4 @@ extern void pq_set_parallel_master(pid_t pid, BackendId backend_id);
extern void pq_parse_errornotice(StringInfo str, ErrorData *edata);
#endif /* PQMQ_H */
#endif /* PQMQ_H */

View File

@@ -28,7 +28,7 @@ extern int pqsigsetmask(int mask);
#define sigfillset(set) (*(set) = ~0)
#define sigaddset(set, signum) (*(set) |= (sigmask(signum)))
#define sigdelset(set, signum) (*(set) &= ~(sigmask(signum)))
#endif /* WIN32 */
#endif /* WIN32 */
extern sigset_t UnBlockSig,
BlockSig,
@@ -36,4 +36,4 @@ extern sigset_t UnBlockSig,
extern void pqinitmask(void);
#endif /* PQSIGNAL_H */
#endif /* PQSIGNAL_H */

View File

@@ -31,4 +31,4 @@ extern char *pg_be_scram_build_verifier(const char *password);
extern bool scram_verify_plain_password(const char *username,
const char *password, const char *verifier);
#endif /* PG_SCRAM_H */
#endif /* PG_SCRAM_H */