From 138c3bb2d817ebe07a1b6e18de54ec9448aed403 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 18 Oct 2016 10:59:20 +0300 Subject: [PATCH] Workaround 'struct member is never used' cppcheck style warnings * 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 | 14 ++++++++++++++ typd_mlc.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/os_dep.c b/os_dep.c index 1394871..4bb7048 100644 --- 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"); } @@ -3912,6 +3922,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()); diff --git a/typd_mlc.c b/typd_mlc.c index 47af119..c858bb1 100644 --- a/typd_mlc.c +++ b/typd_mlc.c @@ -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 */ -- 2.7.4