]> granicus.if.org Git - gc/commitdiff
Workaround 'struct member is never used' cppcheck style warnings
authorIvan Maidanski <ivmai@mail.ru>
Tue, 18 Oct 2016 07:59:20 +0000 (10:59 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 1 Nov 2016 22:14:57 +0000 (01:14 +0300)
* os_dep.c [OS2] (GC_register_data_segments): Assign 0 to
hdrdos.padding, hdr386.exe_format_level/os/padding1/padding2,
seg.pagemap/mapsize/reserved fields if CPPCHECK; add comment.
* os_dep.c [MPROTECT_VDB && DARWIN] (GC_mprotect_thread): Assign 0 to
the first element of reply.data, msg.data fields if CPPCHECK; add
comment.
* typd_mlc.c (TAG): Define to ad.ad_tag (instead of ld.ld_tag).

os_dep.c
typd_mlc.c

index a28697c0bf59bd402925582644288f36821c8a83..2a1f168fb00f305dd2082a8b79f30516d429315f 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -1464,6 +1464,16 @@ void GC_register_data_segments(void)
     struct o32_obj seg;         /* Current segment */
     int nsegs;
 
+#   if defined(CPPCHECK)
+        hdrdos.padding[0] = 0; /* to prevent "field unused" warnings */
+        hdr386.exe_format_level = 0;
+        hdr386.os = 0;
+        hdr386.padding1[0] = 0;
+        hdr386.padding2[0] = 0;
+        seg.pagemap = 0;
+        seg.mapsize = 0;
+        seg.reserved = 0;
+#   endif
     if (DosGetInfoBlocks(&ptib, &ppib) != NO_ERROR) {
         ABORT("DosGetInfoBlocks failed");
     }
@@ -3913,6 +3923,10 @@ STATIC void *GC_mprotect_thread(void *arg)
   mach_msg_id_t id;
 
   if ((word)arg == (word)-1) return 0; /* to make compiler happy */
+# if defined(CPPCHECK)
+    reply.data[0] = 0; /* to prevent "field unused" warnings */
+    msg.data[0] = 0;
+# endif
 
 # if defined(THREADS) && !defined(GC_NO_THREADS_DISCOVERY)
     GC_darwin_register_mach_handler_thread(mach_thread_self());
index b0699c5f94a72ac10de3a44c37ce316b3c94f1a1..131d49e682b593b1c0cbe3b9f78b60f61304bc92 100644 (file)
@@ -85,7 +85,7 @@ typedef union ComplexDescriptor {
         union ComplexDescriptor * sd_second;
     } sd;
 } complex_descriptor;
-#define TAG ld.ld_tag
+#define TAG ad.ad_tag
 
 STATIC ext_descr * GC_ext_descriptors = NULL;
                                         /* Points to array of extended  */