From: Dave Hart Date: Sat, 11 Mar 2023 08:23:55 +0000 (-0500) Subject: [Bug 3799] Enable libopts noreturn compiler advice for MSC. X-Git-Tag: NTP_4_2_8P16~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6120787bb25beefde3a28c094cf072f2846cc5d3;p=thirdparty%2Fntp.git [Bug 3799] Enable libopts noreturn compiler advice for MSC. Add ChangeLog to ntpd project for easy editing within VS. bk: 640c3a9bo23uPY1V54Gsc4IKReVTVg --- diff --git a/ChangeLog b/ChangeLog index 4843f182a..5c279695f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ --- * [Bug 3800] libopts-42.1.17 does not compile with Microsoft C. +* [Bug 3799] Enable libopts noreturn compiler advice for MSC. * [Bug 3797] Windows getaddrinfo w/AI_ADDRCONFIG fails for localhost when disconnected, breaking ntpq and ntpdc. * [Bug 3795] pollskewlist documentation uses | when it shouldn't. diff --git a/ports/winnt/vs2015/ntpd/ntpd.vcxproj b/ports/winnt/vs2015/ntpd/ntpd.vcxproj index 32636048a..e4e837791 100644 --- a/ports/winnt/vs2015/ntpd/ntpd.vcxproj +++ b/ports/winnt/vs2015/ntpd/ntpd.vcxproj @@ -500,6 +500,7 @@ .\version.c;%(Outputs) + @@ -516,4 +517,4 @@ - + \ No newline at end of file diff --git a/ports/winnt/vs2015/ntpd/ntpd.vcxproj.filters b/ports/winnt/vs2015/ntpd/ntpd.vcxproj.filters index 10bc14fcc..2dcdfd014 100644 --- a/ports/winnt/vs2015/ntpd/ntpd.vcxproj.filters +++ b/ports/winnt/vs2015/ntpd/ntpd.vcxproj.filters @@ -555,6 +555,7 @@ Resource Files + @@ -562,4 +563,4 @@ - + \ No newline at end of file diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index 36bb43f29..f7a64f17a 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -463,12 +463,12 @@ static char const * program_pkgdatadir = pkgdatadir_default; static tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED; static tePagerState pagerState = PAGER_STATE_INITIAL; -static noreturn void option_exits(int exit_code); -static noreturn void fserr_exit(char const * prog, char const * op, - char const * fname); -static void fserr_warn(char const * prog, char const * op, - char const * fname); -static noreturn void ao_bug(char const * msg); +static lo_noreturn void option_exits(int exit_code); +static lo_noreturn void fserr_exit(char const * prog, char const * op, + char const * fname); +static void fserr_warn(char const * prog, char const * op, + char const * fname); +static lo_noreturn void ao_bug(char const * msg); FILE * option_usage_fp = NULL; diff --git a/sntp/libopts/autoopts/project.h b/sntp/libopts/autoopts/project.h index 1f196efa0..05ebe5e92 100644 --- a/sntp/libopts/autoopts/project.h +++ b/sntp/libopts/autoopts/project.h @@ -77,5 +77,11 @@ typedef int tSuccess; #define MOD_LOCAL static #define parse_duration option_parse_duration +#ifdef _MSC_VER +#define lo_noreturn __declspec(noreturn) +#else +#define lo_noreturn noreturn +#endif + #endif /* AUTOGEN_PROJECT_H */ /* end of project.h */ diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c index 10ed12005..8541c1ff6 100644 --- a/sntp/libopts/makeshell.c +++ b/sntp/libopts/makeshell.c @@ -35,7 +35,7 @@ #define UPPER(_c) (toupper(to_uchar(_c))) #define LOWER(_c) (tolower(to_uchar(_c))) -noreturn static void +lo_noreturn static void option_exits(int exit_code) { if (print_exit) @@ -43,7 +43,7 @@ option_exits(int exit_code) exit(exit_code); } -noreturn static void +lo_noreturn static void ao_bug(char const * msg) { fprintf(stderr, zao_bug_msg, msg); @@ -57,7 +57,7 @@ fserr_warn(char const * prog, char const * op, char const * fname) op, fname); } -noreturn static void +lo_noreturn static void fserr_exit(char const * prog, char const * op, char const * fname) { fserr_warn(prog, op, fname); diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index 437e81ed9..49c75bb5d 100644 --- a/sntp/libopts/proto.h +++ b/sntp/libopts/proto.h @@ -247,16 +247,16 @@ load_opt_line(tOptions * opts, tOptState * opt_state, char * line, /* * Static declarations from makeshell.c */ -noreturn static void +lo_noreturn static void option_exits(int exit_code); -noreturn static void +lo_noreturn static void ao_bug(char const * msg); static void fserr_warn(char const * prog, char const * op, char const * fname); -noreturn static void +lo_noreturn static void fserr_exit(char const * prog, char const * op, char const * fname); static void diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c index 8df3591e6..9775bdb0b 100644 --- a/sntp/libopts/usage.c +++ b/sntp/libopts/usage.c @@ -514,7 +514,7 @@ optionPrintParagraphs(char const * text, bool plain, FILE * fp) * If "exitCode" is "AO_EXIT_REQ_USAGE" (normally 64), then output will to * to stdout and the actual exit code will be "EXIT_SUCCESS". =*/ -noreturn void +lo_noreturn void optionUsage(tOptions * opts, int usage_exit_code) { int exit_code = (usage_exit_code == AO_EXIT_REQ_USAGE)