diff options
| author | Andres Freund <andres@anarazel.de> | 2015-03-11 14:19:54 +0100 |
|---|---|---|
| committer | Andres Freund <andres@anarazel.de> | 2015-03-11 14:30:01 +0100 |
| commit | bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4 (patch) | |
| tree | d230d006ceb7bf350abd5c3c25a89b660a8d3193 /src/bin/pg_dump/pg_backup_archiver.h | |
| parent | 66ece312f99f384bd33e4342580e78b0eebf0e74 (diff) | |
| download | postgresql-bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4.tar.gz | |
Add macros wrapping all usage of gcc's __attribute__.
Until now __attribute__() was defined to be empty for all compilers but
gcc. That's problematic because it prevents using it in other compilers;
which is necessary e.g. for atomics portability. It's also just
generally dubious to do so in a header as widely included as c.h.
Instead add pg_attribute_format_arg, pg_attribute_printf,
pg_attribute_noreturn macros which are implemented in the compilers that
understand them. Also add pg_attribute_noreturn and pg_attribute_packed,
but don't provide fallbacks, since they can affect functionality.
This means that external code that, possibly unwittingly, relied on
__attribute__ defined to be empty on !gcc compilers may now run into
warnings or errors on those compilers. But there shouldn't be many
occurances of that and it's hard to work around...
Discussion: 54B58BA3.8040302@ohmu.fi
Author: Oskari Saarenmaa, with some minor changes by me.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.h')
| -rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 144027ce97..620ada53f1 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -378,7 +378,7 @@ struct _tocEntry extern int parallel_restore(struct ParallelArgs *args); extern void on_exit_close_archive(Archive *AHX); -extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); +extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt,...) pg_attribute_printf(3, 4); extern void WriteTOC(ArchiveHandle *AH); extern void ReadTOC(ArchiveHandle *AH); @@ -429,8 +429,8 @@ extern int ReconnectToServer(ArchiveHandle *AH, const char *dbname, const char * extern void DropBlobIfExists(ArchiveHandle *AH, Oid oid); void ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH); -int ahprintf(ArchiveHandle *AH, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); +int ahprintf(ArchiveHandle *AH, const char *fmt,...) pg_attribute_printf(2, 3); -void ahlog(ArchiveHandle *AH, int level, const char *fmt,...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); +void ahlog(ArchiveHandle *AH, int level, const char *fmt,...) pg_attribute_printf(3, 4); #endif |
