From 1fec0d31aacc0343d99df3d1f15c81d6142e89cf Mon Sep 17 00:00:00 2001 From: "J. Daniel Smith" Date: Fri, 10 Feb 2023 12:23:58 -0500 Subject: [PATCH] adjust compiler flags for clean CMake builds (#629) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * some projects get indirectrly * trying to build with VS2022 17.2 * scene doesn't use XML * move #pragma warning(disable) to import/xml/lite.h * slam-in "main" * fix compiler diagnostic about "possibly uninitialized result" * update "externals" to remove compiler warnings * cmake -j 8 seems to work * remove more compiler warnings * setAttribute*() overloads * getISMUri() utility routine * double -> float warnings * latest from coda-oss and NITRO * Squashed 'externals/coda-oss/' changes from 1582c6ac9..0657f3297 0657f3297 adjust compiler flags for clean CMake builds (#650) 81285872f build cleanly with all G++ warnings enabled (#649) b9ea37bbf xml::lite::Validator can be moved (#648) 9cfe9a4a8 Merge branch 'master' e989b0910 createElement() needs to be virtual (#646) 4bdaf10d9 Change xml lite function to virtual (#645) d17b57a54 Merge branch 'master' fa00a5430 move debug -g flags to be turned on only if debugging (#644) 6be8f0a2e move debug -g flags to be turned on only if debugging (#644) 44ab72854 routines for simple writing to HDF5 files (#643) aabc5818e remove more C++11 work-arounds (#642) b04ccca17 remove more C++11 work-arounds (#641) e460970a7 increase GCC warnings (#640) 91284249b provide ComplexView iterator support (#639) 453b7ec68 try to get std::make_unique working with old Intel compiler (#638) 5736cfd4d is_trivially_copyable for old Intel compiler (#637) 7c2aea38f use H5 SDK naming conventions (#636) fc3008b8d use 'modern' C pre-processor b44709a95 added ComplexSpansView utility (#635) 986307c9c Merge branch 'master' e1b0fa349 commit (but not build) HDF5 source code (#634) 3fd5ddae5 Merge branch 'main' into develop/remove-cpp11-workarounds 37d7ec76e restore C++14 workarounds for older compilers (#632) 244dfdb3d Merge branch 'develop/main' into develop/remove-cpp11-workarounds 714ca4ed7 restore C++14 workarounds for older compilers 640f2247c Delete hdf5-hdf5-1_13_2.tar.gz eb365cbfb Merge branch 'master' into develop/remove-cpp11-workarounds 57b938eeb don't need __INTEL_COMPILER work-around with C++14 65779f3b1 build C code with -std=gnu99 94dc9280f C++14 work-arounds for an old version of the Intel compiler 3744d05e2 slam-in "main" 82b2fd63b restore some C++14 work-arounds for old compilers that only have partial C++14 support 94f6950a2 Merge branch 'main' into develop/remove-cpp11-workarounds 1ac97fe48 add HDF5 source code (not built) (#612) 8ab982820 Squashed commit of the following: 31781a14a remove C++17 work-arounds c15f6930c Revert " is in C++17" 0fe38c16f restore recent buld.py changes 0c75411ee is in C++17 bbbcd562a remove C++11 work-arounds c1e15e9d9 Merge branch 'main' into main-cpp17 bea818fb0 must use C++17 in this branch 91653a096 another place where C++17 is set 7d555f2be back to C++17 b1969d996 merge main 0792c77bf Merge branch 'main' into develop/remove-cpp11-workarounds e49f273c1 Merge branch 'main' into develop/remove-cpp11-workarounds 240b61044 allow sys::Mutex references, instead of pointers, to be passed to sys::ConditionVar 9500d6f4b Merge branch 'main' into develop/remove-cpp11-workarounds f1529942f std::make_unique instead of new be9b6a71c Squashed commit of the following: 62a2ec4e1 Revert "remove our GSL work-around for C++11" 1db082c21 Revert "try the current "main" of GSL" 44b70edde try the current "main" of GSL 4edbf6bad Revert ""There is no warning 4814"" bcd7458be "There is no warning 4814" c185bf3f1 starting working on MutexCpp11 313bdd1d9 AtomicCounter* files have been removed c1c448051 remove our GSL work-around for C++11 37ae1193e remove our mem::SharedPtr, it's now always std::shared_ptr 71f3c1299 remove no-longer-used NSPR code 8e77cb210 removed no-longer-used Irix and Solaris files fabef6966 use std::atomic for all AtomicCounter implementations ace5b6d5a TEST_FAIL -> TEST_FAIL_MSG 30076c1d1 turns out there was already a TEST_FAIL macro d73ee16fb need "::" to find global test ba01c48df remove C++11 workarounds for C++14 features cbd4a31ae Squashed commit of the following: b21c203b8 Squashed commit of the following: 5b542c60f Squashed commit of the following: cb0cf94ff ByteStream.cpp is now warning-free f5daa37fc cast to DWORD; "const" correctness bfaf644ff #pragma-away compiler warnings from standard headers 72d202dbe Merge branch 'master' into develop/reduce-compiler-warnings b076580cd trying to fix GCC compiler warning 1687dc7fc Merge branch 'master' into develop/reduce-compiler-warnings 2c5db86db Merge branch 'master' into develop/reduce-compiler-warnings 6f76c2e3e Update CMakeLists.txt c3ca4a538 do in-line initialization 8e6733618 remove G++ compiler warning a0eff51cf Merge branch 'master' into develop/reduce-compiler-warnings af19d88a6 Merge branch 'master' into develop/reduce-compiler-warnings ba31cbaa9 use "void*" to avoid reinterpret_cast<> 08da1f8a1 Merge branch 'master' into develop/reduce-compiler-warnings d1d453a2e Merge branch 'master' into develop/reduce-compiler-warnings f5074a996 CODA_OSS_NDEBUG is extra gunk and not used; omit for now. 22de48858 don't even bother compiling our own versions of localtime_s() and gmtime_s() if we're not going to use them (compiler warning about "unused static funtion.") 0c92eba58 tweak NDEBUG/CODA_OSS_NDEBUG; update comments 544604775 Don't need to expose our own versions of localtime_s() and gmtime_s() a050796c1 Merge branch 'develop/reduce-compiler-warnings' of github.com:mdaus/coda-oss into develop/reduce-compiler-warnings fed604617 older compilers want std::string() as argument to std::logic_error() cf2c502a6 do more debug & release builds on GitHub d4aa99256 build some debug targets on Gitlab 368245258 tweak CODA_OSS_DEBUG again for G++ 24ba64f71 tweak how CODA_OSS_DEBUG is set 9680e8f0e add check for _GLIBCXX_DEBUG 943218f83 Merge branch 'master' into develop/reduce-compiler-warnings 01c68e705 %#@*@%)*%@ fix RowCol::cast() again! :-( b8472b457 oops ... gsl::narrow<> should be gsl::narrow_cast<> so that int/double conversion doesn't throw 109255ca8 "final" breaks SWIG; wrap RowCol use of gsl::narrow e51e4c2ad no need to create local just to return e546f2510 Merge branch 'master' into develop/reduce-compiler-warnings d1391f989 use template for to_std_string() overloading 566942680 fix std::char8_t when building with C++20 cf604b1ab fix C++17 build errors 48a0fbedb get rid of coda_oss namespace; use CODA_OSS_cpp17 instead 9706a4336 remove code-analysis diagnostics 50592e4f8 G++ complains about an unneeded call to std::move() 9c7643c3f Merge branch 'master' into develop/reduce-compiler-warnings ecfe1f8a7 more "noexcept" b7ac50fb9 Merge branch 'master' into develop/reduce-compiler-warnings eaecf46ed tweak CODA_OSS_cplusplus from "main" 5773b1ec1 trying to get C++17 WAF build working on Windows a048a00a1 unique names for waf & CMake 7a5a0d5b2 do a better job of setting CODA_OSS_DEBUG 4355aae92 Merge branch 'master' into develop/reduce-compiler-warnings 1fd8cede2 cleanup for VS 2019 16.10 4dffa1394 explicitly =delete copy/assignment df8f8920a Merge branch 'master' into develop/reduce-compiler-warnings 42b4e99b6 remove code-analysis diagnostics 70ce322c9 reduce compiler warnings/code-analysis diagnostics when building six 20eac2f49 Merge branch 'master' into develop/reduce-compiler-warnings ff3ded56d get rid of more compiler warnings/code-analysis diagnostics 669dd51ff Merge branch 'master' into develop/reduce-compiler-warnings 623b65ab9 Merge branch 'master' into develop/reduce-compiler-warnings 11c75df53 fix release build errors 66f048b92 turn on more compiler warnings where possible eb615e315 consolidate calls to mem::make::unique a6f5eb690 reduce use of explicit new 84d5e1b01 use mem::make::unique instead of explicit new 019d726ea = default for default constructors 86ab5d8f3 use std::unique_ptr and "const noexcept" b071972d7 another batch of =default for default constructors 98276da94 more =default for default .ctor()s ceb7bc596 do default constructors with =default 7bed51750 more code-analysis cleanup f9c04b117 "noexcept" code-analysis warnings 6586ae390 need gsl::make_span from gsl/span_ext 722089774 remove gsl/mem dependency cycle d741a0761 use gsl::narrow<> instead of static_cast 99eb4b36e get rid of signed/unsigned mismatch compiler warning 814450522 remove more code-analysis diagnostics c8441b309 Merge branch 'master' into develop/reduce-compiler-warnings e6d70a9ff last of "const" from code-analysis b8445814a mark a few more things as "const" per code-analysis d18544ec7 don't need to create temporary std::strings ee7faa979 still more code-analysis cleanup 5cd6f864d cleanup more code-analysis diagnostics 492fb0a86 one more compiler warning about implicitly deleted copy/assignment b8f782c88 remove compiler warnings about implicitly deleted copy/assignment/move 14d1d1cb8 #pragma-away warnings from GSL 86c40ea6c assert() to prevent some code-analysis diagnostics 7204517a9 make copy/assignment explicit 3ce824079 reduce code-analysis diagnostics 01e367a56 Merge branch 'master' into develop/reduce-compiler-warnings 03f3ddde9 proper printf format 877d7dc93 Merge branch 'master' into develop/reduce-compiler-warnings 5a4a3d575 code-analysis doesn't like C-style casts a3fdae416 code-analysis doesn't like NULL 6309baedc Merge branch 'master' into develop/reduce-compiler-warnings d1194a2fe Merge branch 'master' into develop/reduce-compiler-warnings 535b4757d Merge branch 'develop/reduce-compiler-warnings' of github.com:mdaus/coda-oss into develop/reduce-compiler-warnings a60b95d60 "constexpr" can be hard to get right with older C++11 compilers; don't even try c07b5303e Merge branch 'master' into develop/reduce-compiler-warnings 04306bbee need at least VS2017 to use the real GSL 796ad820b Merge branch 'master' into develop/reduce-compiler-warnings 16c240cd6 Merge branch 'master' into develop/reduce-compiler-warnings e07e89f0c turn on "warnings as errors" for CMAKE builds 5c019f891 complex "constexpr" functions not available with our version of g++ 4ab074a58 fix a few more compiler warnings ... nearing the end! :-) dea7ea41b And still more compiler warnings ... almost done 🤞🏻 fbe3bbb20 remove assorted compiler warnings e60b7fd3c Merge branch 'master' into develop/reduce-compiler-warnings e9df212c6 Arguments should be "const&" to prevent C4866 94e75cbed Merge branch 'master' into develop/reduce-compiler-warnings d3130414a Merge branch 'master' into develop/reduce-compiler-warnings 9a5e71f31 Merge branch 'master' into develop/reduce-compiler-warnings bd27c0232 Merge branch 'master' into develop/reduce-compiler-warnings c053362d2 remove still more compiler warnings 9f133b85a remove some more compiler warnings 0883c729c Merge branch 'master' into develop/reduce-compiler-warnings f4b766880 avoid comparision between signed/unsigned to prevent compiler warning 1e6564a6e eliminate more compiler warnings 85a7b8ad0 remove a few compiler warnings 09c82049f Merge branch 'master' into develop/reduce-compiler-warnings 31f1662fa Merge branch 'master' into develop/reduce-compiler-warnings a313562a3 Merge branch 'feature/fix-compiler-warnings' into develop/reduce-compiler-warnings 8547cdd24 eliminiate GCC warnings from Filesystem.h b5044b2a2 fix several compiler warnings/code-analysis diagnostics 9d2f90b8c GetEnvironmentVariable() and getenv() aren't quite the same 6faa3666f remove more compiler warnings git-subtree-dir: externals/coda-oss git-subtree-split: 0657f3297a806dba9312355b3231bac38f50b5d4 * Squashed 'externals/nitro/' changes from e1a64da1f..e2f038e45 e2f038e45 adjust compiler flags for clean CMake builds (#533) b871d2b9c latest from coda-oss (#532) e8ff6b444 apps: fix display of TREs from file extended header section (#529) 463c9e418 latest from coda-oss (#531) 24ff32863 -j 6 seems to work for SIX, how about NITRO? 713ee8538 -j 6 seems to work for SIX, how about NITRO? 4ccdf5b37 latest from coda-oss (#527) c71acc492 latest from coda-oss (#526) 08cbb96f9 build with older C++14 compilers (#524) git-subtree-dir: externals/nitro git-subtree-split: e2f038e4572376c73fd63e5b35a6b58f6a75fba7 * latest from coda-oss and NITRO * build SIX cleanly with CMake using GCC * build SIX cleanly with CMake using GCC * get closer to a clean build with MSVC * clean CMake build with MSVC --- CMakeLists.txt | 18 +++------ externals/coda-oss/CMakeLists.txt | 14 +++---- externals/coda-oss/modules/c++/CMakeLists.txt | 16 +++++--- .../config/disable_compiler_warnings.h | 8 +++- .../modules/c++/mem/include/mem/ComplexView.h | 1 + .../coda-oss/modules/drivers/CMakeLists.txt | 12 ++++-- .../modules/drivers/hdf5/CMakeLists.txt | 1 + .../modules/drivers/zlib/CMakeLists.txt | 4 -- .../coda-oss/modules/python/CMakeLists.txt | 12 ++++++ .../.github/workflows/frequent_check.yml | 2 +- externals/nitro/CMakeLists.txt | 38 ++++++++----------- externals/nitro/modules/c++/CMakeLists.txt | 16 ++++++++ .../nitro/modules/c++/nitf/CMakeLists.txt | 3 ++ .../c++/nitf/include/nitf/ImageSubheader.hpp | 2 +- .../modules/c++/nitf/include/nitf/Utils.hpp | 2 +- .../c++/nitf/unittests/test_image_writer.cpp | 4 +- .../nitf/unittests/test_j2k_compress_tile.cpp | 6 +++ .../c++/nitf/unittests/test_j2k_loading++.cpp | 14 +++++-- .../c++/nitf/unittests/test_j2k_read_tile.cpp | 1 + .../c++/nitf/unittests/test_tre_create++.cpp | 1 + .../c++/nitf/unittests/test_tre_mods++.cpp | 4 ++ externals/nitro/modules/c/CMakeLists.txt | 21 ++++++++++ .../modules/c/cgm/source/MetafileReader.c | 1 + .../nitro/modules/c/j2k/shared/J2KCompress.c | 2 + .../modules/c/j2k/shared/J2KDecompress.c | 2 + .../modules/c/jpeg/source/LibjpegDecompress.c | 9 +++-- .../modules/c/nitf/unittests/test_moveTREs.c | 6 +-- .../c/nrt/include/nrt/nrt_config.h.cmake.in | 2 + externals/nitro/modules/c/nrt/source/Utils.c | 4 +- externals/nitro/modules/python/CMakeLists.txt | 11 ++++++ six/modules/CMakeLists.txt | 2 + six/modules/c++/CMakeLists.txt | 27 ++++++++++++- .../c++/cphd/tests/test_metadata_round.cpp | 2 +- .../c++/samples/test_create_sidd_from_mem.cpp | 6 +-- .../c++/scene/include/scene/EllipsoidModel.h | 5 ++- six/modules/c++/scene/include/scene/Types.h | 18 ++++----- .../c++/scene/source/EllipsoidModel.cpp | 16 ++++++-- six/modules/c++/six.sicd/source/CropUtils.cpp | 2 +- .../six.sicd/tests/test_read_sicd_mesh.cpp | 4 +- .../six.sidd/unittests/test_valid_sixsidd.cpp | 23 ++++------- .../test_polarization_type_conversions.cpp | 2 + six/modules/python/CMakeLists.txt | 12 ++++++ 42 files changed, 243 insertions(+), 113 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ece1388a9..825ea882ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,21 +7,13 @@ set(CXX_STANDARD_REQUIRED true) if (${CMAKE_PROJECT_NAME} STREQUAL six-library) # we are the top-level project and are responsible for configuration - # set up warnings + # Always turn on "warnings as errors" to avoid lots of (meaningless?) build output; + # we'll dial-back warnings as necessary. if (MSVC) - # set warning level to /W3 - string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - add_compile_options(/W3 /wd4290 /wd4512) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) - add_compile_options(/std:c++14) + add_compile_options(/WX) # warnings as errors + add_compile_options(/MP) # multi-processor build elseif (UNIX) - add_compile_options( - -Wno-deprecated - -Wno-unused-value - -Wno-unused-but-set-variable - ) - add_compile_options(-std=c++14) + add_compile_options(-Werror) # warnings as errors endif() if (EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake") diff --git a/externals/coda-oss/CMakeLists.txt b/externals/coda-oss/CMakeLists.txt index 1581430484..12877ccc55 100644 --- a/externals/coda-oss/CMakeLists.txt +++ b/externals/coda-oss/CMakeLists.txt @@ -3,13 +3,11 @@ # Author: Scott A. Colcord cmake_minimum_required(VERSION 3.14) +project(coda-oss) -set(TARGET_LANGUAGE c++) set(CMAKE_CXX_STANDARD 14) set(CXX_STANDARD_REQUIRED true) -project(coda-oss) - if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") # build and package with conan include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") @@ -21,14 +19,12 @@ endif() if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss) # this is the top level project - # set up warnings + # Always turn on "warnings as errors" to avoid lots of (meaningless?) build output; + # we'll dial-back warnings as necessary. if (MSVC) - # set warning level to /W3 - string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - add_compile_options(/std:c++14) + add_compile_options(/WX) # warnings as errors elseif (UNIX) - add_compile_options(-std=c++14) + add_compile_options(-Werror) # warnings as errors endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") diff --git a/externals/coda-oss/modules/c++/CMakeLists.txt b/externals/coda-oss/modules/c++/CMakeLists.txt index 4abc4b7f99..ad06a4c387 100644 --- a/externals/coda-oss/modules/c++/CMakeLists.txt +++ b/externals/coda-oss/modules/c++/CMakeLists.txt @@ -1,12 +1,18 @@ set(TARGET_LANGUAGE c++) -set(CMAKE_CXX_STANDARD 14) -set(CXX_STANDARD_REQUIRED true) -# turn on warnings as errors +# turn on maximum warnings if (MSVC) - add_compile_options(/WX /W4) # /Wall + add_compile_options(/std:c++14) + + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /Wn results in a compiler warning. + #add_compile_options(/W4) # /Wall + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall + elseif (UNIX) - add_compile_options(-Werror -Wall -Wpedantic -Wextra) + add_compile_options(-std=c++14) + + add_compile_options(-Wall -pedantic -Wextra) endif() # add an interface library for unittests diff --git a/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h b/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h index a87d281089..a3b1a5125e 100644 --- a/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h +++ b/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h @@ -25,7 +25,7 @@ #include "compiler_extensions.h" -#if _MSC_VER +#if defined(_MSC_VER) // We don't care about any padding added to structs #pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' @@ -38,6 +38,12 @@ // ??? #pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified + +#elif defined(__GNUC__) || defined(__clang__) + +// don't care about compatibility between different -std=c++nn values +CODA_OSS_disable_warning(-Wnoexcept-type) + #endif // _MSC_VER #endif // CODA_OSS_config_disable_compiler_warnings_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h b/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h index f43ae8c5ae..6b8a60c0dc 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h @@ -35,6 +35,7 @@ #include #include "coda_oss/span.h" +#include "config/disable_compiler_warnings.h" namespace mem { diff --git a/externals/coda-oss/modules/drivers/CMakeLists.txt b/externals/coda-oss/modules/drivers/CMakeLists.txt index cfe5ef7b07..2d580634e3 100644 --- a/externals/coda-oss/modules/drivers/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/CMakeLists.txt @@ -1,8 +1,14 @@ +# Turn off all warnings; this is code we don't control. if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) - add_compile_options(/W3) - add_compile_options(/wd4267) # '...': conversion from '...' to '...', possible loss of data - add_compile_options(/wd4244) # '...': conversion from '...' to '...', possible loss of data + + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /Wn results in a compiler warning. + #add_compile_options(/W0) + string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +elseif (UNIX) + add_compile_options(-w) # "Inhibit all warning messages" endif() #add_subdirectory("curl") # this is handled in coda_find_system_dependencies diff --git a/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt b/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt index 65db23cb38..dd8c01d3f8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt @@ -1,4 +1,5 @@ set(MODULE_NAME hdf5) +set(TARGET_LANGUAGE c++) if(CODA_ENABLE_HDF5) # set up warnings diff --git a/externals/coda-oss/modules/drivers/zlib/CMakeLists.txt b/externals/coda-oss/modules/drivers/zlib/CMakeLists.txt index 7842daa03b..77ec31fa98 100644 --- a/externals/coda-oss/modules/drivers/zlib/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/zlib/CMakeLists.txt @@ -80,10 +80,6 @@ elseif(ENABLE_ZIP) ARCHIVE "zlib-1.2.13.tar" HASH "SHA256=A47CDCD8863424356B893B259CB57081EFDCC7FA3C2EB56CA1E881324958A2A9") - if (MSVC) - add_compile_options(/wd4996) # '...': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: .... See online help for details. - endif() - set(SOURCE_DIR "${${CMAKE_PROJECT_NAME}_${TARGET_NAME}_SOURCE_DIR}") # remove crypt.h due to name clash with glibc file(REMOVE "${SOURCE_DIR}/contrib/minizip/crypt.h") diff --git a/externals/coda-oss/modules/python/CMakeLists.txt b/externals/coda-oss/modules/python/CMakeLists.txt index cf7e1ad700..20c1e0873a 100644 --- a/externals/coda-oss/modules/python/CMakeLists.txt +++ b/externals/coda-oss/modules/python/CMakeLists.txt @@ -1,3 +1,15 @@ +set(TARGET_LANGUAGE c++) + +# Turn off all warnings; this is code we don't control. +if (MSVC) + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /Wn results in a compiler warning. + #add_compile_options(/W0) + string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +elseif (UNIX) + add_compile_options(-w) # "Inhibit all warning messages" +endif() + add_subdirectory("config") add_subdirectory("except") add_subdirectory("sys") diff --git a/externals/nitro/.github/workflows/frequent_check.yml b/externals/nitro/.github/workflows/frequent_check.yml index 91c463cee6..28857d3e73 100644 --- a/externals/nitro/.github/workflows/frequent_check.yml +++ b/externals/nitro/.github/workflows/frequent_check.yml @@ -22,7 +22,7 @@ jobs: - name: make run: | cd build - cmake --build . --config Release -j 2 + cmake --build . --config Release -j cmake --build . --config Release --target install - name: test run: | diff --git a/externals/nitro/CMakeLists.txt b/externals/nitro/CMakeLists.txt index bb5b4e553b..62f249850c 100644 --- a/externals/nitro/CMakeLists.txt +++ b/externals/nitro/CMakeLists.txt @@ -7,31 +7,23 @@ set(CXX_STANDARD_REQUIRED true) if (${CMAKE_PROJECT_NAME} STREQUAL nitro) # we are the top-level project and are responsible for configuration - # set up warnings + # Always turn on "warnings as errors" to avoid lots of (meaningless?) build output; + # we'll dial-back warnings as necessary. if (MSVC) - # set warning level to /W4 - string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - add_compile_options(/W4) - add_compile_options(/wd4100) # '...': unreferenced formal parameter - add_compile_options(/wd4127) # conditional expression is constant - if (ENABLE_ASAN) - # https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160 - add_compile_options(/fsanitize=address) - endif() - add_compile_options(/std:c++14) + add_compile_options(/WX) # warnings as errors + + if (ENABLE_ASAN) + # https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160 + add_compile_options(/fsanitize=address) + endif() + elseif (UNIX) - add_compile_options( - -Wall - -Wno-deprecated - -Wno-unused-value - -Wno-unused-but-set-variable - ) - if (ENABLE_ASAN) - # https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html - add_compile_options(-fsanitize=address) - endif() - add_compile_options(-std=c++14) + add_compile_options(-Werror) # warnings as errors + + if (ENABLE_ASAN) + # https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html + add_compile_options(-fsanitize=address) + endif() endif() if (EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake") diff --git a/externals/nitro/modules/c++/CMakeLists.txt b/externals/nitro/modules/c++/CMakeLists.txt index 51289138ee..4cdefcec61 100644 --- a/externals/nitro/modules/c++/CMakeLists.txt +++ b/externals/nitro/modules/c++/CMakeLists.txt @@ -1,3 +1,19 @@ set(TARGET_LANGUAGE c++) +# turn on warnings as errors +if (MSVC) + add_compile_options(/std:c++14) + + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /W4 results in a compiler warning. + #add_compile_options(/W4) # /Wall + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall + +elseif (UNIX) + add_compile_options(-std=c++14) + + #add_compile_options(-Wall -pedantic -Wextra) + add_compile_options(-Wall -Wextra) +endif() + add_subdirectory(nitf) diff --git a/externals/nitro/modules/c++/nitf/CMakeLists.txt b/externals/nitro/modules/c++/nitf/CMakeLists.txt index d35580f711..789d193c04 100644 --- a/externals/nitro/modules/c++/nitf/CMakeLists.txt +++ b/externals/nitro/modules/c++/nitf/CMakeLists.txt @@ -2,6 +2,9 @@ set(MODULE_NAME nitf) set(MODULE_DEPS nitf-c j2k-c except-c++ sio.lite-c++ io-c++ mt-c++ sys-c++ str-c++ gsl-c++ std-c++) if (MSVC) list(APPEND MODULE_DEPS wsock32 ws2_32) + + add_compile_options(/wd4996) # '...': This function or variable may be unsafe. + add_compile_options(/wd4459) # declaration of '...' hides global declaration endif() coda_add_module( diff --git a/externals/nitro/modules/c++/nitf/include/nitf/ImageSubheader.hpp b/externals/nitro/modules/c++/nitf/include/nitf/ImageSubheader.hpp index cc67b3fe41..f242da0f32 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/ImageSubheader.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/ImageSubheader.hpp @@ -99,7 +99,7 @@ namespace nitf M3, /*! \def NITF_IMAGE_IO_COMPRESSION_M3 - JPEG compression, blocking */ M4, /*! \def NITF_IMAGE_IO_COMPRESSION_M4 - Vector quantization compression, blocking */ M5, /*! \def NITF_IMAGE_IO_COMPRESSION_M5 - Lossless JPEG compression, blocking */ - M8); /*! \def NITF_IMAGE_IO_COMPRESSION_M8 - JPEG 2000 */ + M8) /*! \def NITF_IMAGE_IO_COMPRESSION_M8 - JPEG 2000 */ /*! * \class ImageSubheader diff --git a/externals/nitro/modules/c++/nitf/include/nitf/Utils.hpp b/externals/nitro/modules/c++/nitf/include/nitf/Utils.hpp index 6c67bb0f36..c5d1d7415e 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/Utils.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/Utils.hpp @@ -50,7 +50,7 @@ namespace Utils const char* file, int line, const char* func, int level); extern NITRO_NITFCPP_API void error_init(nrt_Error* error, const std::exception&, const char* file, int line, const char* func, int level); -}; +} } diff --git a/externals/nitro/modules/c++/nitf/unittests/test_image_writer.cpp b/externals/nitro/modules/c++/nitf/unittests/test_image_writer.cpp index ec3a857398..37645649da 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_image_writer.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_image_writer.cpp @@ -80,6 +80,8 @@ TEST_CASE(constructValidImageWriter) subheader.setPixelInformation(nitf::PixelValueType::Integer, 8, 8, "R", nitf::ImageRepresentation::MONO, "VIS", bands); subheader.setBlocking(100, 200, 10, 10, nitf::BlockingMode::Pixel); nitf::ImageWriter writer(subheader); + + TEST_ASSERT_TRUE(true); // need to reference hidden "testName" parameter } TEST_CASE(changeFileHeader) @@ -105,7 +107,7 @@ TEST_CASE(changeFileHeader) } TEST_MAIN( - (void)argc; + (void)argc;(void)argv; TEST_CHECK(imageWriterThrowsOnFailedConstruction); TEST_CHECK(constructValidImageWriter); diff --git a/externals/nitro/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp b/externals/nitro/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp index 1a7f88af29..fe9736266f 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp @@ -185,6 +185,12 @@ TEST_CASE(j2k_compress_tile) const size_t numThreads = sys::OS().getNumCPUs() - 1; + { + // be sure equals() is used to avoid compiler warnings + static const std::vector lhs, rhs; + TEST_ASSERT_TRUE(equals(lhs, rhs)); + } + Image source; generateTestImage(source); diff --git a/externals/nitro/modules/c++/nitf/unittests/test_j2k_loading++.cpp b/externals/nitro/modules/c++/nitf/unittests/test_j2k_loading++.cpp index 44c9d637d0..61230eaad1 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_j2k_loading++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_j2k_loading++.cpp @@ -109,6 +109,8 @@ TEST_CASE(test_j2k_loading) //test_image_loading_(input_file, false /*optz*/); //input_file = findInputFile("xxxx_MSI.nitf").string(); //test_image_loading_(input_file, false /*optz*/); + + TEST_ASSERT_TRUE(true); // be sure hidden "testName" parameter is used } static void test_j2k_nitf_(const std::string& fname) @@ -281,15 +283,17 @@ TEST_CASE(test_j2k_nitf_read_region) // This is a JP2 file, not J2K; see OpenJPEG_setup_() const auto input_file = findInputFile("j2k_compressed_file1_jp2.ntf"); test_j2k_nitf_read_region_(input_file); + + TEST_ASSERT_TRUE(true); // be sure hidden "testName" parameter is used } static std::vector readImage(nitf::ImageReader& imageReader, const nitf::ImageSubheader& imageSubheader) { - const auto numBlocks = imageSubheader.numBlocksPerRow() * imageSubheader.numBlocksPerCol(); - TEST_ASSERT_GREATER(numBlocks, static_cast(0)); + const int64_t numBlocks = imageSubheader.numBlocksPerRow() * imageSubheader.numBlocksPerCol(); + TEST_ASSERT_GREATER(numBlocks, 0); - const auto imageLength = imageSubheader.getNumBytesOfImageData(); - TEST_ASSERT_GREATER(imageLength, static_cast(0)); + const int64_t imageLength = imageSubheader.getNumBytesOfImageData(); + TEST_ASSERT_GREATER(imageLength, 0); // This assumes vertical blocking. // Interleaving would be required for horizontal blocks @@ -326,6 +330,8 @@ TEST_CASE(test_j2k_decompress_nitf_to_sio) const auto inputPathname = findInputFile("j2k_compressed_file1_jp2.ntf"); // This is a JP2 file, not J2K; see OpenJPEG_setup_() test_decompress_nitf_to_sio_(inputPathname, "test_decompress_nitf.sio"); + + TEST_ASSERT_TRUE(true); // be sure hidden "testName" parameter is used } TEST_CASE(test_j2k_compress_raw_image) diff --git a/externals/nitro/modules/c++/nitf/unittests/test_j2k_read_tile.cpp b/externals/nitro/modules/c++/nitf/unittests/test_j2k_read_tile.cpp index 6702c85a93..f08b268dd2 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_j2k_read_tile.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_j2k_read_tile.cpp @@ -27,6 +27,7 @@ TEST_CASE(j2k_read_tile) { /* placeholder */ + TEST_ASSERT_TRUE(true); } TEST_MAIN( diff --git a/externals/nitro/modules/c++/nitf/unittests/test_tre_create++.cpp b/externals/nitro/modules/c++/nitf/unittests/test_tre_create++.cpp index 9ffe050005..9883132a0b 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_tre_create++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_tre_create++.cpp @@ -43,6 +43,7 @@ TEST_CASE(test_tre_clone_329) } TEST_MAIN( + (void)argv; (void)argc; TEST_CHECK(test_tre_create_329); TEST_CHECK(test_tre_clone_329); ) diff --git a/externals/nitro/modules/c++/nitf/unittests/test_tre_mods++.cpp b/externals/nitro/modules/c++/nitf/unittests/test_tre_mods++.cpp index 1061a0a8e1..02e5a20858 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -257,6 +257,8 @@ TEST_CASE(use_ENGRDA) engrda.setField("ENGDATC[0]", 1); // count engrda.updateFields(); engrda.setField("ENGDATA[0]", "ABC"); + + TEST_ASSERT_TRUE(true); // need to reference hidden "testName" parameter } TEST_CASE(use_ENGRDA_typed_fields) @@ -416,6 +418,8 @@ TEST_CASE(overflowingNumericFields) } TEST_MAIN( + (void)argv; (void)argc; + TEST_CHECK(setFields); TEST_CHECK(setBinaryFields); TEST_CHECK(cloneTRE); diff --git a/externals/nitro/modules/c/CMakeLists.txt b/externals/nitro/modules/c/CMakeLists.txt index 15dc3dbbe7..6e6b185dcf 100644 --- a/externals/nitro/modules/c/CMakeLists.txt +++ b/externals/nitro/modules/c/CMakeLists.txt @@ -1,6 +1,27 @@ set(NITRO_VERSION "2.9") set(TARGET_LANGUAGE c) +# turn on warnings as errors +if (MSVC) + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /W4 results in a compiler warning. + #add_compile_options(/W4) # /Wall + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") # /Wall + + add_compile_options(/wd4996) # '...': This function or variable may be unsafe. +elseif (UNIX) + #add_compile_options(-Wall -pedantic -Wextra) + add_compile_options(-Wall -Wextra) + + add_compile_options(-Wno-implicit-fallthrough) + add_compile_options(-Wno-unused-function) + add_compile_options(-Wno-sign-compare -Wno-pointer-sign) + add_compile_options(-Wno-missing-field-initializers -Wno-maybe-uninitialized) + add_compile_options(-Wno-unused-parameter) + add_compile_options(-Wno-cast-function-type) + add_compile_options(-Wno-misleading-indentation) +endif() + add_subdirectory(nrt) add_subdirectory(nitf) add_subdirectory(cgm) diff --git a/externals/nitro/modules/c/cgm/source/MetafileReader.c b/externals/nitro/modules/c/cgm/source/MetafileReader.c index be23c26982..cba81f86b9 100644 --- a/externals/nitro/modules/c/cgm/source/MetafileReader.c +++ b/externals/nitro/modules/c/cgm/source/MetafileReader.c @@ -412,6 +412,7 @@ NITF_BOOL metafileList(cgm_Metafile* mf, cgm_ParseContext* pc, int classType, (void)classType; (void)shortCode; (void)error; + (void)len; DBG_TRACE(); assert(len == 6); diff --git a/externals/nitro/modules/c/j2k/shared/J2KCompress.c b/externals/nitro/modules/c/j2k/shared/J2KCompress.c index 5bb32ddb3d..5eb24805e4 100644 --- a/externals/nitro/modules/c/j2k/shared/J2KCompress.c +++ b/externals/nitro/modules/c/j2k/shared/J2KCompress.c @@ -23,7 +23,9 @@ #ifdef HAVE_J2K_H #if _MSC_VER +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif #pragma warning(push) #pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' #include diff --git a/externals/nitro/modules/c/j2k/shared/J2KDecompress.c b/externals/nitro/modules/c/j2k/shared/J2KDecompress.c index b597fe9883..12daa20206 100644 --- a/externals/nitro/modules/c/j2k/shared/J2KDecompress.c +++ b/externals/nitro/modules/c/j2k/shared/J2KDecompress.c @@ -23,7 +23,9 @@ #ifdef HAVE_J2K_H #if _MSC_VER +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif #pragma warning(push) #pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' #include diff --git a/externals/nitro/modules/c/jpeg/source/LibjpegDecompress.c b/externals/nitro/modules/c/jpeg/source/LibjpegDecompress.c index 934a9176d4..eb26bb6c35 100644 --- a/externals/nitro/modules/c/jpeg/source/LibjpegDecompress.c +++ b/externals/nitro/modules/c/jpeg/source/LibjpegDecompress.c @@ -28,6 +28,7 @@ #include #include #if defined(WIN32) || defined(_WIN32) + #undef BIGENDIAN #include #else #include @@ -826,7 +827,7 @@ NITFPRIV(NITF_BOOL) scanOffsets(nitf_IOInterface* io, /* Book keeping block */ const nitf_Off origin_ = nitf_IOInterface_tell(io, error); assert(NITF_IO_SUCCESS(origin_)); - uint64_t origin = origin_; + const uint64_t origin = origin_; /* End book keeping block */ DPRINTA1("File length: %ld\n", fileLength); while (bytesRead < fileLength) @@ -862,9 +863,11 @@ NITFPRIV(NITF_BOOL) scanOffsets(nitf_IOInterface* io, { off_t where = (off_t)nitf_IOInterface_tell(io, error); - uint64_t totalBytes = (fileLength - bytesRead) + - (where - origin); + (void)origin; + #ifndef NDEBUG // i.e., debug + const uint64_t totalBytes = (fileLength - bytesRead) + (where - origin); assert( fileLength == totalBytes); + #endif switch (tokenType) { case JPEG_MARKER_EOI: diff --git a/externals/nitro/modules/c/nitf/unittests/test_moveTREs.c b/externals/nitro/modules/c/nitf/unittests/test_moveTREs.c index 61e56a1795..b40fa96956 100644 --- a/externals/nitro/modules/c/nitf/unittests/test_moveTREs.c +++ b/externals/nitro/modules/c/nitf/unittests/test_moveTREs.c @@ -92,7 +92,7 @@ NITF_BOOL unmergeTREs(nitf_Record *record, nitf_Error *error) } -TEST_CASE_ARGS(testUnmerge) +TEST_CASE(testUnmerge) { nitf_Version version = NITF_VER_21; nitf_Record *record = NULL; @@ -122,9 +122,9 @@ TEST_CASE_ARGS(testUnmerge) nitf_Record_destruct(&record); } -int main(int argc, char **argv) +int main() // int argc, char **argv { - CHECK_ARGS(testUnmerge); + CHECK(testUnmerge); return 0; } diff --git a/externals/nitro/modules/c/nrt/include/nrt/nrt_config.h.cmake.in b/externals/nitro/modules/c/nrt/include/nrt/nrt_config.h.cmake.in index 1c1e05d2d1..3625f7b053 100644 --- a/externals/nitro/modules/c/nrt/include/nrt/nrt_config.h.cmake.in +++ b/externals/nitro/modules/c/nrt/include/nrt/nrt_config.h.cmake.in @@ -3,6 +3,8 @@ #include +#ifndef NRT_LIB_VERSION #define NRT_LIB_VERSION "@NITRO_VERSION@" +#endif #endif diff --git a/externals/nitro/modules/c/nrt/source/Utils.c b/externals/nitro/modules/c/nrt/source/Utils.c index 7a1f760580..a538c4ae54 100644 --- a/externals/nitro/modules/c/nrt/source/Utils.c +++ b/externals/nitro/modules/c/nrt/source/Utils.c @@ -332,7 +332,7 @@ NRTAPI(void) nrt_Utils_decimalToGeographic(double decimal, int *degrees, NRTAPI(double) nrt_Utils_geographicToDecimal(int degrees, int minutes, double seconds) { - double decimal = fabs(degrees); + double decimal = fabs((double)degrees); decimal += fabs(minutes / 60.0); decimal += fabs(seconds / 3600.0); @@ -703,12 +703,12 @@ NRTPROT(void) nrt_Utils_decimalLonToGeoCharArray(double decimal, char *buffer8) * Older versions of Visual Studio do not support `inline` for C * Using `__inline` for Windows instead */ -NRTPRIV(void) #if defined(WIN32) || defined(_WIN32) __inline #else inline #endif +NRTPRIV(void) nrt_Utils_swap(uint8_t* value, size_t indexOne, size_t indexTwo) { diff --git a/externals/nitro/modules/python/CMakeLists.txt b/externals/nitro/modules/python/CMakeLists.txt index 6fd6536b93..03ee3f5102 100644 --- a/externals/nitro/modules/python/CMakeLists.txt +++ b/externals/nitro/modules/python/CMakeLists.txt @@ -1 +1,12 @@ +set(TARGET_LANGUAGE c++) + +if (MSVC) + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /W4 results in a compiler warning. + #add_compile_options(/W0) + string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +elseif (UNIX) + add_compile_options(-w) # "Inhibit all warning messages" +endif() + add_subdirectory("nitf") diff --git a/six/modules/CMakeLists.txt b/six/modules/CMakeLists.txt index 73dd8b0489..ecbb92ba5f 100644 --- a/six/modules/CMakeLists.txt +++ b/six/modules/CMakeLists.txt @@ -1,3 +1,5 @@ +set(TARGET_LANGUAGE c++) + add_subdirectory(c++) if (BUILD_PYTHON_MODULES) add_subdirectory(python) diff --git a/six/modules/c++/CMakeLists.txt b/six/modules/c++/CMakeLists.txt index 1911d21155..6e5dab1cd5 100644 --- a/six/modules/c++/CMakeLists.txt +++ b/six/modules/c++/CMakeLists.txt @@ -1,4 +1,29 @@ -set(TARGET_LANGUAGE c++) +# turn on maximum warnings +if (MSVC) + add_compile_options(/std:c++14) + + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /Wn results in a compiler warning. + #add_compile_options(/W4) # /Wall + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall + + add_compile_options(/wd4996) # '...': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. + add_compile_options(/wd4127) # conditional expression is constant + add_compile_options(/wd4244) # '...': conversion from '...' to '...', possible loss of data + add_compile_options(/wd4267) # '...': conversion from '...' to '...', possible loss of data + +elseif (UNIX) + add_compile_options(-std=c++14) + + #add_compile_options(-Wall -pedantic -Wextra) + add_compile_options(-Wall -Wextra) + + add_compile_options(-Wno-deprecated-copy) + add_compile_options(-Wno-class-memaccess) + add_compile_options(-Wno-sizeof-pointer-div) + add_compile_options(-Wno-unused-parameter) + add_compile_options(-Wno-ignored-qualifiers) +endif() add_subdirectory(scene) add_subdirectory(six) diff --git a/six/modules/c++/cphd/tests/test_metadata_round.cpp b/six/modules/c++/cphd/tests/test_metadata_round.cpp index 93af0f796e..2b0ca1e8f5 100644 --- a/six/modules/c++/cphd/tests/test_metadata_round.cpp +++ b/six/modules/c++/cphd/tests/test_metadata_round.cpp @@ -53,7 +53,7 @@ void parseXMLFile(xml::lite::MinidomParser& xmlParser, std::string pathname) } bool testEqual(const std::string& inPathname, const std::string& outPathname, - size_t numThreads, const std::vector& schemas) + size_t /*numThreads*/, const std::vector& schemas) { // Read in first XML file xml::lite::MinidomParser xmlParser; diff --git a/six/modules/c++/samples/test_create_sidd_from_mem.cpp b/six/modules/c++/samples/test_create_sidd_from_mem.cpp index 21ed25904c..d4459473f7 100644 --- a/six/modules/c++/samples/test_create_sidd_from_mem.cpp +++ b/six/modules/c++/samples/test_create_sidd_from_mem.cpp @@ -2127,7 +2127,7 @@ void initGeoData(six::GeoDataBase& geoData) } void initExploitationFeatures(six::sidd::ExploitationFeatures& exFeatures, - const std::string& version) + const std::string& strVersion) { // The first collection is corresponds to the parent image six::sidd::Collection& collection = *exFeatures.collections[0]; @@ -2161,7 +2161,7 @@ void initExploitationFeatures(six::sidd::ExploitationFeatures& exFeatures, polarization->txPolarization = six::PolarizationSequenceType::V; polarization->rcvPolarization = six::PolarizationSequenceType::OTHER; polarization->rcvPolarizationOffset = 1.37; - if (version == "1.0.0") + if (strVersion == "1.0.0") { polarization->processed = six::BooleanType::IS_TRUE; } @@ -2191,7 +2191,7 @@ void initExploitationFeatures(six::sidd::ExploitationFeatures& exFeatures, exFeatures.product[0].north = 58.332; exFeatures.product[0].extensions.push_back(param); - if (version == "2.0.0") + if (strVersion == "2.0.0") { exFeatures.product[0].ellipticity = 12.0; exFeatures.product[0].polarization.resize(1); diff --git a/six/modules/c++/scene/include/scene/EllipsoidModel.h b/six/modules/c++/scene/include/scene/EllipsoidModel.h index 4193768a0a..18d528add7 100644 --- a/six/modules/c++/scene/include/scene/EllipsoidModel.h +++ b/six/modules/c++/scene/include/scene/EllipsoidModel.h @@ -184,9 +184,10 @@ class WGS84EllipsoidModel : public EllipsoidModel * * @param m The WGS84EllipsoidModel to copy attribute values from */ - WGS84EllipsoidModel(const WGS84EllipsoidModel & m); + WGS84EllipsoidModel(const WGS84EllipsoidModel&); + WGS84EllipsoidModel& operator=(const WGS84EllipsoidModel&); - virtual ~WGS84EllipsoidModel(){} + virtual ~WGS84EllipsoidModel() = default; /** * This function sets the radius values to those specified by the WGS84 diff --git a/six/modules/c++/scene/include/scene/Types.h b/six/modules/c++/scene/include/scene/Types.h index aa00d405ba..44d7956d81 100644 --- a/six/modules/c++/scene/include/scene/Types.h +++ b/six/modules/c++/scene/include/scene/Types.h @@ -97,18 +97,17 @@ namespace scene } - LatLon(const LatLon& lla) + LatLon(const LatLon& ll) { - mLat = lla.mLat; - mLon = lla.mLon; + *this = ll; } - LatLon& operator=(const LatLon& lla) + LatLon& operator=(const LatLon& ll) { - if (this != &lla) + if (this != &ll) { - mLat = lla.mLat; - mLon = lla.mLon; + mLat = ll.mLat; + mLon = ll.mLon; } return *this; } @@ -194,13 +193,10 @@ namespace scene { } - LatLonAlt(const LatLonAlt& lla) + LatLonAlt(const LatLonAlt& lla) : LatLon(lla) { - mLat = lla.mLat; - mLon = lla.mLon; mAlt = lla.mAlt; } - LatLonAlt& operator=(const LatLonAlt& lla) { if (this != &lla) diff --git a/six/modules/c++/scene/source/EllipsoidModel.cpp b/six/modules/c++/scene/source/EllipsoidModel.cpp index 249a36fd92..4da3d6a04b 100644 --- a/six/modules/c++/scene/source/EllipsoidModel.cpp +++ b/six/modules/c++/scene/source/EllipsoidModel.cpp @@ -165,11 +165,21 @@ WGS84EllipsoidModel::WGS84EllipsoidModel(Units unitsVal, initRadiusValues(); } -WGS84EllipsoidModel::WGS84EllipsoidModel( - const WGS84EllipsoidModel & m) +WGS84EllipsoidModel::WGS84EllipsoidModel(const WGS84EllipsoidModel & m) : EllipsoidModel(m) { *this = m; - initRadiusValues(); +} +WGS84EllipsoidModel& WGS84EllipsoidModel::operator=(const WGS84EllipsoidModel & m) +{ + if (this != &m) + { + units = m.units; + angularUnits = m.angularUnits; + equatorialRadius = m.equatorialRadius; + polarRadius = m.polarRadius; + initRadiusValues(); + } + return *this; } void WGS84EllipsoidModel::initRadiusValues() diff --git a/six/modules/c++/six.sicd/source/CropUtils.cpp b/six/modules/c++/six.sicd/source/CropUtils.cpp index 33d678a790..f59c127cb2 100644 --- a/six/modules/c++/six.sicd/source/CropUtils.cpp +++ b/six/modules/c++/six.sicd/source/CropUtils.cpp @@ -53,7 +53,7 @@ void updateMinMax(double val, double& curMin, double& curMax) } } -six::sicd::ComplexData* const updateMetadata( +six::sicd::ComplexData* updateMetadata( const six::sicd::ComplexData& data, const scene::SceneGeometry& geom, const scene::ProjectionModel& projection, diff --git a/six/modules/c++/six.sicd/tests/test_read_sicd_mesh.cpp b/six/modules/c++/six.sicd/tests/test_read_sicd_mesh.cpp index dd90d6195b..686097bbb7 100644 --- a/six/modules/c++/six.sicd/tests/test_read_sicd_mesh.cpp +++ b/six/modules/c++/six.sicd/tests/test_read_sicd_mesh.cpp @@ -53,8 +53,8 @@ int main(int argc, char** argv) complexData->radarCollection->area->plane->referencePoint.rowCol.col); const types::RowCol slantCenter( - complexData->imageData->scpPixel.row, - complexData->imageData->scpPixel.col); + static_cast(complexData->imageData->scpPixel.row), + static_cast(complexData->imageData->scpPixel.col)); std::cout << "outputRowColToSlantRow(outputCenter): " << outputRowColToSlantRow(outputCenter.row, outputCenter.col) << diff --git a/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp b/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp index 007373485a..636ba73706 100644 --- a/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp +++ b/six/modules/c++/six.sidd/unittests/test_valid_sixsidd.cpp @@ -41,18 +41,11 @@ #pragma warning(disable: 4459) // declaration of '...' hides global declaration #endif -static std::filesystem::path argv0() -{ - static const sys::OS os; - static const auto retval = os.getSpecialEnv("0"); - return retval; -} - static inline std::filesystem::path six_sidd_relative_path() { return std::filesystem::path("six") / "modules" / "c++" / "six.sidd"; } -static std::filesystem::path schema_relative_path(const std::string& strVersion) +static std::filesystem::path schema_relative_path() { return six_sidd_relative_path() / "conf" / "schema"; // .../conf/schema } @@ -63,9 +56,9 @@ static std::filesystem::path get_sample_xml_path(const std::filesystem::path& fi return sys::test::findGITModuleFile("six", modulePath, filename); } -static std::vector getSchemaPaths(const std::string& strVersion) +static std::vector getSchemaPaths() { - static const auto xsdPath = sys::test::findGITModuleFile("six", schema_relative_path(strVersion), "SIDD_schema_V3.0.0.xsd"); + static const auto xsdPath = sys::test::findGITModuleFile("six", schema_relative_path(), "SIDD_schema_V3.0.0.xsd"); static const auto rootSchemaDir = xsdPath.parent_path(); // ".../conf/Schema" return std::vector { rootSchemaDir }; } @@ -100,7 +93,7 @@ static void test_createFakeDerivedData_(const std::string& testName, const std:: auto Unmodeled = get_Unmodeled(*pFakeDerivedData, strVersion); TEST_ASSERT_NULL(Unmodeled); // not part of the fake data, only added in SIDD 3.0 - const auto schemaPaths = getSchemaPaths(strVersion); + const auto schemaPaths = getSchemaPaths(); const std::vector* pSchemaPaths = validate ? & schemaPaths: nullptr; // NULL schemaPaths, no validation auto pDerivedData = test_assert_round_trip(testName, *pFakeDerivedData, pSchemaPaths); @@ -156,22 +149,22 @@ static void test_read_sidd_xml(const std::string& testName, const std::filesyste pDerivedData = test_assert_round_trip(testName, *pDerivedData, pSchemaPaths); test_assert_unmodeled(testName, *pDerivedData); } -static void test_read_sidd_xml(const std::string& testName, const std::filesystem::path& path, const std::string& strVersion) +static void test_read_sidd_xml(const std::string& testName, const std::filesystem::path& path) { const std::vector* pSchemaPaths = nullptr; // NULL schemaPaths, no validation test_read_sidd_xml(testName, path, pSchemaPaths); // validate XML against schema - const auto schemaPaths = getSchemaPaths(strVersion); + const auto schemaPaths = getSchemaPaths(); test_read_sidd_xml(testName, path, &schemaPaths); } TEST_CASE(test_read_sidd200_xml) { - test_read_sidd_xml(testName, "sidd200.xml", "2.0.0"); + test_read_sidd_xml(testName, "sidd200.xml"); } TEST_CASE(test_read_sidd300_xml) { - test_read_sidd_xml(testName, "sidd300.xml", "3.0.0"); + test_read_sidd_xml(testName, "sidd300.xml"); } TEST_MAIN( diff --git a/six/modules/c++/six/unittests/test_polarization_type_conversions.cpp b/six/modules/c++/six/unittests/test_polarization_type_conversions.cpp index 9036bf0fc2..55462a59c3 100644 --- a/six/modules/c++/six/unittests/test_polarization_type_conversions.cpp +++ b/six/modules/c++/six/unittests/test_polarization_type_conversions.cpp @@ -368,6 +368,8 @@ TEST_CASE(NotSet) test_NotSet("NotSet"); test_NotSet("NotSet"); test_NotSet("NotSet"); + + TEST_ASSERT_TRUE(true); } template diff --git a/six/modules/python/CMakeLists.txt b/six/modules/python/CMakeLists.txt index 9c7a8f825f..6df801273c 100644 --- a/six/modules/python/CMakeLists.txt +++ b/six/modules/python/CMakeLists.txt @@ -1,3 +1,15 @@ +set(TARGET_LANGUAGE c++) + +# Turn off all warnings; this is code we don't control. +if (MSVC) + # By default, there is a /W3 on the command-line from somewhere (?); adding + # /Wn results in a compiler warning. + #add_compile_options(/W0) + string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +elseif (UNIX) + add_compile_options(-w) # "Inhibit all warning messages" +endif() + add_subdirectory(scene) add_subdirectory(six) add_subdirectory(six.sicd)