]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2728] Work around C99-style structure initialization code for older compilers...
authorMartin Burnicki <burnicki@ntp.org>
Tue, 6 Jan 2015 14:14:03 +0000 (15:14 +0100)
committerMartin Burnicki <burnicki@ntp.org>
Tue, 6 Jan 2015 14:14:03 +0000 (15:14 +0100)
bk: 54abedabIZLSwvAMYpfyJwFx-gyVFw

ChangeLog
ntpq/ntpq-subs.c
ports/winnt/include/config.h
sntp/libopts/autoopts.h
sntp/libopts/enum.c

index 5274ed5cc9141caa71604f7d6cfe07826980de85..c5ea02d4c8f77a5884a542b586e618f90f45363f 100644 (file)
--- 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 <stenn@ntp.org>
index a33b4ccc8104ca96af68debe3066634a462c4030..56bc2280223ff8ebc0266ffc8b1cdd2f89ae5658 100644 (file)
@@ -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
  */
index d5c8b5f224c91ae4cbc5e40e05167458a863b2be..6de8857c1fed0c4a87a9bc3276250d49625aab76 100644 (file)
@@ -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 */
index e14f174a9b2ad11c81c6c57dddff06489b8a6c1b..6987958cd11126cfff0b6dc5246e9b03f0ec6712 100644 (file)
@@ -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;
index 3515e662106c8b9142ed153ef3c30a0413f49a0b..e759e8c0a5f070493367e0ac9ea3d4db9de76afc 100644 (file)
@@ -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 );