Skip to content

Commit

Permalink
make: More microsoft warnings and lib updates
Browse files Browse the repository at this point in the history
Adding more microsoft warnings to match what was enabled for GCC and CLang.
Also pulling in lib updates with the same changes and opensea-common updates to ensure we properly detect explicit memset/bzero capabilities when they are available in a given compiler/environment.

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
  • Loading branch information
vonericsen committed May 31, 2024
1 parent 3cad1ea commit 0849601
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
36 changes: 31 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@ elif c.get_id().contains('msvc')
'/wd4668', # 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'. While like -Wundef, this creates too many warnings in system headers to use
'/wd4820', # 'bytes' bytes padding added after construct 'member_name'
'/wd4710', # 'function' : function not inlined
#'/wd4255', # 'function' : no function prototype given: converting '()' to '(void)' #NOTE: Only needed for /Wall, otherwise enabling can be good-TJE
'/wd5045', # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
'/wd4711', # function 'function' selected for inline expansion
'/wd4324', # 'struct_name' : structure was padded due to __declspec(align())
'/wd4221', # nonstandard extension used : 'identifier' : cannot be initialized using address of automatic variable
'/wd4204', # nonstandard extension used : non-constant aggregate initializer
'/wd4061', # enumerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
'/wd5105', # macro expansion producing 'defined' has undefined behavior
'/wd4746', # volatile access of '<expression>' is subject to /volatile:[iso|ms] setting; consider using __iso_volatile_load/store intrinsic functions.
#Turn on the following warnings to make the output more useful or like GCC/clang
Expand All @@ -111,10 +109,41 @@ elif c.get_id().contains('msvc')
'/w15031', # #pragma warning(pop): likely mismatch, popping warning state pushed in different file
'/w15032', # detected #pragma warning(push) with no corresponding #pragma warning(pop)
'/w15262', # implicit fall-through occurs here; are you missing a break statement? Use [[fallthrough]] when a break statement is intentionally omitted between cases
'/w14255', # 'function' : no function prototype given: converting '()' to '(void)' #NOTE: Only needed for /Wall, otherwise enabling can be good-TJE
'/w14242', # identifier conversion from type 1 to type 2, possible loss of data (matches -wconversion above)
'/w14254', # operator conversion from type 1 to type 2, possible loss of data (matches -wconversion above)
'/w14287', # operator: unsigned/negative constant mismatch (matches -wconversion above)
'/w14296', # operator: expression is always false
'/w14365', # action: conversion from type 1 to type 2, signed/unsigned mismatch (matches -wconversion above)
'/w14388', # implicit conversion warning during a comparison (matches -wconversion above)
'/w14545', # expression before comma evaluates to a function which is missing an argument list
'/w14546', # function call before comma missing argument list
'/w14547', # 'operator' : operator before comma has no effect; expected operator with side-effect
'/w14548', # expression before comma has no effect; expected expression with side-effect
'/w14549', # 'operator1': operator before comma has no effect; did you intend 'operator2'?
'/w14574', # 'identifier' is defined to be '0': did you mean to use '#if identifier'?
'/w14605', # '/Dmacro' specified on current command line, but was not specified when precompiled header was built
'/w14555', # expression has no effect; expected expression with side-effect
'/w14774', # 'string' : format string expected in argument number is not a string literal
'/w14777', # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2'
'/w14826', # Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior (more -wconversion)
'/w15219', # implicit conversion from 'type-1' to 'type-2', possible loss of data (-wconversion)
'/w15240', # 'attribute-name': attribute is ignored in this syntactic position
'/w15245', # 'function': unreferenced function with internal linkage has been removed
'/w14555', # expression has no effect; expected expression with side-effect
'/w15264', # 'variable-name': 'const' variable is not used
'/w24302', # 'conversion': truncation from 'type1' to 'type2'
'/w14311', # 'variable': pointer truncation from 'type' to 'type'
'/w14312', # 'operation': conversion from 'type1' to 'type2' of greater size
'/w14319', # 'operator': zero extending 'type1' to 'type2' of greater size
#Treat the following as errors
'/we4431', # missing type specifier - int assumed. Note: C no longer supports default-int
'/we4905', # wide string literal cast to 'LPSTR'
'/we4906', # string literal cast to 'LPWSTR'
'/we4837', # trigraph detected: '??character' replaced by 'character'
'/we4628', # digraphs not supported with -Ze. Character sequence 'digraph' not interpreted as alternate token for 'char'
'/we4289', # nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope
'/we4464', # relative include path contains '..'
'/std:c17', #NOTE: It would be better to specify for the project settings above for all compilers, but currently still supporting MSVC and GCC compilers that may not be C11 compatible.-TJE
'/GS', #security cookie for stack protection
'/sdl', #adds recommended security development lifecycle checks
Expand All @@ -129,9 +158,6 @@ elif c.get_id().contains('msvc')
'/NXCOMPAT', #data execution prevention
'/dynamicbase', #address space randomization
]
#TODO: check compiler version to handle warnings that were off by default in earlier versions
#ex: C4431 (level 4) missing type specifier - int assumed. Note: C no longer supports default-int
# This was off by default in compilers before VS2012.
elif c.get_id().contains('xlc')
#This section is for IBM's xlc compiler and warning options it may need.
#NOTE: xlcclang should be handled above
Expand Down
2 changes: 1 addition & 1 deletion subprojects/opensea-common
2 changes: 1 addition & 1 deletion subprojects/opensea-operations
Submodule opensea-operations updated 1 files
+32 −3 meson.build
2 changes: 1 addition & 1 deletion subprojects/opensea-transport

0 comments on commit 0849601

Please sign in to comment.