From: Martin Burnicki Date: Tue, 6 Jan 2015 14:14:03 +0000 (+0100) Subject: [Bug 2728] Work around C99-style structure initialization code for older compilers... X-Git-Tag: NTP_4_2_8P1_BETA5~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbabafc8fdd3f8bb5f16307f1c09683e19ecd0a3;p=thirdparty%2Fntp.git [Bug 2728] Work around C99-style structure initialization code for older compilers, specifically Visual Studio prior to VS2013. bk: 54abedabIZLSwvAMYpfyJwFx-gyVFw --- diff --git a/ChangeLog b/ChangeLog index 5274ed5cc..c5ea02d4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* [Bug 2728] Work around C99-style structure initialization code + for older compilers, specifically Visual Studio prior to VS2013. * [Bug 2695] Windows build: __func__ not supported under Windows. --- (4.2.8p1-beta4) 2015/01/04 Released by Harlan Stenn diff --git a/ntpq/ntpq-subs.c b/ntpq/ntpq-subs.c index a33b4ccc8..56bc22802 100644 --- a/ntpq/ntpq-subs.c +++ b/ntpq/ntpq-subs.c @@ -330,8 +330,11 @@ typedef struct var_display_collection_tag { l_fp lfp; /* NTP_LFP */ } v; /* retrieved value */ } vdc; -#define VDC_INIT(a, b, c) { .tag = a, .display = b, .type = c } - +#if !defined(MISSING_C99_STYLE_INIT) +# define VDC_INIT(a, b, c) { .tag = a, .display = b, .type = c } +#else +# define VDC_INIT(a, b, c) { a, b, c } +#endif /* * other local function prototypes */ diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h index d5c8b5f22..6de8857c1 100644 --- a/ports/winnt/include/config.h +++ b/ports/winnt/include/config.h @@ -457,6 +457,7 @@ typedef unsigned long uintptr_t; #if defined(_MSC_VER) && _MSC_VER<1800 # define MISSING_INTTYPES_H 1 /* not provided by VS2012 and earlier */ # define MISSING_STDBOOL_H 1 /* not provided by VS2012 and earlier */ +# define MISSING_C99_STYLE_INIT 1 /* see [Bug 2728] */ #else #if defined(_MSC_VER) && _MSC_VER>=1800 /* VS2013 and above support C99 types */ diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index e14f174a9..6987958cd 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -452,7 +452,7 @@ typedef enum { AOFLAG_TABLE } ao_flags_t; #undef _aof_ static char const zNil[] = ""; -static arg_types_t argTypes = { .pzStr = NULL }; +static arg_types_t argTypes = { 0 }; static char line_fmt_buf[32]; static bool displayEnum = false; static char const pkgdatadir_default[] = PKGDATADIR; diff --git a/sntp/libopts/enum.c b/sntp/libopts/enum.c index 3515e6621..e759e8c0a 100644 --- a/sntp/libopts/enum.c +++ b/sntp/libopts/enum.c @@ -253,7 +253,7 @@ find_name(char const * name, tOptions * pOpts, tOptDesc * pOD, char const * optionKeywordName(tOptDesc * pOD, unsigned int enum_val) { - tOptDesc od = { .optIndex = 0 }; + tOptDesc od = { 0 }; od.optArg.argEnum = enum_val; (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, &od );