From 00ac4f46f5ac2e5f6b801ca8169ea2fca8748207 Mon Sep 17 00:00:00 2001 From: yz70s Date: Thu, 2 Jan 2020 12:29:41 +0100 Subject: Lower number of warnings disabled with visual studio from 71 to 27 (nw) And most of the remaining ones could be removed with simple code modifications. --- scripts/genie.lua | 74 +++++++++++------------------------------------- scripts/src/3rdparty.lua | 30 +++++--------------- 2 files changed, 23 insertions(+), 81 deletions(-) diff --git a/scripts/genie.lua b/scripts/genie.lua index 790f9d8bba1..7f9cffb4064 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1335,80 +1335,38 @@ end buildoptions { "/WX", -- Treats all compiler warnings as errors. "/w45038", -- warning C5038: data member 'member1' will be initialized after data member 'member2' - "/wd4025", -- warning C4025: 'number' : based pointer passed to function with variable arguments: parameter number + } + + buildoptions { "/wd4003", -- warning C4003: not enough actual parameters for macro 'xxx' + "/wd4005", -- warning C4005: The macro identifier is defined twice. The compiler uses the second macro definition "/wd4018", -- warning C4018: 'x' : signed/unsigned mismatch - "/wd4061", -- warning C4061: enumerator 'xxx' in switch of enum 'xxx' is not explicitly handled by a case label + "/wd4060", -- warning C4060: switch statement contains no 'case' or 'default' labels + "/wd4065", -- warning C4065: switch statement contains 'default' but no 'case' labels "/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter "/wd4127", -- warning C4127: conditional expression is constant - "/wd4131", -- warning C4131: 'xxx' : uses old-style declarator - "/wd4141", -- warning C4141: 'xxx' : used more than once "/wd4146", -- warning C4146: unary minus operator applied to unsigned type, result still unsigned - "/wd4150", -- warning C4150: deletion of pointer to incomplete type 'xxx'; no destructor called - "/wd4189", -- warning C4189: 'xxx' : local variable is initialized but not referenced - "/wd4191", -- warning C4191: 'type cast' : unsafe conversion from 'xxx' to 'xxx' // 64-bit only "/wd4201", -- warning C4201: nonstandard extension used : nameless struct/union - "/wd4232", -- warning C4232: nonstandard extension used : 'xxx' : address of dllimport 'xxx' is not static, identity not guaranteed - "/wd4242", -- warning C4242: 'x' : conversion from 'xxx' to 'xxx', possible loss of data "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data + "/wd4245", -- warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch "/wd4250", -- warning C4250: 'xxx' : inherits 'xxx' via dominance - "/wd4255", -- warning C4255: 'xxx' : no function prototype given: converting '()' to '(void)' - "/wd4296", -- warning C4296: 'x' : expression is always false - "/wd4306", -- warning C4306: 'xxx': conversion from 'type1' to 'type2' of greater size // 64-bit only + "/wd4267", -- warning C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data "/wd4310", -- warning C4310: cast truncates constant value - "/wd4312", -- warning C4312: 'type cast' : conversion from 'xxx' to 'xxx' of greater size + "/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size "/wd4324", -- warning C4324: 'xxx' : structure was padded due to __declspec(align()) - "/wd4347", -- warning C4347: behavior change: 'xxx' is called instead of 'xxx' // obsolete VS2005 - VS2010 only - "/wd4435", -- warning C4435: 'xxx' : Object layout under /vd2 will change due to virtual base 'xxx' - "/wd4510", -- warning C4510: 'xxx' : default constructor could not be generated - "/wd4512", -- warning C4512: 'xxx' : assignment operator could not be generated - "/wd4514", -- warning C4514: 'xxx' : unreferenced inline function has been removed - "/wd4521", -- warning C4521: 'xxx' : multiple copy constructors specified - "/wd4571", -- warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable - "/wd4610", -- warning C4619: #pragma warning : there is no warning number 'xxx' - "/wd4611", -- warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught - "/wd4619", -- warning C4610: struct 'xxx' can never be instantiated - user defined constructor required - "/wd4625", -- warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted - "/wd4626", -- warning C4626: 'xxx' : assignment operator could not be generated because a base class assignment operator is inaccessible or deleted - "/wd4640", -- warning C4640: 'xxx' : construction of local static object is not thread-safe - "/wd4668", -- warning C4668: 'xxx' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' - "/wd4702", -- warning C4702: unreachable code - "/wd4706", -- warning C4706: assignment within conditional expression - "/wd4710", -- warning C4710: 'xxx' : function not inlined - "/wd4711", -- warning C4711: function 'xxx' selected for automatic inline expansion // optimized only - "/wd4805", -- warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation - "/wd4820", -- warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx' - "/wd4826", -- warning C4826: Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior. // 32-bit only - "/wd4365", -- warning C4365: 'action' : conversion from 'type_1' to 'type_2', signed/unsigned mismatch - "/wd4389", -- warning C4389: 'operator' : signed/unsigned mismatch - "/wd4245", -- warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch - "/wd4388", -- warning C4388: signed/unsigned mismatch - "/wd4267", -- warning C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data - "/wd4005", -- warning C4005: The macro identifier is defined twice. The compiler uses the second macro definition - "/wd4350", -- warning C4350: behavior change: 'member1' called instead of 'member2' - "/wd4996", -- warning C4996: 'function': was declared deprecated - "/wd4191", -- warning C4191: 'operator/operation' : unsafe conversion from 'type of expression' to 'type required' - "/wd4060", -- warning C4060: switch statement contains no 'case' or 'default' labels - "/wd4065", -- warning C4065: switch statement contains 'default' but no 'case' labels - "/wd4640", -- warning C4640: 'instance' : construction of local static object is not thread-safe - "/wd4290", -- warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow) - "/wd4355", -- warning C4355: 'this' : used in base member initializer list - "/wd4800", -- warning C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) - "/wd4371", -- warning C4371: layout of class may have changed from a previous version of the compiler due to better packing of member 'member' - "/wd4548", -- warning C4548: expression before comma has no effect; expected expression with side-effect - "/wd4334", -- warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) + "/wd4389", -- warning C4389: 'operator' : signed/unsigned mismatch "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration "/wd4457", -- warning C4457: declaration of 'xxx' hides function parameter "/wd4458", -- warning C4458: declaration of 'xxx' hides class member "/wd4459", -- warning C4459: declaration of 'xxx' hides global declaration - "/wd4838", -- warning C4838: conversion from 'xxx' to 'yyy' requires a narrowing conversion - "/wd4091", -- warning C4091: 'typedef ': ignored on left of '' when no variable is declared - "/wd4463", -- warning C4463: overflow; assigning 1 to bit-field that can only hold values from -1 to 0 - "/wd4297", -- warning C4297: 'xxx::~xxx': function assumed not to throw an exception but does - "/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size - "/wd4592", -- warning C4592: symbol will be dynamically initialized (implementation limitation) + "/wd4702", -- warning C4702: unreachable code + "/wd4706", -- warning C4706: assignment within conditional expression + "/wd4804", -- warning C4804: '>>': unsafe use of type 'bool' in operation + "/wd4805", -- warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation + "/wd4996", -- warning C4996: 'function': was declared deprecated } + if _OPTIONS["vs"]=="intel-15" then buildoptions { "/Qwd9", -- remark #9: nested comment is not allowed diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index db0e89ca862..bec2382971d 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -51,6 +51,7 @@ end "/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter "/wd4127", -- warning C4127: conditional expression is constant "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data + "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration } if _OPTIONS["vs"]=="intel-15" then buildoptions { @@ -60,10 +61,6 @@ if _OPTIONS["vs"]=="intel-15" then "/Qwd869", -- remark #869: parameter "xxx" was never referenced } end - configuration { "vs201*" } - buildoptions { - "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration - } configuration { } files { @@ -622,6 +619,7 @@ project "flac" "/wd4127", -- warning C4127: conditional expression is constant "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data "/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter + "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration "/wd4702", -- warning C4702: unreachable code } if _OPTIONS["vs"]=="intel-15" then @@ -639,11 +637,6 @@ end "-include stdint.h" } - configuration { "vs201*" } - buildoptions { - "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration - } - configuration { "vsllvm" } buildoptions { "-Wno-unused-function", @@ -727,17 +720,14 @@ project "7z" configuration { "vs*" } buildoptions { "/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter + "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration + "/wd4457", -- warning C4457: declaration of 'xxx' hides function parameter } if _OPTIONS["vs"]=="intel-15" then buildoptions { "/Qwd869", -- remark #869: parameter "xxx" was never referenced } end - configuration { "vs201*" } - buildoptions { - "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration - "/wd4457", -- warning C4457: declaration of 'xxx' hides function parameter - } configuration { "winstore*" } forcedincludes { MAME_DIR .. "src/osd/uwp/uwpcompat.h" @@ -1024,6 +1014,7 @@ project "portmidi" "/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter "/wd4127", -- warning C4127: conditional expression is constant "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data + "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration "/wd4706", -- warning C4706: assignment within conditional expression } if _OPTIONS["vs"]=="intel-15" then @@ -1035,11 +1026,6 @@ if _OPTIONS["vs"]=="intel-15" then } end - configuration { "vs201*" } - buildoptions { - "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration - } - configuration { "linux*" } defines { "PMALSA=1", @@ -1451,6 +1437,8 @@ project "portaudio" "/wd4389", -- warning C4389: 'operator' : signed/unsigned mismatch "/wd4189", -- warning C4189: 'xxx' : local variable is initialized but not referenced "/wd4127", -- warning C4127: conditional expression is constant + "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration + "/wd4312", -- warning C4312: 'type cast': conversion from 'UINT' to 'HWAVEIN' of greater size } if _OPTIONS["vs"]=="intel-15" then buildoptions { @@ -1460,10 +1448,6 @@ project "portaudio" "/Qwd1879", -- warning #1879: unimplemented pragma ignored } end - configuration { "vs2015*" } - buildoptions { - "/wd4456", -- warning C4456: declaration of 'xxx' hides previous local declaration - } configuration { "vsllvm" } buildoptions { -- cgit v1.2.3