Fix missing field initializers and enable warning
authorAndre Heinecke <aheinecke@intevation.de>
Mon, 15 Aug 2016 09:12:21 +0000 (11:12 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Mon, 15 Aug 2016 09:12:21 +0000 (11:12 +0200)
* configure.ac (CXXFLAGS, CFLAGS): Enable Wmissing-field-initalizers.
* src/attachment.cpp (do_crypt_stream): Fix init.
* src/main.c (write_options): Fix init.
* src/windowmessages.cpp (do_in_ui_thread): Fix init.

configure.ac
src/attachment.cpp
src/main.c
src/windowmessages.cpp

index 9b5cbad..3699875 100644 (file)
@@ -203,21 +203,11 @@ if test "$GCC" = yes; then
     CXXFLAGS="$CXXFLAGS -Wall -mms-bitfields -fno-strict-aliasing"
     if test "$USE_MAINTAINER_MODE" = "yes"; then
         CFLAGS="$CFLAGS -Werror -Wcast-align -Wshadow -Wstrict-prototypes"
-        CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
+        CFLAGS="$CFLAGS -Wformat-security"
         CFLAGS="$CFLAGS -W -Wno-sign-compare"
         CXXFLAGS="$CXXFLAGS -Werror -Wcast-align -Wshadow"
-        CXXFLAGS="$CXXFLAGS -Wno-format-y2k -Wformat-security"
+        CXXFLAGS="$CXXFLAGS -Wformat-security"
         CXXFLAGS="$CXXFLAGS -W -Wno-sign-compare"
-        AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
-        _gcc_cflags_save=$CFLAGS
-        CFLAGS="-Wno-missing-field-initializers"
-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_mfi=yes,_gcc_mfi=no)
-        AC_MSG_RESULT($_gcc_mfi)
-        CFLAGS=$_gcc_cflags_save;
-        if test x"$_gcc_mfi" = xyes ; then
-          CFLAGS="$CFLAGS -Wno-missing-field-initializers"
-          CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"
-        fi
     fi
 
     AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
index c93a3a4..87071dc 100644 (file)
@@ -75,9 +75,9 @@ do_crypt_stream (LPSTREAM stream, symenc_t symenc, bool encrypt)
      stream returns E_NOT_IMPLMENTED for that :-)
      So we manually track the read and writepos. Read is offset
      at 16 because of the GpgOL message. */
-  LARGE_INTEGER readpos = {0},
-                writepos = {0};
-  ULARGE_INTEGER new_size = {0};
+  LARGE_INTEGER readpos = {0, 0},
+                writepos = {0, 0};
+  ULARGE_INTEGER new_size = {0, 0};
 
   if (!encrypt)
     {
index d30f74b..12321f3 100644 (file)
@@ -736,22 +736,22 @@ write_options (void)
     int  value;
     char *s_val;
   } table[] = {
-    {"enableSmime",              0, opt.enable_smime},
+    {"enableSmime",              0, opt.enable_smime, NULL},
 /*     {"defaultProtocol",          3, opt.default_protocol}, */
-    {"encryptDefault",           0, opt.encrypt_default},
-    {"signDefault",              0, opt.sign_default},
-    {"previewDecrypt",           0, opt.preview_decrypt},
-    {"encodingFormat",           1, opt.enc_format},
+    {"encryptDefault",           0, opt.encrypt_default, NULL},
+    {"signDefault",              0, opt.sign_default, NULL},
+    {"previewDecrypt",           0, opt.preview_decrypt, NULL},
+    {"encodingFormat",           1, opt.enc_format, NULL},
     {"logFile",                  2, 0, logfile},
     {"defaultKey",               2, 0, opt.default_key},
-    {"enableDefaultKey",         0, opt.enable_default_key},
-    {"preferHtml",               0, opt.prefer_html},
-    {"gitCommit",                4, opt.git_commit},
-    {"formsRevision",            1, opt.forms_revision},
-    {"announceNumber",           1, opt.announce_number},
-    {"bodyAsAttachment",         0, opt.body_as_attachment},
-    {"mimeUI", MIME_UI_DEFAULT, opt.mime_ui},
-    {NULL, 0}
+    {"enableDefaultKey",         0, opt.enable_default_key, NULL},
+    {"preferHtml",               0, opt.prefer_html, NULL},
+    {"gitCommit",                4, opt.git_commit, NULL},
+    {"formsRevision",            1, opt.forms_revision, NULL},
+    {"announceNumber",           1, opt.announce_number, NULL},
+    {"bodyAsAttachment",         0, opt.body_as_attachment, NULL},
+    {"mimeUI", MIME_UI_DEFAULT, opt.mime_ui, NULL},
+    {NULL, 0, 0, NULL}
   };
   char buf[32];
   int rc, i;
index ce1afa5..e0c95cd 100644 (file)
@@ -99,7 +99,7 @@ send_msg_to_ui_thread (wm_ctx_t *ctx)
 int
 do_in_ui_thread (gpgol_wmsg_type type, void *data)
 {
-  wm_ctx_t ctx = {0};
+  wm_ctx_t ctx = {NULL, UNKNOWN, 0};
   ctx.wmsg_type = type;
   ctx.data = data;
   if (send_msg_to_ui_thread (&ctx))