diff --git a/CMakeLists.txt b/CMakeLists.txt index 55f3a8e346..003568727e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,9 +272,6 @@ endif(USE_DISTCC) if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - # Add additional warning flags to avoid signed/unsigned comparison - set( CMAKE_CXX_FLAGS "-Wsign-compare" ) - # Set 32-bit flag for GCC to prevent excess precision if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" ) diff --git a/CMakeModules/Warnings.cmake b/CMakeModules/Warnings.cmake index bd369571d6..ff4592cefb 100644 --- a/CMakeModules/Warnings.cmake +++ b/CMakeModules/Warnings.cmake @@ -115,4 +115,22 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) message( STATUS "Enabling warning -Wshadow" ) endif() + + # Add additional warning flags to avoid signed/unsigned comparison + CHECK_CXX_COMPILER_FLAG( "-Wsign-compare" COMPILER_SUPPORTS_WSIGN ) + + if( COMPILER_SUPPORTS_WSIGN ) + set( WARN_FLAGS_CXX "${WARN_FLAGS_CXX} -Wsign-compare" ) + message( STATUS "Enabling warning -Wsign-compare" ) + endif() + + # Warn about missing initializers in construction + CHECK_CXX_COMPILER_FLAG( "-Wmissing-field-initializers" COMPILER_SUPPORTS_WMISSING_INIT ) + + if( COMPILER_SUPPORTS_WMISSING_INIT ) + set( WARN_FLAGS_CXX "${WARN_FLAGS_CXX} -Wmissing-field-initializers" ) + message( STATUS "Enabling warning -Wmissing-field-initializers" ) + endif() + + endif() diff --git a/common/single_top.cpp b/common/single_top.cpp index 82e91d4fd7..3293d13c53 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -318,10 +318,10 @@ bool PGM_SINGLE_TOP::OnPgmInit() #endif static const wxCmdLineEntryDesc desc[] = { - { wxCMD_LINE_OPTION, "f", "frame", "Frame to load" }, + { wxCMD_LINE_OPTION, "f", "frame", "Frame to load", wxCMD_LINE_VAL_STRING, 0 }, { wxCMD_LINE_PARAM, nullptr, nullptr, "File to load", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_NONE } + { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 } }; wxCmdLineParser parser( App().argc, App().argv ); diff --git a/utils/idftools/idf2vrml.cpp b/utils/idftools/idf2vrml.cpp index 4eb34c6d1e..5f836f34bf 100644 --- a/utils/idftools/idf2vrml.cpp +++ b/utils/idftools/idf2vrml.cpp @@ -94,7 +94,7 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, "h", NULL, "display this message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, - { wxCMD_LINE_NONE } + { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 } }; diff --git a/utils/kicad2step/kicad2step.cpp b/utils/kicad2step/kicad2step.cpp index 98988329c1..b7f8361cb0 100644 --- a/utils/kicad2step/kicad2step.cpp +++ b/utils/kicad2step/kicad2step.cpp @@ -116,7 +116,7 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_SWITCH, "h", NULL, _( "display this message" ).mb_str(), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, - { wxCMD_LINE_NONE } + { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0 } };