diff options
author | Nicolas Trangez <ikke@nicolast.be> | 2022-10-30 20:29:52 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-11-02 12:06:48 -0400 |
commit | 6b400d264647207d3217fd5af45a4b20c4d402d4 (patch) | |
tree | 9d246dce3b70e66e941f50a9ebf848a4e80a3b7e /rts/include | |
parent | 4521f6498d09f48a775a028efdd763c874da3451 (diff) | |
download | haskell-6b400d264647207d3217fd5af45a4b20c4d402d4.tar.gz |
rts: introduce (and use) `STG_NORETURN`
Instead of sprinkling the codebase with
`GNU(C3)_ATTRIBUTE(__noreturn__)`, add a `STG_NORETURN` macro (for,
basically, the same thing) similar to `STG_UNUSED` and others, and
update the code to use this macro where applicable.
Diffstat (limited to 'rts/include')
-rw-r--r-- | rts/include/Rts.h | 4 | ||||
-rw-r--r-- | rts/include/RtsAPI.h | 4 | ||||
-rw-r--r-- | rts/include/Stg.h | 2 | ||||
-rw-r--r-- | rts/include/rts/Main.h | 2 | ||||
-rw-r--r-- | rts/include/rts/Messages.h | 6 | ||||
-rw-r--r-- | rts/include/rts/OSThreads.h | 2 | ||||
-rw-r--r-- | rts/include/rts/Threads.h | 2 |
7 files changed, 12 insertions, 10 deletions
diff --git a/rts/include/Rts.h b/rts/include/Rts.h index b9874721ce..90d8e5b324 100644 --- a/rts/include/Rts.h +++ b/rts/include/Rts.h @@ -121,7 +121,7 @@ extern "C" { -------------------------------------------------------------------------- */ void _assertFail(const char *filename, unsigned int linenum) - GNUC3_ATTRIBUTE(__noreturn__); + STG_NORETURN; void _warnFail(const char *filename, unsigned int linenum); @@ -290,7 +290,7 @@ DLL_IMPORT_RTS extern char *prog_name; void reportStackOverflow(StgTSO* tso); void reportHeapOverflow(void); -void stg_exit(int n) GNU_ATTRIBUTE(__noreturn__); +void stg_exit(int n) STG_NORETURN; #if !defined(mingw32_HOST_OS) int stg_sig_install (int, int, void *); diff --git a/rts/include/RtsAPI.h b/rts/include/RtsAPI.h index 08c1b62853..3bede10069 100644 --- a/rts/include/RtsAPI.h +++ b/rts/include/RtsAPI.h @@ -310,11 +310,11 @@ extern void hs_init_ghc (int *argc, char **argv[], // program arguments RtsConfig rts_config); // RTS configuration extern void shutdownHaskellAndExit (int exitCode, int fastExit) - GNUC3_ATTRIBUTE(__noreturn__); + STG_NORETURN; #if !defined(mingw32_HOST_OS) extern void shutdownHaskellAndSignal (int sig, int fastExit) - GNUC3_ATTRIBUTE(__noreturn__); + STG_NORETURN; #endif extern void getProgArgv ( int *argc, char **argv[] ); diff --git a/rts/include/Stg.h b/rts/include/Stg.h index 31a7a55e9c..26010db7b6 100644 --- a/rts/include/Stg.h +++ b/rts/include/Stg.h @@ -241,6 +241,8 @@ #define STG_PRINTF_ATTR(fmt_arg, rest) GNUC3_ATTRIBUTE(format(printf, fmt_arg, rest)) #endif +#define STG_NORETURN GNU_ATTRIBUTE(__noreturn__) + /* ----------------------------------------------------------------------------- Global type definitions -------------------------------------------------------------------------- */ diff --git a/rts/include/rts/Main.h b/rts/include/rts/Main.h index 05924ad92b..f45fff6ea6 100644 --- a/rts/include/rts/Main.h +++ b/rts/include/rts/Main.h @@ -15,4 +15,4 @@ int hs_main (int argc, char *argv[], // program args StgClosure *main_closure, // closure for Main.main RtsConfig rts_config) // RTS configuration - GNUC3_ATTRIBUTE(__noreturn__); + STG_NORETURN; diff --git a/rts/include/rts/Messages.h b/rts/include/rts/Messages.h index 7d4727486e..62323a93ed 100644 --- a/rts/include/rts/Messages.h +++ b/rts/include/rts/Messages.h @@ -31,15 +31,15 @@ * expected to return. */ void barf(const char *s, ...) - GNUC3_ATTRIBUTE(__noreturn__) + STG_NORETURN STG_PRINTF_ATTR(1, 2); void vbarf(const char *s, va_list ap) - GNUC3_ATTRIBUTE(__noreturn__); + STG_NORETURN; // declared in Rts.h: // extern void _assertFail(const char *filename, unsigned int linenum) -// GNUC3_ATTRIBUTE(__noreturn__); +// STG_NORETURN; /* * An error condition which is caused by and/or can be corrected by diff --git a/rts/include/rts/OSThreads.h b/rts/include/rts/OSThreads.h index ebe964be9a..e0b34c3160 100644 --- a/rts/include/rts/OSThreads.h +++ b/rts/include/rts/OSThreads.h @@ -168,7 +168,7 @@ typedef SRWLOCK Mutex; // General thread operations // extern OSThreadId osThreadId ( void ); -extern void shutdownThread ( void ) GNUC3_ATTRIBUTE(__noreturn__); +extern void shutdownThread ( void ) STG_NORETURN; extern void yieldThread ( void ); typedef void* OSThreadProcAttr OSThreadProc(void *); diff --git a/rts/include/rts/Threads.h b/rts/include/rts/Threads.h index 83ffce9238..9303a9e80d 100644 --- a/rts/include/rts/Threads.h +++ b/rts/include/rts/Threads.h @@ -61,7 +61,7 @@ struct _StgMutArrPtrs *listThreads (Capability *cap); pid_t forkProcess (HsStablePtr *entry); #else pid_t forkProcess (HsStablePtr *entry) - GNU_ATTRIBUTE(__noreturn__); + STG_NORETURN; #endif HsBool rtsSupportsBoundThreads (void); |