summaryrefslogtreecommitdiff
path: root/src/include/postmaster
diff options
context:
space:
mode:
authorAndres Freund2015-03-11 13:19:54 +0000
committerAndres Freund2015-03-11 13:30:01 +0000
commitbbfd7edae5aa5ad5553d3c7e102f2e450d4380d4 (patch)
treed230d006ceb7bf350abd5c3c25a89b660a8d3193 /src/include/postmaster
parent66ece312f99f384bd33e4342580e78b0eebf0e74 (diff)
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/include/postmaster')
-rw-r--r--src/include/postmaster/autovacuum.h4
-rw-r--r--src/include/postmaster/bgworker_internals.h2
-rw-r--r--src/include/postmaster/bgwriter.h4
-rw-r--r--src/include/postmaster/pgarch.h2
-rw-r--r--src/include/postmaster/postmaster.h4
-rw-r--r--src/include/postmaster/startup.h2
-rw-r--r--src/include/postmaster/syslogger.h2
-rw-r--r--src/include/postmaster/walwriter.h2
8 files changed, 11 insertions, 11 deletions
diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h
index 121f107387..0bd50443ae 100644
--- a/src/include/postmaster/autovacuum.h
+++ b/src/include/postmaster/autovacuum.h
@@ -54,8 +54,8 @@ extern void AutoVacWorkerFailed(void);
extern void AutoVacuumUpdateDelay(void);
#ifdef EXEC_BACKEND
-extern void AutoVacLauncherMain(int argc, char *argv[]) __attribute__((noreturn));
-extern void AutoVacWorkerMain(int argc, char *argv[]) __attribute__((noreturn));
+extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn;
+extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn;
extern void AutovacuumWorkerIAm(void);
extern void AutovacuumLauncherIAm(void);
#endif
diff --git a/src/include/postmaster/bgworker_internals.h b/src/include/postmaster/bgworker_internals.h
index 81c03e4bb3..fe7c328afd 100644
--- a/src/include/postmaster/bgworker_internals.h
+++ b/src/include/postmaster/bgworker_internals.h
@@ -46,7 +46,7 @@ extern void BackgroundWorkerStopNotifications(pid_t pid);
extern void ResetBackgroundWorkerCrashTimes(void);
/* Function to start a background worker, called from postmaster.c */
-extern void StartBackgroundWorker(void) __attribute__((noreturn));
+extern void StartBackgroundWorker(void) pg_attribute_noreturn;
#ifdef EXEC_BACKEND
extern BackgroundWorker *BackgroundWorkerEntry(int slotno);
diff --git a/src/include/postmaster/bgwriter.h b/src/include/postmaster/bgwriter.h
index ce12619797..f584d85787 100644
--- a/src/include/postmaster/bgwriter.h
+++ b/src/include/postmaster/bgwriter.h
@@ -25,8 +25,8 @@ extern int CheckPointTimeout;
extern int CheckPointWarning;
extern double CheckPointCompletionTarget;
-extern void BackgroundWriterMain(void) __attribute__((noreturn));
-extern void CheckpointerMain(void) __attribute__((noreturn));
+extern void BackgroundWriterMain(void) pg_attribute_noreturn;
+extern void CheckpointerMain(void) pg_attribute_noreturn;
extern void RequestCheckpoint(int flags);
extern void CheckpointWriteDelay(int flags, double progress);
diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h
index a585e6736c..60e4f50368 100644
--- a/src/include/postmaster/pgarch.h
+++ b/src/include/postmaster/pgarch.h
@@ -33,7 +33,7 @@
extern int pgarch_start(void);
#ifdef EXEC_BACKEND
-extern void PgArchiverMain(int argc, char *argv[]) __attribute__((noreturn));
+extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn;
#endif
#endif /* _PGARCH_H */
diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h
index 91723f7d9a..d41761fc7a 100644
--- a/src/include/postmaster/postmaster.h
+++ b/src/include/postmaster/postmaster.h
@@ -46,7 +46,7 @@ extern int postmaster_alive_fds[2];
extern const char *progname;
-extern void PostmasterMain(int argc, char *argv[]) __attribute__((noreturn));
+extern void PostmasterMain(int argc, char *argv[]) pg_attribute_noreturn;
extern void ClosePostmasterPorts(bool am_syslogger);
extern int MaxLivePostmasterChildren(void);
@@ -56,7 +56,7 @@ extern bool PostmasterMarkPIDForWorkerNotify(int);
#ifdef EXEC_BACKEND
extern pid_t postmaster_forkexec(int argc, char *argv[]);
-extern void SubPostmasterMain(int argc, char *argv[]) __attribute__((noreturn));
+extern void SubPostmasterMain(int argc, char *argv[]) pg_attribute_noreturn;
extern Size ShmemBackendArraySize(void);
extern void ShmemBackendArrayAllocation(void);
diff --git a/src/include/postmaster/startup.h b/src/include/postmaster/startup.h
index da1f6e9336..9a2092e5f2 100644
--- a/src/include/postmaster/startup.h
+++ b/src/include/postmaster/startup.h
@@ -13,7 +13,7 @@
#define _STARTUP_H
extern void HandleStartupProcInterrupts(void);
-extern void StartupProcessMain(void) __attribute__((noreturn));
+extern void StartupProcessMain(void) pg_attribute_noreturn;
extern void PreRestoreCommand(void);
extern void PostRestoreCommand(void);
extern bool IsPromoteTriggered(void);
diff --git a/src/include/postmaster/syslogger.h b/src/include/postmaster/syslogger.h
index 89a535c18f..d6a05d5a20 100644
--- a/src/include/postmaster/syslogger.h
+++ b/src/include/postmaster/syslogger.h
@@ -84,7 +84,7 @@ extern int SysLogger_Start(void);
extern void write_syslogger_file(const char *buffer, int count, int dest);
#ifdef EXEC_BACKEND
-extern void SysLoggerMain(int argc, char *argv[]) __attribute__((noreturn));
+extern void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn;
#endif
#endif /* _SYSLOGGER_H */
diff --git a/src/include/postmaster/walwriter.h b/src/include/postmaster/walwriter.h
index de45a01f82..55de6c73e4 100644
--- a/src/include/postmaster/walwriter.h
+++ b/src/include/postmaster/walwriter.h
@@ -15,6 +15,6 @@
/* GUC options */
extern int WalWriterDelay;
-extern void WalWriterMain(void) __attribute__((noreturn));
+extern void WalWriterMain(void) pg_attribute_noreturn;
#endif /* _WALWRITER_H */