mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
Merge pull request #534 from smcv/c11-funcptr-noreturn
Add a separate noreturn macro for function pointers
This commit is contained in:
commit
fdef98ffc0
3 changed files with 12 additions and 2 deletions
|
@ -198,7 +198,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
YQ2_ATTR_NORETURN void (IMPORT *Sys_Error) (int err_level, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
YQ2_ATTR_NORETURN_FUNCPTR void (IMPORT *Sys_Error) (int err_level, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
void (IMPORT *Cmd_AddCommand) (char *name, void(*cmd)(void));
|
||||
void (IMPORT *Cmd_RemoveCommand) (char *name);
|
||||
|
|
|
@ -75,6 +75,16 @@ typedef unsigned char byte;
|
|||
#define YQ2_ATTR_NORETURN
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/* ISO C11 _Noreturn can't be attached to function pointers, so
|
||||
* use the gcc/clang-specific version for function pointers, even
|
||||
* in C11 mode. MSVC __declspec(noreturn) seems to have the same
|
||||
* restriction as _Noreturn so can't be used here either. */
|
||||
#define YQ2_ATTR_NORETURN_FUNCPTR __attribute__ ((noreturn))
|
||||
#else
|
||||
#define YQ2_ATTR_NORETURN_FUNCPTR /* nothing */
|
||||
#endif
|
||||
|
||||
/* angle indexes */
|
||||
#define PITCH 0 /* up / down */
|
||||
#define YAW 1 /* left / right */
|
||||
|
|
|
@ -120,7 +120,7 @@ typedef struct
|
|||
they connect, and changes are sent to all connected clients. */
|
||||
void (*configstring)(int num, char *string);
|
||||
|
||||
YQ2_ATTR_NORETURN void (*error)(char *fmt, ...);
|
||||
YQ2_ATTR_NORETURN_FUNCPTR void (*error)(char *fmt, ...);
|
||||
|
||||
/* the *index functions create configstrings
|
||||
and some internal server state */
|
||||
|
|
Loading…
Reference in a new issue