Mark noreturn functions

This commit is contained in:
Christian Göttsche 2020-09-08 14:28:15 +02:00 committed by cgzones
parent b85a31415e
commit e719a85994
17 changed files with 37 additions and 11 deletions

1
CRT.c
View File

@ -513,6 +513,7 @@ int CRT_colorScheme = 0;
void *backtraceArray[128]; void *backtraceArray[128];
ATTR_NORETURN
static void CRT_handleSIGTERM(int sgn) { static void CRT_handleSIGTERM(int sgn) {
(void) sgn; (void) sgn;
CRT_done(); CRT_done();

View File

@ -5,11 +5,13 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#endif #endif
#include "Macros.h"
#include <err.h> #include <err.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
void fail(void); void fail(void) ATTR_NORETURN;
void* xMalloc(size_t size); void* xMalloc(size_t size);

View File

@ -6,6 +6,7 @@ in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "DarwinCRT.h"
#include "CRT.h" #include "CRT.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -7,6 +7,8 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
void CRT_handleSIGSEGV(int sgn); #include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif #endif

View File

@ -7,6 +7,7 @@ in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "DragonFlyBSDCRT.h"
#include "CRT.h" #include "CRT.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -8,6 +8,8 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
void CRT_handleSIGSEGV(int sgn); #include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif #endif

View File

@ -1,11 +1,12 @@
/* /*
htop - UnsupportedCRT.c htop - FreeBSDCRT.c
(C) 2014 Hisham H. Muhammad (C) 2014 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "FreeBSDCRT.h"
#include "CRT.h" #include "CRT.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,12 +1,14 @@
#ifndef HEADER_FreeBSDCRT #ifndef HEADER_FreeBSDCRT
#define HEADER_FreeBSDCRT #define HEADER_FreeBSDCRT
/* /*
htop - UnsupportedCRT.h htop - FreeBSDCRT.h
(C) 2014 Hisham H. Muhammad (C) 2014 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
void CRT_handleSIGSEGV(int sgn); #include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif #endif

2
htop.c
View File

@ -29,11 +29,13 @@ in the source distribution for its full text.
//#link m //#link m
ATTR_NORETURN
static void printVersionFlag(void) { static void printVersionFlag(void) {
fputs("htop " VERSION "\n", stdout); fputs("htop " VERSION "\n", stdout);
exit(0); exit(0);
} }
ATTR_NORETURN
static void printHelpFlag(void) { static void printHelpFlag(void) {
fputs("htop " VERSION "\n" fputs("htop " VERSION "\n"
"Released under the GNU GPL.\n\n" "Released under the GNU GPL.\n\n"

View File

@ -6,6 +6,7 @@ in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "LinuxCRT.h"
#include "CRT.h" #include "CRT.h"
#include <signal.h> #include <signal.h>

View File

@ -7,6 +7,8 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
#include "Macros.h"
void CRT_handleSIGSEGV(int sgn); void CRT_handleSIGSEGV(int sgn);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
htop - UnsupportedCRT.c htop - OpenBSDCRT.c
(C) 2014 Hisham H. Muhammad (C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville (C) 2015 Michael McConville
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
@ -7,6 +7,7 @@ in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "OpenBSDCRT.h"
#include "CRT.h" #include "CRT.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,13 +1,15 @@
#ifndef HEADER_OpenBSDCRT #ifndef HEADER_OpenBSDCRT
#define HEADER_OpenBSDCRT #define HEADER_OpenBSDCRT
/* /*
htop - UnsupportedCRT.h htop - OpenBSDCRT.h
(C) 2014 Hisham H. Muhammad (C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville (C) 2015 Michael McConville
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
void CRT_handleSIGSEGV(int sgn); #include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif #endif

View File

@ -7,6 +7,7 @@ in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "SolarisCRT.h"
#include "CRT.h" #include "CRT.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -8,6 +8,8 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
void CRT_handleSIGSEGV(int sgn); #include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif #endif

View File

@ -6,6 +6,7 @@ in the source distribution for its full text.
*/ */
#include "config.h" #include "config.h"
#include "UnsupportedCRT.h"
#include "CRT.h" #include "CRT.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -7,6 +7,8 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
void CRT_handleSIGSEGV(int sgn); #include "Macros.h"
void CRT_handleSIGSEGV(int sgn) ATTR_NORETURN;
#endif #endif