mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Tweak __attribute__-wrapping macros for better pgindent results.
This improves on commit bbfd7edae5
by
making two simple changes:
* pg_attribute_noreturn now takes parentheses, ie pg_attribute_noreturn().
Likewise pg_attribute_unused(), pg_attribute_packed(). This reduces
pgindent's tendency to misformat declarations involving them.
* attributes are now always attached to function declarations, not
definitions. Previously some places were taking creative shortcuts,
which were not merely candidates for bad misformatting by pgindent
but often were outright wrong anyway. (It does little good to put a
noreturn annotation where callers can't see it.) In any case, if
we would like to believe that these macros can be used with non-gcc
compilers, we should avoid gratuitous variance in usage patterns.
I also went through and manually improved the formatting of a lot of
declarations, and got rid of excessively repetitive (and now obsolete
anyway) comments informing the reader what pg_attribute_printf is for.
This commit is contained in:
@@ -153,23 +153,11 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
|
||||
#endif
|
||||
|
||||
extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||
extern int
|
||||
pg_snprintf(char *str, size_t count, const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string */
|
||||
pg_attribute_printf(3, 4);
|
||||
extern int
|
||||
pg_sprintf(char *str, const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string */
|
||||
pg_attribute_printf(2, 3);
|
||||
extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
|
||||
extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
|
||||
extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
|
||||
extern int
|
||||
pg_fprintf(FILE *stream, const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string */
|
||||
pg_attribute_printf(2, 3);
|
||||
extern int
|
||||
pg_printf(const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string */
|
||||
pg_attribute_printf(1, 2);
|
||||
extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
|
||||
extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
|
||||
|
||||
/*
|
||||
* The GCC-specific code below prevents the pg_attribute_printf above from
|
||||
|
Reference in New Issue
Block a user