Skip to content

Commit

Permalink
decorate functions that do not return
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-zimoch committed Aug 27, 2024
1 parent 052a0c7 commit 63b02b7
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 12 deletions.
2 changes: 0 additions & 2 deletions modules/ca/src/client/acctst.c
Original file line number Diff line number Diff line change
Expand Up @@ -3549,8 +3549,6 @@ int acctst ( const char * pName, unsigned interestLevel, unsigned channelCount,
printf ( "\nTest Complete\n" );

epicsExit ( EXIT_SUCCESS );

return 0;
}


4 changes: 2 additions & 2 deletions modules/ca/src/client/caDiagnostics.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ extern "C" {
enum appendNumberFlag {appendNumber, dontAppendNumber};
int catime ( const char *channelName, unsigned channelCount, enum appendNumberFlag appNF );

int acctst ( const char *pname, unsigned logggingInterestLevel,
int EPICS_NORETURN(acctst ( const char *pname, unsigned logggingInterestLevel,
unsigned channelCount, unsigned repetitionCount,
enum ca_preemptive_callback_select select );
enum ca_preemptive_callback_select select ));

#define CATIME_OK 0
#define CATIME_ERROR -1
Expand Down
6 changes: 3 additions & 3 deletions modules/libcom/src/flex/flexdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,16 +696,16 @@ extern void dataend (void);
extern void flexerror (char[]) NORETURN;

/* report a fatal error message and terminate */
extern void flexfatal (char[]);
extern void flexfatal (char[]) NORETURN;

/* return current time */
extern char *flex_gettime();

/* report an error message formatted with one integer argument */
extern void lerrif (char[], int);
extern void lerrif (char[], int) NORETURN;

/* report an error message formatted with one string argument */
extern void lerrsf (char[], char[]);
extern void lerrsf (char[], char[]) NORETURN;

/* spit out a "# line" statement */
extern void line_directive_out (FILE*);
Expand Down
4 changes: 2 additions & 2 deletions modules/libcom/src/misc/cantProceed.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ extern "C" {
* \param errorMessage A printf-style error message describing the error.
* \param ... Any parameters required for the error message.
*/
LIBCOM_API void cantProceed(
LIBCOM_API void EPICS_NORETURN(cantProceed(
EPICS_PRINTF_FMT(const char *errorMessage), ...
) EPICS_PRINTF_STYLE(1,2);
)) EPICS_PRINTF_STYLE(1,2);

/** \name Memory Allocation Functions
* These versions of calloc() and malloc() never fail, they suspend the
Expand Down
3 changes: 2 additions & 1 deletion modules/libcom/src/misc/epicsExit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#ifndef epicsExith
#define epicsExith
#include <libComAPI.h>
#include "compilerDependencies.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -38,7 +39,7 @@ typedef void (*epicsExitFunc)(void *arg);
* \brief Calls epicsExitCallAtExits(), then the OS exit() routine.
* \param status Passed to exit()
*/
LIBCOM_API void epicsExit(int status);
LIBCOM_API void EPICS_NORETURN(epicsExit(int status));
/**
* \brief Arrange to call epicsExit() later from a low priority thread.
*
Expand Down
2 changes: 1 addition & 1 deletion modules/libcom/src/misc/epicsUnitTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ LIBCOM_API void testTodoEnd(void);
* \param fmt A printf-style format string giving the reason for stopping.
* \param ... Any parameters required for the format string.
*/
LIBCOM_API void testAbort(EPICS_PRINTF_FMT(const char *fmt), ...)
LIBCOM_API void EPICS_NORETURN(testAbort(EPICS_PRINTF_FMT(const char *fmt), ...))
EPICS_PRINTF_STYLE(1, 2);
/** @} */

Expand Down
5 changes: 5 additions & 0 deletions modules/libcom/src/osi/compiler/clang/compilerSpecific.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@
*/
#define EPICS_UNUSED __attribute__((unused))

/*
* No return marker
*/
#define EPICS_NORETURN(f) f __attribute__((noreturn))

#endif /* ifndef compilerSpecific_h */
5 changes: 5 additions & 0 deletions modules/libcom/src/osi/compiler/gcc/compilerSpecific.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@
*/
#define EPICS_UNUSED __attribute__((unused))

/*
* No return marker
*/
#define EPICS_NORETURN(f) f __attribute__((noreturn))

#endif /* ifndef compilerSpecific_h */
5 changes: 5 additions & 0 deletions modules/libcom/src/osi/compiler/msvc/compilerSpecific.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@
# define EPICS_PRINTF_FMT(a) _Printf_format_string_ a
#endif

/*
* No return marker
*/
#define EPICS_NORETURN(f) __declspec(noreturn) f

#endif /* ifndef compilerSpecific_h */
4 changes: 4 additions & 0 deletions modules/libcom/src/osi/compilerDependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
# define EPICS_UNUSED
#endif

#ifndef EPICS_NORETURN
# define EPICS_NORETURN(f) f
#endif

#ifndef EPICS_FUNCTION
#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) || (defined(__cplusplus) && __cplusplus>=201103L)
# define EPICS_FUNCTION __func__
Expand Down
2 changes: 1 addition & 1 deletion modules/libcom/src/yacc/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ extern void tokenized_start(char *s) NORETURN;
extern void retyped_warning(char *s);
extern void reprec_warning(char *s);
extern void revalued_warning(char *s);
extern void terminal_start(char *s);
extern void terminal_start(char *s) NORETURN;
extern void restarted_warning(void);
extern void no_grammar(void) NORETURN;
extern void terminal_lhs(int s_lineno) NORETURN;
Expand Down

0 comments on commit 63b02b7

Please sign in to comment.