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 | |
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.
-rw-r--r-- | rts/CloneStack.c | 2 | ||||
-rw-r--r-- | rts/Hpc.c | 2 | ||||
-rw-r--r-- | rts/Linker.c | 2 | ||||
-rw-r--r-- | rts/RtsAPI.c | 4 | ||||
-rw-r--r-- | rts/RtsFlags.c | 4 | ||||
-rw-r--r-- | rts/RtsMessages.c | 6 | ||||
-rw-r--r-- | rts/RtsStartup.c | 2 | ||||
-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 | ||||
-rw-r--r-- | rts/linker/M32Alloc.h | 2 | ||||
-rw-r--r-- | rts/linker/elf_reloc_aarch64.c | 2 | ||||
-rw-r--r-- | rts/posix/Select.c | 2 |
17 files changed, 26 insertions, 24 deletions
diff --git a/rts/CloneStack.c b/rts/CloneStack.c index 1ece19dc61..4aebea0d04 100644 --- a/rts/CloneStack.c +++ b/rts/CloneStack.c @@ -98,7 +98,7 @@ void handleCloneStackMessage(MessageCloneStack *msg){ #else // !defined(THREADED_RTS) -GNU_ATTRIBUTE(__noreturn__) +STG_NORETURN void sendCloneStackMessage(StgTSO *tso STG_UNUSED, HsStablePtr mvar STG_UNUSED) { barf("Sending CloneStackMessages is only available in threaded RTS!"); } @@ -45,7 +45,7 @@ HpcModuleInfo *modules = 0; static char *tixFilename = NULL; -static void GNU_ATTRIBUTE(__noreturn__) +static void STG_NORETURN failure(char *msg) { debugTrace(DEBUG_hpc,"hpc failure: %s\n",msg); fprintf(stderr,"Hpc failure: %s\n",msg); diff --git a/rts/Linker.c b/rts/Linker.c index 12d5418d02..3121cc38df 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1971,7 +1971,7 @@ void * loadNativeObj (pathchar *path, char **errmsg) return r; } #else -void * GNU_ATTRIBUTE(__noreturn__) +void * STG_NORETURN loadNativeObj (pathchar *path, char **errmsg) { UNUSED(path); diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index b679a5fa3b..5cbea01496 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -862,7 +862,7 @@ void rts_listMiscRoots (ListRootsCb cb, void *user) } #else -PauseToken GNU_ATTRIBUTE(__noreturn__) +PauseToken STG_NORETURN *rts_pause (void) { errorBelch("Warning: Pausing the RTS is only possible for " @@ -870,7 +870,7 @@ PauseToken GNU_ATTRIBUTE(__noreturn__) stg_exit(EXIT_FAILURE); } -void GNU_ATTRIBUTE(__noreturn__) +void STG_NORETURN rts_resume (PauseToken *pauseToken STG_UNUSED) { errorBelch("Warning: Resuming the RTS is only possible for " diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 881b75be53..2b87768657 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -119,7 +119,7 @@ static bool read_heap_profiling_flag(const char *arg); static void read_trace_flags(const char *arg); #endif -static void errorUsage (void) GNU_ATTRIBUTE(__noreturn__); +static void errorUsage (void) STG_NORETURN; #if defined(mingw32_HOST_OS) static char** win32_full_utf8_argv; @@ -2421,7 +2421,7 @@ static void read_trace_flags(const char *arg) } #endif -static void GNU_ATTRIBUTE(__noreturn__) +static void STG_NORETURN bad_option(const char *s) { errorBelch("bad RTS option: %s", s); diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c index 8ece485854..2a92c8d228 100644 --- a/rts/RtsMessages.c +++ b/rts/RtsMessages.c @@ -139,7 +139,7 @@ isGUIApp(void) } #endif -void GNU_ATTRIBUTE(__noreturn__) +void STG_NORETURN rtsFatalInternalErrorFn(const char *s, va_list ap) { #if defined(mingw32_HOST_OS) @@ -322,7 +322,7 @@ rtsDebugMsgFn(const char *s, va_list ap) // Used in stg_badAlignment_entry defined in StgStartup.cmm. -void rtsBadAlignmentBarf(void) GNUC3_ATTRIBUTE(__noreturn__); +void rtsBadAlignmentBarf(void) STG_NORETURN; void rtsBadAlignmentBarf() @@ -331,7 +331,7 @@ rtsBadAlignmentBarf() } // Used by code generator -void rtsOutOfBoundsAccess(void) GNUC3_ATTRIBUTE(__noreturn__); +void rtsOutOfBoundsAccess(void) STG_NORETURN; void rtsOutOfBoundsAccess() diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index a80dfc2959..5b0cc9f712 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -660,7 +660,7 @@ shutdownHaskellAndExit(int n, int fastExit) } #if !defined(mingw32_HOST_OS) -static void exitBySignal(int sig) GNUC3_ATTRIBUTE(__noreturn__); +static void exitBySignal(int sig) STG_NORETURN; void shutdownHaskellAndSignal(int sig, int fastExit) 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); diff --git a/rts/linker/M32Alloc.h b/rts/linker/M32Alloc.h index 331958614c..c866029a65 100644 --- a/rts/linker/M32Alloc.h +++ b/rts/linker/M32Alloc.h @@ -21,7 +21,7 @@ #if defined(NEED_M32) #define M32_NO_RETURN /* Nothing */ #else -#define M32_NO_RETURN GNUC3_ATTRIBUTE(__noreturn__) +#define M32_NO_RETURN STG_NORETURN #endif struct m32_allocator_t; diff --git a/rts/linker/elf_reloc_aarch64.c b/rts/linker/elf_reloc_aarch64.c index 790378ab0e..8afc52317b 100644 --- a/rts/linker/elf_reloc_aarch64.c +++ b/rts/linker/elf_reloc_aarch64.c @@ -22,7 +22,7 @@ bool isAdrp(addr_t p); bool isLoadStore(addr_t p); bool isAddSub(addr_t p); bool isVectorOp(addr_t p); -int64_t decodeAddendAarch64(Section * section, Elf_Rel * rel) GNU_ATTRIBUTE(__noreturn__); +int64_t decodeAddendAarch64(Section * section, Elf_Rel * rel) STG_NORETURN; bool encodeAddendAarch64(Section * section, Elf_Rel * rel, int64_t addend); bool isBranch(addr_t p) { diff --git a/rts/posix/Select.c b/rts/posix/Select.c index 07903865a8..2f9f95728c 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -115,7 +115,7 @@ static bool wakeUpSleepingThreads (LowResTime now) return flag; } -static void GNUC3_ATTRIBUTE(__noreturn__) +static void STG_NORETURN fdOutOfRange (int fd) { errorBelch("file descriptor %d out of range for select (0--%d).\n" |