diff --git a/.gitignore b/.gitignore index 52ada7d53a..b8babd6f1a 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ six/modules/**/Makefile *_config.hpp # ignore build directories ... build/ +out/ # ... but not coda-oss/build !/externals/coda-oss/build/ diff --git a/externals/coda-oss/ReleaseNotes.md b/externals/coda-oss/ReleaseNotes.md index c54bdadcbc..a5dd83e18b 100644 --- a/externals/coda-oss/ReleaseNotes.md +++ b/externals/coda-oss/ReleaseNotes.md @@ -11,6 +11,12 @@ ``` # coda-oss Release Notes +## [Release 202?-??-??](https://github.com/mdaus/coda-oss/releases/tag/202?-??-??) +* New `sys::OS::getSIMDInstructionSet()` utility routine; SSE2 is required (default with 64-bit builds). +* `types::ComplexInteger` to work-around `std::complex` no longer being [valid C++](https://en.cppreference.com/w/cpp/numeric/complex). +* Another round of reducing various compiler warnings (of note: `NULL` -> `nullptr`). +* Some suport for [`std::numbers`](https://en.cppreference.com/w/cpp/header/numbers) from C++20. + ## [Release 2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05) * *zlib* updated to [1.2.13](https://github.com/madler/zlib/releases/tag/v1.2.13). * new `mem::ComplexView` class to make it easier to process complex data stored in parallel. diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj b/externals/coda-oss/modules/c++/coda-oss.vcxproj index 6dc5c0fc65..cd74689659 100644 --- a/externals/coda-oss/modules/c++/coda-oss.vcxproj +++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj @@ -594,7 +594,6 @@ AdvancedVectorExtensions2 MultiThreadedDebugDLL true - MultiThreadedDebugDLL diff --git a/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h b/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h index 6b135288d8..67fd4f167c 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h @@ -91,6 +91,8 @@ inline void check_elemSize(size_t elemSize) template inline auto make_span(coda_oss::span> s) { + static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + const void* const p_ = s.data(); auto const p = static_cast(p_); const auto sz = s.size() * 2; // real and imag @@ -99,6 +101,8 @@ inline auto make_span(coda_oss::span> s) template inline auto make_span(coda_oss::span> s) { + static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + void* const p_ = s.data(); auto const p = static_cast(p_); const auto sz = s.size() * 2; // real and imag @@ -118,6 +122,8 @@ inline void byteSwap(T* buffer, size_t elemSize, size_t numElems) template inline void byteSwap(std::complex* buffer, size_t elemSize, size_t numElems) // dont't want `T` as `std::complex<...>` { + static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + details::check_elemSize(elemSize); void* const buffer_ = buffer; byteSwap(buffer_, elemSize, numElems); @@ -188,6 +194,8 @@ inline void byteSwap(const T* buffer, size_t elemSize, size_t numElems, U* outpu template inline void byteSwap(const std::complex* buffer, size_t elemSize, size_t numElems, U* outputBuffer) // dont't want `T` as `std::complex<...>` { + static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + details::check_elemSize(elemSize); const void* const buffer_ = buffer; void* const outputBuffer_ = outputBuffer; @@ -226,6 +234,8 @@ inline auto byteSwap(coda_oss::span> buffer) template inline auto byteSwapValue(std::complex z) { + static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + // C++ mandates that `std::complex` be the same as `T cx[2]`; that is // the structure is contiguous. https://en.cppreference.com/w/cpp/numeric/complex const auto& z_ = reinterpret_cast(z); diff --git a/externals/coda-oss/modules/c++/types/include/types/Complex.h b/externals/coda-oss/modules/c++/types/include/types/Complex.h index 8b2218ff4b..cefa90a835 100644 --- a/externals/coda-oss/modules/c++/types/include/types/Complex.h +++ b/externals/coda-oss/modules/c++/types/include/types/Complex.h @@ -165,37 +165,8 @@ inline auto abs(const Complex& z) // https://en.cppreference.com/w/cpp/numeri return abs(details::cast(z)); } -// Control whether ComplexInteger is std::complex or Complex. -// If it is std::complex, then a types::ComplexInteger overload normally can't be -// used as it will be the same as std::complex -#ifdef CODA_OSS_types_FORCE_unique_ComplexInteger // bypass checks below -#define CODA_OSS_types_unique_ComplexInteger 1 -#endif -#ifdef CODA_OSS_types_NO_unique_ComplexInteger -#ifdef CODA_OSS_types_unique_ComplexInteger -#error "CODA_OSS_types_unique_ComplexInteger already #define'd" -#endif -#define CODA_OSS_types_unique_ComplexInteger 0 -#endif - -#ifndef CODA_OSS_types_unique_ComplexInteger -// If the warning about using std::complex has been turned off, we might -// as well use std:complex. -#ifdef _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING -#define CODA_OSS_types_unique_ComplexInteger 0 -#endif -#endif - -#ifndef CODA_OSS_types_unique_ComplexInteger -#define CODA_OSS_types_unique_ComplexInteger 1 -#endif - template -#if CODA_OSS_types_unique_ComplexInteger using ComplexInteger = Complex; -#else -using ComplexInteger = std::complex; -#endif namespace details { diff --git a/externals/nitro/UnitTest/pch.h b/externals/nitro/UnitTest/pch.h index 2fa0542e05..ab78e8ef45 100644 --- a/externals/nitro/UnitTest/pch.h +++ b/externals/nitro/UnitTest/pch.h @@ -1,52 +1,45 @@ -// pch.h: This is a precompiled header file. -// Files listed below are compiled only once, improving build performance for future builds. -// This also affects IntelliSense performance, including code completion and many code browsing features. -// However, files listed here are ALL re-compiled if any one of them is updated between builds. -// Do not add files here that you will be updating frequently as this negates the performance advantage. - -#ifndef PCH_H -#define PCH_H -#pragma once - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define NOMINMAX -#pragma warning(push) -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. -#include -#pragma warning(pop) -#pragma comment(lib, "ws2_32") - -#pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' -#pragma warning(disable: 4710) // '...': function not inlined -#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if / Qspectre switch specified -#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' -// TODO: get rid of these someday? -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. -#pragma warning(disable: 4514) // '...': unreferenced inline function has been removed - -// We're building in Visual Studio ... used to control where we get a little bit of config info -#define NITRO_PCH 1 - -#pragma warning(disable: 5032) // detected #pragma warning(push) with no corresponding #pragma warning(pop) -#pragma warning(push) -#pragma warning(disable: 4464) // relative include path contains '..' -#include -#pragma warning(disable: 5031) // #pragma warning(pop): likely mismatch, popping warning state pushed in different file -#pragma comment(lib, "io-c++") -#pragma comment(lib, "except-c++") -#pragma comment(lib, "sys-c++") -#pragma comment(lib, "str-c++") -#pragma warning(pop) - -#pragma warning(push) -#include "CppUnitTest.h" -#pragma warning(pop) - -#include -#include -#include - -#include "nitf_Test.h" -#include "Test.h" - -#endif //PCH_H +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX +#pragma warning(push) +#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#include +#pragma warning(pop) +#pragma comment(lib, "ws2_32") + +// We're building in Visual Studio ... used to control where we get a little bit of config info +#define NITRO_PCH 1 + +#include +#include +#include + +#include +#pragma comment(lib, "io-c++") +#pragma comment(lib, "io-c++") +#pragma comment(lib, "except-c++") +#pragma comment(lib, "sys-c++") +#pragma comment(lib, "str-c++") +#pragma comment(lib, "sio.lite-c++.lib") +#pragma comment(lib, "math-c++") +#pragma comment(lib, "mt-c++") + +#include +#include +#include +#include +#include + +#include "Test.h" + +#endif //PCH_H diff --git a/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h b/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h index 8177193aee..e9911867dd 100644 --- a/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h +++ b/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h @@ -41,6 +41,7 @@ #pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly #pragma warning(disable: 5220) // '...': a non-static data member with a volatile qualified type no longer implies #pragma warning(disable: 4355) // '...': used in base member initializer list +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include diff --git a/externals/nitro/modules/c++/nitf/unittests/test_hash_table_1++.cpp b/externals/nitro/modules/c++/nitf/unittests/test_hash_table_1++.cpp index 8f382d9429..c13fbd5ae3 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_hash_table_1++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_hash_table_1++.cpp @@ -151,8 +151,6 @@ TEST_CASE(test_hash_table_iterator) } TEST_MAIN( - (void)argc; - (void)argv; TEST_CHECK(test_hash_table_1); TEST_CHECK(test_hash_table_iterator); -) \ No newline at end of file +) diff --git a/externals/nitro/modules/c++/nitf/unittests/test_load_plugins.cpp b/externals/nitro/modules/c++/nitf/unittests/test_load_plugins.cpp index 4aaee43ca9..c94707f569 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_load_plugins.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_load_plugins.cpp @@ -30,32 +30,28 @@ #include "TestCase.h" -static void load_plugin(const std::string& testName, const char* tre) +static void retrieveTREHandler(const std::string& testName, const char* tre) { nitf_Error error; - auto reg = nitf::PluginRegistry::getInstance(error); + auto const reg = nitf::PluginRegistry::getInstance(error); TEST_ASSERT(reg != nullptr); - nitf::HashTable::print(*(reg->treHandlers)); + //nitf::HashTable::print(*(reg->treHandlers)); int bad = 0; - auto test_main_ = - nitf::PluginRegistry::retrieveTREHandler(*reg, - tre, - bad, - error); + auto const test_main_ = nitf::PluginRegistry::retrieveTREHandler(*reg, tre, bad, error); TEST_ASSERT_EQ(0, bad); TEST_ASSERT(test_main_ != nullptr); } -static const std::vector& all_plugins() +static const auto& all_TREs() { - static const std::vector all_plugins_ + static const std::vector retval { #if _MSC_VER && NITRO_PCH // only build a handful in Visual Studio - "ACCHZB", "ACCPOB", "ACFTA", "AIMIDB", "CSCRNA", "ENGRDA", "HISTOA", "JITCID", "PTPRAA", "RPFHDR", + "ACCHZB", "ACCPOB", "ACFTA", "AIMIDB", "CSCRNA", "CSEXRB", "ENGRDA", "HISTOA", "JITCID", "PTPRAA", "RPFHDR", #else "ACCHZB", "BANDSB", "CSDIDA", "GEOLOB", "JITCID", "NBLOCA", "PIAPEB", "REGPTB", "RSMIDA", "STEROB", "ACCPOB", "BCKGDA", "CSEPHA", "GEOPSB", "MAPLOB", "OBJCTA", "PIAPRC", "RPC00B", "RSMPCA", "STREOB", @@ -69,59 +65,59 @@ static const std::vector& all_plugins() "BANDSA", "CSCRNA", "EXPLTB", "J2KLRA", "MTIRPB", "PIAPEA", "PTPRAA", "RSMGIA", "STDIDC", #endif }; - return all_plugins_; + return retval; } -TEST_CASE(test_load_all_plugins_C) +TEST_CASE(test_retrieveTREHandler) { - nitf::Test::setNitfPluginPath(); - - for (const auto& tre : all_plugins()) + for (const auto& tre : all_TREs()) { - load_plugin(testName, tre.c_str()); + retrieveTREHandler(testName, tre.c_str()); } } TEST_CASE(test_load_PTPRAA) { - nitf::Test::setNitfPluginPath(); - load_plugin(testName, "PTPRAA"); + retrieveTREHandler(testName, "PTPRAA"); } TEST_CASE(test_load_ENGRDA) { - nitf::Test::setNitfPluginPath(); - load_plugin(testName, "ENGRDA"); + retrieveTREHandler(testName, "ENGRDA"); } -static void loadPlugin(const std::string& testName, const std::string& path) -{ - try - { -#ifdef _WIN32 - // need the full path to load on Linux - nitf::PluginRegistry::loadPlugin(path); -#endif - TEST_SUCCESS; - } - catch (const nitf::NITFException& ex) - { - TEST_FAIL_MSG(ex.toString()); - } -} -TEST_CASE(test_load_all_plugins) +TEST_CASE(test_load_all_TREs) { - nitf::Test::setNitfPluginPath(); + const nitf::TRE tre("ACCPOB"); - for (const auto& tre : all_plugins()) + for (const auto& tre : all_TREs()) { - loadPlugin(testName, tre); + // TREs are quite the same thing as an arbitrary "plug in;" the underlying + // infrastructure is all built on shared-libraries/DLLs, but details differ. + // + // As a result, we can't expect loadPlugin() will "just work" on a TRE name. + // Unfortunately, the behavior is different on Windows and Linux. :-( + #if _WIN32 + // Keep this around for now as it works ... but it's not necessarily correct. + // Mostly an excuse to exercise more code. + try + { + nitf::PluginRegistry::loadPlugin(tre); + } + catch (const nitf::NITFException& ex) + { + TEST_FAIL_MSG(ex.toString()); + } + #endif // _WIN32 + TEST_ASSERT(nitf::PluginRegistry::treHandlerExists(tre)); } } TEST_MAIN( + nitf::Test::setNitfPluginPath(); + TEST_CHECK(test_load_PTPRAA); - TEST_CHECK(test_load_ENGRDA); - TEST_CHECK(test_load_all_plugins_C); - TEST_CHECK(test_load_all_plugins); + TEST_CHECK(test_load_ENGRDA); + TEST_CHECK(test_retrieveTREHandler); + TEST_CHECK(test_load_all_TREs); ) \ No newline at end of file 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..bc3f884fc7 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_tre_create++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_tre_create++.cpp @@ -7,8 +7,6 @@ TEST_CASE(test_tre_create_329) { - nitf::Test::setNitfPluginPath(); - // https://github.com/mdaus/nitro/issues/329 nitf::TRE tre("HISTOA", "HISTOA"); // allocates fields SYSTEM .. NEVENTS @@ -21,8 +19,6 @@ TEST_CASE(test_tre_create_329) TEST_CASE(test_tre_clone_329) { - nitf::Test::setNitfPluginPath(); - // https://github.com/mdaus/nitro/issues/329 const std::string rd = "begin1020030004ABCDEFend"; @@ -43,6 +39,8 @@ TEST_CASE(test_tre_clone_329) } TEST_MAIN( + nitf::Test::setNitfPluginPath(); + 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 8eb85006b1..1c2b4a8705 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -159,8 +159,6 @@ struct /*namespace*/ TREs TEST_CASE(setFields) { - nitf::Test::setNitfPluginPath(); - // create an ACFTA TRE nitf::TRE tre("ACFTA"); @@ -180,8 +178,6 @@ TEST_CASE(setFields) TEST_CASE(setBinaryFields) { - nitf::Test::setNitfPluginPath(); - nitf::TRE tre("RPFHDR"); const int value = 123; tre.setField("LOCSEC", value); @@ -193,8 +189,6 @@ TEST_CASE(setBinaryFields) TEST_CASE(cloneTRE) { - nitf::Test::setNitfPluginPath(); - nitf::TRE tre("JITCID"); tre.setField("FILCMT", "fyi"); @@ -208,8 +202,6 @@ TEST_CASE(cloneTRE) TEST_CASE(basicIteration) { - nitf::Test::setNitfPluginPath(); - nitf::TRE tre("ACCPOB"); // The entire TRE is one loop, and we haven't told it @@ -237,8 +229,6 @@ TEST_CASE(basicIteration) TEST_CASE(use_ENGRDA) { - nitf::Test::setNitfPluginPath(); - nitf::TRE engrda("ENGRDA", "ENGRDA"); engrda.setField("RESRC", "HSS"); @@ -263,8 +253,6 @@ TEST_CASE(use_ENGRDA) TEST_CASE(use_ENGRDA_typed_fields) { - nitf::Test::setNitfPluginPath(); - nitf::TRE engrda("ENGRDA", "ENGRDA"); nitf::TREField_BCS_A<20> RESRC(engrda, "RESRC"); @@ -297,8 +285,6 @@ TEST_CASE(use_ENGRDA_typed_fields) TEST_CASE(use_typed_ENGRDA) { - nitf::Test::setNitfPluginPath(); - TREs::ENGRDA engrda; // nitf::TRE engrda("ENGRDA", "ENGRDA"); engrda.RESRC = "HSS"; // engrda.setField("RESRC", "HSS"); @@ -347,8 +333,6 @@ TEST_CASE(use_typed_ENGRDA) TEST_CASE(use_CSEXRB_typed_fields) { - nitf::Test::setNitfPluginPath(); - nitf::TRE tre("CSEXRB", "CSEXRB"); constexpr auto length = 12; @@ -362,8 +346,6 @@ TEST_CASE(use_CSEXRB_typed_fields) TEST_CASE(populateWhileIterating) { - nitf::Test::setNitfPluginPath(); - nitf::TRE tre("ACCPOB"); size_t numFields = 0; for (auto it = tre.begin(); it != tre.end(); ++it) @@ -388,8 +370,6 @@ TEST_CASE(populateWhileIterating) TEST_CASE(overflowingNumericFields) { - nitf::Test::setNitfPluginPath(); - nitf::TRE tre("CSCRNA"); // This field has a length of 9, so check that it's properly @@ -418,6 +398,8 @@ TEST_CASE(overflowingNumericFields) } TEST_MAIN( + nitf::Test::setNitfPluginPath(); + TEST_CHECK(setFields); TEST_CHECK(setBinaryFields); TEST_CHECK(cloneTRE); 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 be2517963e..5bee638c71 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_tre_mods.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_tre_mods.cpp @@ -26,8 +26,6 @@ TEST_CASE(testNestedMod) { - nitf::Test::setNitfPluginPath(); - nitf_Error error; NITF_BOOL exists; nitf_TRE* tre = nitf_TRE_construct("ACCHZB", NULL, &error); @@ -61,8 +59,6 @@ TEST_CASE(testNestedMod) TEST_CASE(testIncompleteCondMod) { - nitf::Test::setNitfPluginPath(); - nitf_Error error; NITF_BOOL exists; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); @@ -89,8 +85,6 @@ TEST_CASE(testIncompleteCondMod) TEST_CASE(testClone) { - nitf::Test::setNitfPluginPath(); - NITF_BOOL exists; nitf_TRE* dolly; /* used for clone */ nitf_Field* clonedField = NULL; @@ -116,8 +110,6 @@ TEST_CASE(testClone) TEST_CASE(testBasicMod) { - nitf::Test::setNitfPluginPath(); - /* construct a tre */ NITF_BOOL exists; nitf_Error error; @@ -147,8 +139,6 @@ TEST_CASE(testBasicMod) TEST_CASE(testSize) { - nitf::Test::setNitfPluginPath(); - nitf_Error error; int treLength; nitf_TRE* tre = nitf_TRE_construct("AIMIDB", NULL, &error); @@ -163,8 +153,6 @@ TEST_CASE(testSize) TEST_CASE(iterateUnfilled) { - nitf::Test::setNitfPluginPath(); - nitf_Error error; nitf_TRECursor cursor; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); @@ -186,8 +174,6 @@ TEST_CASE(iterateUnfilled) TEST_CASE(populateThenIterate) { - nitf::Test::setNitfPluginPath(); - nitf_Error error; nitf_TRECursor cursor; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); @@ -214,8 +200,6 @@ TEST_CASE(populateThenIterate) TEST_CASE(populateWhileIterating) { - nitf::Test::setNitfPluginPath(); - nitf_Error error; nitf_TRECursor cursor; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); @@ -247,6 +231,8 @@ TEST_CASE(populateWhileIterating) } TEST_MAIN( + nitf::Test::setNitfPluginPath(); + TEST_CHECK(testClone); TEST_CHECK(testSize); TEST_CHECK(testBasicMod); diff --git a/externals/nitro/modules/c++/nitf/unittests/test_writer_3++.cpp b/externals/nitro/modules/c++/nitf/unittests/test_writer_3++.cpp index d2955dd26d..e68dd3d379 100644 --- a/externals/nitro/modules/c++/nitf/unittests/test_writer_3++.cpp +++ b/externals/nitro/modules/c++/nitf/unittests/test_writer_3++.cpp @@ -28,6 +28,7 @@ #include #include +#include #include "TestCase.h" @@ -268,4 +269,4 @@ TEST_CASE(test_buffered_write_) TEST_MAIN( TEST_CHECK(test_writer_3_); TEST_CHECK(test_buffered_write_); - ) \ No newline at end of file + ) diff --git a/externals/nitro/modules/c++/pch.h b/externals/nitro/modules/c++/pch.h index 2d5aa61256..e2236fd36e 100644 --- a/externals/nitro/modules/c++/pch.h +++ b/externals/nitro/modules/c++/pch.h @@ -28,6 +28,7 @@ CODA_OSS_disable_warning_pop #define NOMINMAX #pragma warning(push) #pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior #include #pragma warning(pop) diff --git a/externals/nitro/modules/c/j2k/shared/J2KCompress.c b/externals/nitro/modules/c/j2k/shared/J2KCompress.c index 5eb24805e4..9af824236f 100644 --- a/externals/nitro/modules/c/j2k/shared/J2KCompress.c +++ b/externals/nitro/modules/c/j2k/shared/J2KCompress.c @@ -20,23 +20,14 @@ * */ +#include + #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 -#pragma warning(pop) -#undef min -#undef max - #pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified #endif // _MSC_VER -#include #include NITF_CXX_GUARD diff --git a/externals/nitro/modules/c/j2k/shared/J2KDecompress.c b/externals/nitro/modules/c/j2k/shared/J2KDecompress.c index 12daa20206..c9b2c0a4a3 100644 --- a/externals/nitro/modules/c/j2k/shared/J2KDecompress.c +++ b/externals/nitro/modules/c/j2k/shared/J2KDecompress.c @@ -20,23 +20,14 @@ * */ +#include + #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 -#pragma warning(pop) -#undef min -#undef max - #pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified #endif // _MSC_VER -#include #include NITF_CXX_GUARD diff --git a/externals/nitro/modules/c/nitf/include/import/nitf.h b/externals/nitro/modules/c/nitf/include/import/nitf.h index 14afa57f22..3f03e9bb4d 100644 --- a/externals/nitro/modules/c/nitf/include/import/nitf.h +++ b/externals/nitro/modules/c/nitf/include/import/nitf.h @@ -20,8 +20,32 @@ * */ -#ifndef __IMPORT_NITF_H__ -#define __IMPORT_NITF_H__ +#pragma once +#ifndef NITRO_nitf_import_nitf_h_INCLUDED_ +#define NITRO_nitf_import_nitf_h_INCLUDED_ + +#if _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4820) // '...' : '...' bytes padding added after data member '...' +#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' +#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior +#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified +#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior +#endif + +#if _MSC_VER +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include +#undef min +#undef max +#endif #include "nitf/BandInfo.h" #include "nitf/BandSource.h" @@ -67,4 +91,8 @@ #include "nitf/DirectBlockSource.h" #include "nitf/WriterOptions.h" +#if _MSC_VER +#pragma warning(pop) #endif + +#endif // NITRO_nitf_import_nitf_h_INCLUDED_ \ No newline at end of file diff --git a/externals/nitro/modules/c/nitf/shared/ACCHZB.c b/externals/nitro/modules/c/nitf/shared/ACCHZB.c index 108de34b5b..2107c87b44 100644 --- a/externals/nitro/modules/c/nitf/shared/ACCHZB.c +++ b/externals/nitro/modules/c/nitf/shared/ACCHZB.c @@ -20,12 +20,6 @@ * */ -#if _MSC_VER -#pragma warning(disable: 4820) // '...' : '...' bytes padding added after data member '...' -#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception. -#endif - #include NITF_CXX_GUARD diff --git a/externals/nitro/modules/c/nitf/shared/JITCID.c b/externals/nitro/modules/c/nitf/shared/JITCID.c index 50ee19ed40..73bacd87a8 100644 --- a/externals/nitro/modules/c/nitf/shared/JITCID.c +++ b/externals/nitro/modules/c/nitf/shared/JITCID.c @@ -20,12 +20,7 @@ * */ -#if _MSC_VER -#pragma warning(disable: 4820) // '...' : '...' bytes padding added after data member '...' -#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception. -#endif - +#include #include #include diff --git a/externals/nitro/modules/c/nitf/source/BandInfo.c b/externals/nitro/modules/c/nitf/source/BandInfo.c index c70ee3f1cc..685c5ac33b 100644 --- a/externals/nitro/modules/c/nitf/source/BandInfo.c +++ b/externals/nitro/modules/c/nitf/source/BandInfo.c @@ -80,7 +80,7 @@ NITFAPI(void) nitf_BandInfo_destruct(nitf_BandInfo ** info) _NITF_DESTRUCT_FIELD(&(*info), NITF_NLUTS); _NITF_DESTRUCT_FIELD(&(*info), NITF_NELUT); - if (&(*info)->lut) + if ((*info)->lut) { nitf_LookupTable_destruct(&(*info)->lut); } diff --git a/externals/nitro/modules/c/pch.h b/externals/nitro/modules/c/pch.h index 5928459c7d..ca4079d2da 100644 --- a/externals/nitro/modules/c/pch.h +++ b/externals/nitro/modules/c/pch.h @@ -20,6 +20,7 @@ #pragma warning(push) #pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include