Changeset: 8e8963d9a218 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8e8963d9a218 Modified Files: NT/monetdb_config.h.in clients/Tests/exports.stable.out clients/mapiclient/mclient.c clients/mapiclient/msqldump.c configure.ag gdk/gdk.h gdk/gdk_utils.h monetdb5/mal/mal.h testing/helpers.h tools/merovingian/client/monetdb.c tools/mserver/mserver5.c Branch: default Log Message:
Use C11 way of specifying a function doesn't return. With alternative implementation, of course. diffs (168 lines): diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in --- a/NT/monetdb_config.h.in +++ b/NT/monetdb_config.h.in @@ -833,6 +833,8 @@ #endif #endif +#define _Noreturn __declspec(noreturn) + /* Define to `long int' if <sys/types.h> does not define. */ /* #undef off_t */ diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -234,10 +234,10 @@ gdk_return GDKcreatedir(const char *nme) gdk_return GDKcreatesem(int id, int count, int *semid); int GDKdebug; void GDKerror(_In_z_ _Printf_format_string_ const char *format, ...) __attribute__((__format__(__printf__, 1, 2))); -void GDKexit(int status) __attribute__((__noreturn__)); +_Noreturn void GDKexit(int status); void GDKexit(int status); bool GDKexiting(void); -void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) __attribute__((__format__(__printf__, 1, 2))) __attribute__((__noreturn__)); +_Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) __attribute__((__format__(__printf__, 1, 2))); void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) __attribute__((__format__(__printf__, 1, 2))); jmp_buf GDKfataljump; bit GDKfataljumpenable; @@ -2360,7 +2360,7 @@ MT_Lock mal_contextLock; MT_Lock mal_copyLock; void mal_dataflow_reset(void) __attribute__((__visibility__("hidden"))); MT_Lock mal_delayLock; -void mal_exit(int status); +_Noreturn void mal_exit(int status); void mal_factory_reset(void) __attribute__((__visibility__("hidden"))); int mal_init(void); void mal_instruction_reset(void); diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -3191,8 +3191,7 @@ putfile(void *data, const char *filename return NULL; /* success */ } -__declspec(noreturn) static void usage(const char *prog, int xit) - __attribute__((__noreturn__)); +static _Noreturn void usage(const char *prog, int xit); static void usage(const char *prog, int xit) diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c --- a/clients/mapiclient/msqldump.c +++ b/clients/mapiclient/msqldump.c @@ -27,8 +27,7 @@ #include "mutils.h" /* mercurial_revision */ #include "dotmonetdb.h" -__declspec(noreturn) static void usage(const char *prog, int xit) - __attribute__((__noreturn__)); +static _Noreturn void usage(const char *prog, int xit); static void usage(const char *prog, int xit) diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2513,6 +2513,22 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_DEFINE([__hidden], [/* empty */], [Does your compiler support the `__hidden' specifier?])]) +AC_MSG_CHECKING([if your compiler understands `_Noreturn']) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include <stdlib.h> + + _Noreturn void foo (const char *a, ...); + + void foo (const char *a, ...) + { (void)a; exit(0); } + ]], + [[ foo ("%s", ""); ]] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_DEFINE([_Noreturn], [__attribute__((__noreturn__))], + [Does your compiler support the `_Noreturn' specifier?])]) + AC_MSG_CHECKING([if your compiler can use NAN as an initializer]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ @%:@include <math.h> diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -2230,9 +2230,8 @@ gdk_export void GDKerror(_In_z_ _Printf_ gdk_export void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) __attribute__((__format__(__printf__, 1, 2))); #ifndef HAVE_EMBEDDED -__declspec(noreturn) gdk_export void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) - __attribute__((__format__(__printf__, 1, 2))) - __attribute__((__noreturn__)); +gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) + __attribute__((__format__(__printf__, 1, 2))); #else gdk_export void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) __attribute__((__format__(__printf__, 1, 2))); diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h --- a/gdk/gdk_utils.h +++ b/gdk/gdk_utils.h @@ -83,8 +83,7 @@ gdk_export void GDKsetmallocsuccesscount * takes care of this. */ #ifndef HAVE_EMBEDDED -__declspec(noreturn) gdk_export void GDKexit(int status) - __attribute__((__noreturn__)); +gdk_export _Noreturn void GDKexit(int status); #else gdk_export void GDKexit(int status); #endif diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -84,7 +84,7 @@ mal_export MT_Lock mal_oltpLock ; mal_export int mal_init(void); -mal_export void mal_exit(int status); +mal_export _Noreturn void mal_exit(int status); mal_export void mserver_reset(void); /* This should be here, but cannot, as "Client" isn't known, yet ... |-( diff --git a/testing/helpers.h b/testing/helpers.h --- a/testing/helpers.h +++ b/testing/helpers.h @@ -12,8 +12,7 @@ #define MAX(a,b) (((a)>(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b)) -__declspec(noreturn) void ErrXit(char *text1, char *text2, int num) - __attribute__((__noreturn__)); +_Noreturn void ErrXit(char *text1, char *text2, int num); FILE *Rfopen(char *name); FILE *Wfopen(char *name); FILE *Afopen(char *name); diff --git a/tools/merovingian/client/monetdb.c b/tools/merovingian/client/monetdb.c --- a/tools/merovingian/client/monetdb.c +++ b/tools/merovingian/client/monetdb.c @@ -1104,8 +1104,7 @@ typedef enum { INHERIT } meroset; -__declspec(noreturn) static void command_set(int argc, char *argv[], meroset type) - __attribute__((__noreturn__)); +static _Noreturn void command_set(int argc, char *argv[], meroset type); static void command_set(int argc, char *argv[], meroset type) diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c --- a/tools/mserver/mserver5.c +++ b/tools/mserver/mserver5.c @@ -85,8 +85,7 @@ mserver_invalid_parameter_handler( } #endif -__declspec(noreturn) static void usage(char *prog, int xit) - __attribute__((__noreturn__)); +static _Noreturn void usage(char *prog, int xit); static void usage(char *prog, int xit) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list