diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65b046fb7b..7113638cbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.14)
project(nitro)
-set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_C_STANDARD 99)
+set(C_STANDARD_REQUIRED true)
+set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED true)
if (${CMAKE_PROJECT_NAME} STREQUAL nitro)
diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj
index 5f556f3d1c..3ba6b7b348 100644
--- a/UnitTest/UnitTest.vcxproj
+++ b/UnitTest/UnitTest.vcxproj
@@ -68,8 +68,8 @@
true
true
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
@@ -93,8 +93,8 @@
true
true
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
diff --git a/copy_externals.csh b/copy_externals.csh
index 4f2d5701c1..3386a4851e 100755
--- a/copy_externals.csh
+++ b/copy_externals.csh
@@ -1,7 +1,7 @@
#!/bin/csh -f
rm -r -f tmp && mkdir tmp && cd tmp
-git clone --depth 1 -b cpp17 git@github.com:mdaus/coda-oss.git
+git clone --depth 1 -b cpp20 git@github.com:mdaus/coda-oss.git
rm -r -f coda-oss/.git
cd ..
diff --git a/externals/coda-oss/CMakeLists.txt b/externals/coda-oss/CMakeLists.txt
index 6ef7c1b353..4acc001e4c 100644
--- a/externals/coda-oss/CMakeLists.txt
+++ b/externals/coda-oss/CMakeLists.txt
@@ -5,7 +5,9 @@
cmake_minimum_required(VERSION 3.14)
project(coda-oss)
-set(CMAKE_CXX_STANDARD 17)
+project(coda-oss)
+
+set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED true)
if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
@@ -22,13 +24,9 @@ if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss)
# Always turn on "warnings as errors" to avoid lots of (meaningless?) build output;
# we'll dial-back warnings as necessary.
if (MSVC)
- add_compile_options(/WX) # warnings as errors
- add_compile_options(/MP) # multi-processor compile
-
- if (ENABLE_ASAN)
- # https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160
- add_compile_options(/fsanitize=address)
- endif()
+ # 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}")
elseif (UNIX)
add_compile_options(-Werror) # warnings as errors
diff --git a/externals/coda-oss/UnitTest/UnitTest.vcxproj b/externals/coda-oss/UnitTest/UnitTest.vcxproj
index a0585026c1..c0c9fb9bd7 100644
--- a/externals/coda-oss/UnitTest/UnitTest.vcxproj
+++ b/externals/coda-oss/UnitTest/UnitTest.vcxproj
@@ -71,8 +71,8 @@
true
/Zc:__cplusplus %(AdditionalOptions)
AdvancedVectorExtensions2
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
MultiThreadedDebugDLL
@@ -99,8 +99,8 @@
true
/Zc:__cplusplus %(AdditionalOptions)
AdvancedVectorExtensions2
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
Windows
diff --git a/externals/coda-oss/build/build.py b/externals/coda-oss/build/build.py
index a247788f86..da252050d0 100644
--- a/externals/coda-oss/build/build.py
+++ b/externals/coda-oss/build/build.py
@@ -812,7 +812,7 @@ def options(opt):
'results. NOOP if junit_xml cannot be imported')
-def ensureCpp17Support(self):
+def ensureCpp20Support(self):
# DEPRECATED.
# Keeping for now in case downstream code is still looking for it
self.env['cpp11support'] = True
@@ -830,6 +830,14 @@ def configureCompilerOptions(self):
if ccCompiler == 'msvc':
cxxCompiler = ccCompiler
+ else:
+ if ccCompiler == 'gcc':
+ ccCompiler = 'gcc-10'
+ self.env['COMPILER_CC'] =ccCompiler
+
+ if cxxCompiler == 'g++':
+ cxxCompiler = 'g++-10'
+ self.env['COMPILER_CXX'] = cxxCompiler
if not cxxCompiler or not ccCompiler:
self.fatal('Unable to find C/C++ compiler')
@@ -873,7 +881,7 @@ def configureCompilerOptions(self):
self.env.append_value('CFLAGS', '-fPIC -dynamiclib'.split())
# GCC / ICC (for Linux or Solaris)
- elif ccCompiler == 'gcc' or ccCompiler == 'icc':
+ elif ccCompiler == 'gcc' or ccCompiler == 'gcc-10' or ccCompiler == 'icc':
if not re.match(winRegex, sys_platform):
self.env.append_value('LIB_DL', 'dl')
if not re.match(osxRegex, sys_platform):
@@ -883,7 +891,7 @@ def configureCompilerOptions(self):
self.check_cc(lib='pthread', mandatory=True)
warningFlags = '-Wall'
- if ccCompiler == 'gcc':
+ if ccCompiler == 'gcc' or ccCompiler == 'gcc-10':
#warningFlags += ' -Wno-deprecated-declarations -Wold-style-cast'
warningFlags += ' -Wno-deprecated-declarations'
else:
@@ -897,7 +905,13 @@ def configureCompilerOptions(self):
# If you want the plugins to not depend on Intel libraries,
# configure with:
# --with-cflags=-static-intel --with-cxxflags=-static-intel --with-linkflags=-static-intel
- if cxxCompiler == 'g++' or cxxCompiler == 'icpc':
+ if cxxCompiler == 'gcc' or cxxCompiler == 'gcc-10':
+ config['cxx']['debug'] = '-ggdb3'
+ config['cxx']['optz_debug'] = '-Og'
+ elif cxxCompiler == 'icpc':
+ config['cxx']['debug'] = '-g'
+ config['cxx']['optz_debug'] = ''
+ if cxxCompiler == 'g++' or cxxCompiler == 'g++-10' or cxxCompiler == 'icpc':
config['cxx']['warn'] = warningFlags.split()
config['cxx']['verbose'] = '-v'
config['cxx']['64'] = '-m64'
@@ -913,8 +927,7 @@ def configureCompilerOptions(self):
# The "fastest-possible" option is new; see comments above.
config['cxx']['optz_fastest-possible'] = [ config['cxx']['optz_faster'], '-march=native' ] # -march=native instead of haswell
- self.env.append_value('CXXFLAGS', '-fPIC'.split())
- gxxCompileFlags='-std=c++17'
+ gxxCompileFlags='-fPIC -std=c++2a'
self.env.append_value('CXXFLAGS', gxxCompileFlags.split())
# DEFINES and LINKFLAGS will apply to both gcc and g++
@@ -929,22 +942,13 @@ def configureCompilerOptions(self):
self.env.append_value('LINKFLAGS', linkFlags.split())
- if Options.options.debugging:
- if cxxCompiler == 'g++':
- config['cxx']['debug'] = '-ggdb3'
- config['cxx']['optz_debug'] = '-Og'
- elif cxxCompiler == 'icpc':
- config['cxx']['debug'] = '-g'
- config['cxx']['optz_debug'] = ''
-
- if ccCompiler == 'gcc':
- config['cc']['debug'] = '-ggdb3'
- config['cc']['optz_debug'] = '-Og'
- elif ccCompiler == 'icc':
- config['cc']['debug'] = '-g'
- config['cc']['optz_debug'] = ''
-
- if ccCompiler == 'gcc' or ccCompiler == 'icc':
+ if ccCompiler == 'gcc' or ccCompiler == 'gcc-10':
+ config['cc']['debug'] = '-ggdb3'
+ config['cc']['optz_debug'] = '-Og'
+ elif ccCompiler == 'icc':
+ config['cc']['debug'] = '-g'
+ config['cc']['optz_debug'] = ''
+ if ccCompiler == 'gcc' or ccCompiler == 'gcc-10' or ccCompiler == 'icc':
config['cc']['warn'] = warningFlags.split()
config['cc']['verbose'] = '-v'
config['cc']['64'] = '-m64'
@@ -1024,7 +1028,7 @@ def configureCompilerOptions(self):
'WIN32 _USE_MATH_DEFINES NOMINMAX _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN'.split()
flags = '/UUNICODE /U_UNICODE /EHs /GR'.split()
- flags.append('/std:c++17')
+ flags.append('/std:c++20')
self.env.append_value('DEFINES', defines)
self.env.append_value('CXXFLAGS', flags)
@@ -1245,7 +1249,7 @@ def configure(self):
if Options.options._defs:
env.append_unique('DEFINES', Options.options._defs.split(','))
configureCompilerOptions(self)
- ensureCpp17Support(self)
+ ensureCpp20Support(self)
env['PLATFORM'] = sys_platform
diff --git a/externals/coda-oss/build/config.guess b/externals/coda-oss/build/config.guess
index c93201a4d2..30646a1add 100755
--- a/externals/coda-oss/build/config.guess
+++ b/externals/coda-oss/build/config.guess
@@ -115,7 +115,7 @@ dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
+ for c in gcc-10 gcc c99 c89 cc; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj b/externals/coda-oss/modules/c++/coda-oss.vcxproj
index 3b81ab3706..b7839bd1be 100644
--- a/externals/coda-oss/modules/c++/coda-oss.vcxproj
+++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj
@@ -24,7 +24,6 @@
-
@@ -582,8 +581,8 @@
AdvancedVectorExtensions2
MultiThreadedDebugDLL
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
@@ -612,8 +611,8 @@
true
/Zc:__cplusplus %(AdditionalOptions)
AdvancedVectorExtensions2
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters b/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
index 1a54be81bb..1a9e93ab01 100644
--- a/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
+++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters
@@ -39,9 +39,6 @@
coda_oss
-
- coda_oss
-
coda_oss
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
index 887579a5c7..18546ac820 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
@@ -79,8 +79,8 @@
#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus20)
#define CODA_OSS_cpp23 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus23)
-#if !CODA_OSS_cpp17
-#error "Must compile with C++17 or greater."
+#if !CODA_OSS_cpp20
+#error "Must compile with C++20 or greater."
#endif
// Get feature-testing macros: https://en.cppreference.com/w/cpp/feature_test
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/bit.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/bit.h
index 271935ab0a..a289e264f8 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/bit.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/bit.h
@@ -28,24 +28,14 @@
#include // "These functions are GNU extensions."
#endif
+#include
#include
#include "coda_oss/namespace_.h"
namespace coda_oss
{
- // https://en.cppreference.com/w/cpp/types/endian
- enum class endian
- {
- #ifdef _WIN32
- little = 0,
- big = 1,
- native = little
- #else
- little = __ORDER_LITTLE_ENDIAN__,
- big = __ORDER_BIG_ENDIAN__,
- native = __BYTE_ORDER__
- #endif
- };
+ using std::endian;
+
// https://en.cppreference.com/w/cpp/numeric/byteswap
namespace details
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/cstddef.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/cstddef.h
index 68a7ad5dce..02b5d720b4 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/cstddef.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/cstddef.h
@@ -26,7 +26,7 @@
namespace coda_oss
{
- using byte = std::byte;
+ using std::byte;
}
#endif // CODA_OSS_coda_oss_cstddef_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/namespace_.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/namespace_.h
index a00c3c2c73..5e054a3f4e 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/namespace_.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/namespace_.h
@@ -18,9 +18,9 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
+#pragma once
#ifndef CODA_OSS_coda_oss_namespace__h_INCLUDED_
#define CODA_OSS_coda_oss_namespace__h_INCLUDED_
-#pragma once
namespace coda_oss
{
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h
index f1fab3a0b1..117a3f20c4 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h
@@ -22,34 +22,12 @@
#ifndef CODA_OSS_coda_oss_optional_h_INCLUDED_
#define CODA_OSS_coda_oss_optional_h_INCLUDED_
-#include "coda_oss/CPlusPlus.h"
-
-// This logic needs to be here rather than so that `coda_oss::optional` will
-// be the same as `std::optional`.
-#ifndef CODA_OSS_HAVE_std_optional_
- #define CODA_OSS_HAVE_std_optional_ 0 // assume no
-#endif
-#if CODA_OSS_cpp17 // C++17 for `__has_include()`
- #if __has_include() // __cpp_lib_optional not until C++20
- #include
- #undef CODA_OSS_HAVE_std_optional_
- #define CODA_OSS_HAVE_std_optional_ 1 // provided by the implementation, probably C++17
- #endif
-#endif // CODA_OSS_cpp17
-
-#if !CODA_OSS_HAVE_std_optional_
-#include "coda_oss/optional_.h"
-#endif
+#include
namespace coda_oss
{
- #if CODA_OSS_HAVE_std_optional_
- using std::optional;
- using std::make_optional;
- #else
- using details::optional;
- using details::make_optional;
- #endif
+ using std::optional;
+ using std::make_optional;
}
#endif // CODA_OSS_coda_oss_optional_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h
deleted file mode 100644
index ea9ccf1bc5..0000000000
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h
+++ /dev/null
@@ -1,391 +0,0 @@
-/* =========================================================================
- * This file is part of coda_oss-c++
- * =========================================================================
- *
- * (C) Copyright 2020, Maxar Technologies, Inc.
- *
- * coda_oss-c++ is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; If not, http://www.gnu.org/licenses/.
- *
- */
-
-#pragma once
-#ifndef CODA_OSS_coda_oss_optional__h_INCLUDED_
-#define CODA_OSS_coda_oss_optional__h_INCLUDED_
-
-#include
-
-#include
-#include
-
-// Simple version of std::optional since that doesn't exist until C++17.
-// http://en.cppreference.com/w/cpp/utility/Optional
-
-namespace coda_oss
-{
-namespace details
-{
-inline void throw_bad_optional_access()
-{
- throw std::logic_error("No value for optional<>."); // TODO: std::bad_optional_access
-}
-
-template
-class optional final
-{
- T value_{};
- bool has_value_ = false;
-
- void check_has_value() const
- {
- if (!has_value())
- {
- details::throw_bad_optional_access();
- }
- }
-
-public:
- using value_type = T;
-
- optional() noexcept
- {
- }
- optional(const value_type& v) : value_(v), has_value_(true)
- {
- }
- optional(value_type&& v) : value_(std::move(v)), has_value_(true)
- {
- }
- optional(const optional& other)
- {
- *this = other;
- }
- optional(optional&& other) noexcept
- {
- *this = std::move(other);
- }
- template
- explicit optional(const optional& other)
- {
- *this = other;
- }
- template
- explicit optional(optional&& other)
- {
- *this = std::forward>(other);
- }
- template
- explicit optional(U&& value)
- {
- *this = std::forward(value);
- }
-
- // https://en.cppreference.com/w/cpp/utility/optional/operator%3D
- optional& operator=(const optional& other)
- {
- value_ = other.value_;
- has_value_ = other.has_value_;
- return *this;
- }
- optional& operator=(optional&& other) noexcept
- {
- value_ = std::move(other.value_);
- has_value_ = std::move(other.has_value_);
- return *this;
- }
- template
- optional& operator=(U&& value) noexcept
- {
- value_ = std::forward(value);
- has_value_ = true;
- return *this;
- }
- template
- optional& operator=(const optional& other)
- {
- value_ = other.value_;
- has_value_ = other.has_value_;
- return *this;
- }
- template
- optional& operator=(optional&& other)
- {
- value_ = std::forward>(other.value_);
- has_value_ = other.has_value_;
- return *this;
- }
-
- template // https://en.cppreference.com/w/cpp/utility/Optional/emplace
- T& emplace(Args&&... args)
- {
- value_ = value_type(std::forward(args)...);
- has_value_ = true;
- return value_;
- }
-
- bool has_value() const noexcept
- {
- return has_value_;
- }
- explicit operator bool() const noexcept
- {
- return has_value();
- }
-
- void reset() noexcept
- {
- value_ = T{};
- has_value_ = false;
- }
-
- // https://en.cppreference.com/w/cpp/utility/optional/value
- T& value() &
- {
- check_has_value();
- return value_;
- }
- const T& value() const&
- {
- check_has_value();
- return value_;
- }
- T&& value() &&
- {
- check_has_value();
- return value_;
- }
- const T&& value() const&&
- {
- check_has_value();
- return value_;
- }
-
- // https://en.cppreference.com/w/cpp/utility/optional/operator*
- const T* operator->() const
- {
- assert(has_value());
- return &value_; // "This operator does not check whether the optional contains a value!"
- }
- T* operator->() noexcept
- {
- assert(has_value());
- return &value_; // "This operator does not check whether the optional contains a value!"
- }
- const T& operator*() const& noexcept
- {
- assert(has_value());
- return value_; // "This operator does not check whether the optional contains a value!"
- }
- T& operator*() &
- {
- assert(has_value());
- return value_; // "This operator does not check whether the optional contains a value!"
- }
- const T&& operator*() const&&
- {
- assert(has_value());
- return value_; // "This operator does not check whether the optional contains a value!"
- }
- T&& operator*() &&
- {
- assert(has_value());
- return value_; // "This operator does not check whether the optional contains a value!"
- }
-
- // https://en.cppreference.com/w/cpp/utility/optional/value_or
- template
- T value_or(U&& default_value) const&
- {
- // Equivalent to bool(*this) ? **this :
- // static_cast(std::forward(default_value))
- return has_value() ? **this
- : static_cast(std::forward(default_value));
- }
- template
- T value_or(U&& default_value) &&
- {
- // Equivalent to bool(*this) ? std::move(**this) :
- // static_cast(std::forward(default_value))
- return has_value() ? std::move(**this)
- : static_cast(std::forward(default_value));
- }
-};
-
-// https://en.cppreference.com/w/cpp/utility/optional/make_optional
-template
-inline optional make_optional(TArgs&&... args)
-{
- return optional(T(std::forward(args)...));
-}
-
-// https://en.cppreference.com/w/cpp/utility/optional/operator_cmp
-// Compares two optional objects, lhs and rhs. The contained values are compared
-// (using the corresponding operator of T) only if both lhs and rhs contain
-// values. Otherwise,
-// * lhs is considered equal to rhs if, and only if, both lhs and rhs do not contain a value.
-// * lhs is considered less than rhs if, and only if, rhs contains a value and lhs does not.
-template
-inline bool operator==(const optional& lhs, const optional& rhs)
-{
- // "If bool(lhs) != bool(rhs), returns false."
- if (lhs.has_value() != rhs.has_value())
- {
- return false;
- }
- // "Otherwise, if bool(lhs) == false (and so bool(rhs) == false as well), returns true."
- if (!lhs.has_value())
- {
- assert(!rhs.has_value());
- return true;
- }
- // "Otherwise, returns *lhs == *rhs."
- return *lhs == *rhs;
-}
-template
-inline bool operator==(const T& value, const optional& opt)
-{
- return make_optional(value) == opt;
-}
-template
-inline bool operator==(const optional& opt, const U& value)
-{
- return opt == make_optional(value);
-}
-
-template
-inline bool operator!=(const optional& lhs, const optional& rhs)
-{
- return !(lhs == rhs);
-}
-template
-inline bool operator!=(const T& value, const optional& opt)
-{
- return !(value == opt);
-}
-template
-inline bool operator!=(const optional& opt, const U& value)
-{
- return !(opt == value);
-}
-
-template
-inline bool operator<(const optional& lhs, const optional& rhs)
-{
- // "If bool(rhs) == false returns false."
- if (!rhs.has_value())
- {
- return false;
- }
- // "Otherwise, if bool(lhs) == false, returns true."
- if (!lhs.has_value())
- {
- return true;
- }
- // "Otherwise returns *lhs < *rhs."
- return *lhs < *rhs;
-}
-template
-inline bool operator<(const T& value, const optional& opt)
-{
- return make_optional(value) < opt;
-}
-template
-inline bool operator<(const optional& opt, const U& value)
-{
- return opt < make_optional(value);
-}
-
-template
-inline bool operator<=(const optional& lhs, const optional& rhs)
-{
- // "If bool(lhs) == false returns true."
- if (!lhs.has_value())
- {
- return true;
- }
- // "Otherwise, if bool(rhs) == false, returns false."
- if (!rhs.has_value())
- {
- return false;
- }
- // "Otherwise returns *lhs <= *rhs."
- return *lhs <= *rhs;
-}
-template
-inline bool operator<=(const T& value, const optional& opt)
-{
- return make_optional(value) <= opt;
-}
-template
-inline bool operator<=(const optional& opt, const U& value)
-{
- return opt <= make_optional(value);
-}
-
-template
-inline bool operator>(const optional& lhs, const optional& rhs)
-{
- // "If bool(lhs) == false returns false."
- if (!lhs.has_value())
- {
- return false;
- }
- // "Otherwise, if bool(rhs) == false, returns true."
- if (!rhs.has_value())
- {
- return true;
- }
- // "Otherwise returns *lhs > *rhs."
- return *lhs > *rhs;
-}
-template
-inline bool operator>(const T& value, const optional& opt)
-{
- return make_optional(value) > opt;
-}
-template
-inline bool operator>(const optional& opt, const U& value)
-{
- return opt > make_optional(value);
-}
-
-template
-inline bool operator>=(const optional& lhs, const optional& rhs)
-{
- // "If bool(rhs) == false returns true."
- if (!rhs.has_value())
- {
- return true;
- }
- // "Otherwise, if bool(lhs) == false, returns false."
- if (!lhs.has_value())
- {
- return false;
- }
- // "Otherwise returns *lhs >= *rhs."
- return *lhs >= *rhs;
-}
-template
-inline bool operator>=(const T& value, const optional& opt)
-{
- return make_optional(value) >= opt;
-}
-template
-inline bool operator>=(const optional& opt, const U& value)
-{
- return opt >= make_optional(value);
-}
-}
-}
-
-#endif // CODA_OSS_coda_oss_optional__h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span_.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span_.h
index fa32901d2e..5c378ca33b 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span_.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span_.h
@@ -19,9 +19,9 @@
* see .
*
*/
+#pragma once
#ifndef CODA_OSS_coda_oss_span__h_INCLUDED_
#define CODA_OSS_coda_oss_span__h_INCLUDED_
-#pragma once
#include
#include
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h
index 17f538ca4c..c0cfb913be 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h
@@ -18,7 +18,7 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
-#pragma once
+#pragma once
#ifndef CODA_OSS_coda_oss_type_traits_h_INCLUDED_
#define CODA_OSS_coda_oss_type_traits_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/pch.h b/externals/coda-oss/modules/c++/pch.h
index 7952e6efa2..61c4e158f8 100644
--- a/externals/coda-oss/modules/c++/pch.h
+++ b/externals/coda-oss/modules/c++/pch.h
@@ -98,6 +98,7 @@ CODA_OSS_disable_warning_pop
#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
#pragma warning(disable: 26482) // Only index into arrays using constant expressions (bounds.2).
#pragma warning(disable: 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
+#pragma warning(disable: 26821) // For '...', consider using gsl::span instead of std::span to guarantee runtime bounds safety (gsl.view).
// Yes, these are our files ... but they don't change very often, and if they do
// change we want to rebuild everything anyway.
diff --git a/externals/coda-oss/modules/c++/std/include/std/bit b/externals/coda-oss/modules/c++/std/include/std/bit
index dbcc0b6c5b..a26eecef33 100644
--- a/externals/coda-oss/modules/c++/std/include/std/bit
+++ b/externals/coda-oss/modules/c++/std/include/std/bit
@@ -18,35 +18,15 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
+#pragma once
#ifndef CODA_OSS_std_bit_INCLUDED_
#define CODA_OSS_std_bit_INCLUDED_
-#pragma once
+
+#include
#include "coda_oss/bit.h"
#include "coda_oss/CPlusPlus.h"
-// Make it (too?) easy for clients to get our various std:: implementations
-#ifndef CODA_OSS_NO_std_endian
- #if CODA_OSS_cpp20
- // Some implementations claim to be C++20 w/o
- #if __has_include() // __has_include is C++17
- #include
- #define CODA_OSS_NO_std_endian 1 // provided by implementation, probably C++20
- #endif
- #endif
- // At this point, CODA_OSS_NO_std_endian will be set only if we were able to successfully use (above)
- #ifndef CODA_OSS_NO_std_endian
- #define CODA_OSS_NO_std_endian 0 // <= C++17, use our own
- #endif
-#endif
-
-#if !CODA_OSS_NO_std_endian
-namespace std // This is slightly uncouth: we're not supposed to augment "std".
-{
- using coda_oss::endian;
-}
-#endif // CODA_OSS_NO_std_endian
-
// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_byteswap
#if CODA_OSS_cpp23
diff --git a/externals/coda-oss/modules/c++/std/include/std/cstddef b/externals/coda-oss/modules/c++/std/include/std/cstddef
index 794d21efb6..01bfcdd313 100644
--- a/externals/coda-oss/modules/c++/std/include/std/cstddef
+++ b/externals/coda-oss/modules/c++/std/include/std/cstddef
@@ -18,10 +18,10 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
-#pragma once
+#pragma once
#ifndef CODA_OSS_std_cstddef_INCLUDED_
#define CODA_OSS_std_cstddef_INCLUDED_
#include
-#endif // CODA_OSS_std_cstddef_INCLUDED_
\ No newline at end of file
+#endif // CODA_OSS_std_cstddef_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/std/include/std/filesystem b/externals/coda-oss/modules/c++/std/include/std/filesystem
index 4804550ae2..4003fa0172 100644
--- a/externals/coda-oss/modules/c++/std/include/std/filesystem
+++ b/externals/coda-oss/modules/c++/std/include/std/filesystem
@@ -18,31 +18,11 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
+#pragma once
#ifndef CODA_OSS_std_filesystem_INCLUDED_
#define CODA_OSS_std_filesystem_INCLUDED_
-#pragma once
+#include
#include "sys/filesystem.h"
-#include "coda_oss/CPlusPlus.h"
-
-// Make it (too?) easy for clients to get our various std:: implementations
-#ifndef CODA_OSS_NO_std_filesystem
- #if CODA_OSS_cpp17
- // Some versions of G++ say they're C++17 but don't have
- #if __has_include() // __has_include is C++17
- #include
- #define CODA_OSS_NO_std_filesystem 1 // part of C++17
- #endif
- #else
- #define CODA_OSS_NO_std_filesystem 0 // use our own
- #endif
-#endif
-
-#if !CODA_OSS_NO_std_filesystem
-namespace std // This is slightly uncouth: we're not supposed to augment "std".
-{
- namespace filesystem = coda_oss::filesystem;
-}
-#endif // !CODA_OSS_NO_std_filesystem
#endif // CODA_OSS_std_filesystem_INCLUDED_
\ No newline at end of file
diff --git a/externals/coda-oss/modules/c++/std/include/std/numbers b/externals/coda-oss/modules/c++/std/include/std/numbers
index e089df22b2..95be774129 100644
--- a/externals/coda-oss/modules/c++/std/include/std/numbers
+++ b/externals/coda-oss/modules/c++/std/include/std/numbers
@@ -28,8 +28,11 @@
// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_numbers
#if CODA_OSS_cpp20
- #include
- #define CODA_OSS_NO_std_numbers 1 // provided by implementation, probably C++20
+ // Some versions of G++ say they're C++20 but don't have
+ #if __has_include()
+ #include
+ #define CODA_OSS_NO_std_numbers 1 // provided by implementation, probably C++20
+ #endif
#endif
#ifndef CODA_OSS_NO_std_numbers
#define CODA_OSS_NO_std_numbers 0 // <= C++20, use our own
diff --git a/externals/coda-oss/modules/c++/std/include/std/optional b/externals/coda-oss/modules/c++/std/include/std/optional
index ffbcbca002..7180b20100 100644
--- a/externals/coda-oss/modules/c++/std/include/std/optional
+++ b/externals/coda-oss/modules/c++/std/include/std/optional
@@ -1,10 +1,10 @@
/* =========================================================================
- * This file is part of std-c++
+ * This file is part of sys-c++
* =========================================================================
*
* (C) Copyright 2021, Maxar Technologies, Inc.
*
- * std-c++ is free software; you can redistribute it and/or modify
+ * sys-c++ is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
@@ -18,31 +18,10 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
-#pragma once
+#pragma once
#ifndef CODA_OSS_std_optional_INCLUDED_
#define CODA_OSS_std_optional_INCLUDED_
#include "coda_oss/optional.h"
-// Make it (too?) easy for clients to get our various std:: implementations
-#ifndef CODA_OSS_NO_std_optional
- #if CODA_OSS_HAVE_std_optional_ // set in coda_oss/optional.h
- #define CODA_OSS_NO_std_optional 1 // no need to muck with `std`
- #else
- #define CODA_OSS_NO_std_optional 0 // use our own
- #endif
-#endif
-
-#if !CODA_OSS_NO_std_optional
-namespace std // This is slightly uncouth: we're not supposed to augment "std".
-{
- using coda_oss::optional;
- using coda_oss::make_optional;
-}
-#ifndef __cpp_lib_optional
-#define __cpp_lib_optional 201606L // https://en.cppreference.com/w/cpp/feature_test
-#endif
-
-#endif // !CODA_OSS_NO_std_optional
-
-#endif // CODA_OSS_std_optional_INCLUDED_
\ No newline at end of file
+#endif // CODA_OSS_std_optional_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/std/include/std/span b/externals/coda-oss/modules/c++/std/include/std/span
index 407d7d54f9..bdbb558c40 100644
--- a/externals/coda-oss/modules/c++/std/include/std/span
+++ b/externals/coda-oss/modules/c++/std/include/std/span
@@ -47,4 +47,4 @@ namespace std // This is slightly uncouth: we're not supposed to augment "std".
#endif // CODA_OSS_NO_std_span
-#endif // CODA_OSS_std_span_INCLUDED_
\ No newline at end of file
+#endif // CODA_OSS_std_span_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/sys/include/sys/filesystem.h b/externals/coda-oss/modules/c++/sys/include/sys/filesystem.h
index a42a40e1e5..479532f238 100644
--- a/externals/coda-oss/modules/c++/sys/include/sys/filesystem.h
+++ b/externals/coda-oss/modules/c++/sys/include/sys/filesystem.h
@@ -18,47 +18,30 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
+#pragma once
#ifndef CODA_OSS_sys_filesystem_h_INCLUDED_
#define CODA_OSS_sys_filesystem_h_INCLUDED_
-#pragma once
+
+#include
// always implement sys::filesystem::path
#include "sys/sys_filesystem.h"
-#include "sys/CPlusPlus.h"
-#if CODA_OSS_cpp17
- // Some versions of G++ say they're C++17 but don't have
- #if __has_include() // __has_include is C++17
- #include
- #define CODA_OSS_has_std_filesystem_ 1
- #endif
-#else
- #define CODA_OSS_has_std_filesystem_ 0
-#endif
-
+#include "coda_oss/namespace_.h"
namespace coda_oss
{
- // Allow coda_oss::filesystem to compile; used in .h files
- namespace filesystem
- {
- #if CODA_OSS_has_std_filesystem_
- #define CODA_OSS_coda_oss_filesystem_impl_ std
- #else
- #define CODA_OSS_coda_oss_filesystem_impl_ sys
- #endif
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::file_type;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::path;
+namespace filesystem
+{
+
+using std::filesystem::path;
+using std::filesystem::file_type;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::absolute;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::create_directory;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::current_path;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::remove;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::temp_directory_path;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::is_regular_file;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::is_directory;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::exists;
- using CODA_OSS_coda_oss_filesystem_impl_::filesystem::file_size;
- }
+using std::filesystem::current_path;
+using std::filesystem::exists;
+using std::filesystem::is_directory;
+using std::filesystem::is_regular_file;
+
+}
}
#endif // CODA_OSS_sys_filesystem_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h b/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h
index 59df476a5d..37bd740a28 100644
--- a/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h
+++ b/externals/coda-oss/modules/c++/sys/include/sys/sys_filesystem.h
@@ -22,129 +22,24 @@
#define CODA_OSS_sys_sys_filesystem_h_INCLUDED_
#pragma once
-//
-// For now, these are just some wrappers around the CODA-OSS routines ...
-// eventually, this should be replaced with C++17's .
-//
-// This does not even TRY to be a complete implementation of std::filesystem.
-//
+#include
-#include
-#include
-#include
-
-#include "sys/CPlusPlus.h"
-#include "coda_oss/namespace_.h" // get something in the "coda_oss" namespace
-#include "config/Exports.h"
-
-namespace sys // should be in coda_oss/, but implementation needs sys::Path
-{
-// http://en.cppreference.com/w/cpp/filesystem
-namespace filesystem // not "Filesystem", make it easy to use code in other namespaces
+namespace sys
{
- struct path; // forward
- namespace details
- {
- CODA_OSS_API bool Equals(const path& lhs, const path& rhs) noexcept;
- CODA_OSS_API std::ostream& Ostream(std::ostream& os, const path& p);
- }
-
- // https://en.cppreference.com/w/cpp/filesystem/file_type
- enum class file_type // match C++17 spelling for easier transition from our C++11 work-around
- {
- none = 0,
- not_found = 1,
- regular,
- directory,
- unknown
- };
-
-// http://en.cppreference.com/w/cpp/filesystem/path
-struct CODA_OSS_API path final // N.B. this is an INCOMPLETE and NON-STANDARD implementation!
+namespace filesystem
{
- // character type used by the native encoding of the filesystem: char on POSIX, wchar_t on Windows
- #ifdef _WIN32
- using value_type = wchar_t;
- #else
- using value_type = char;
- #endif
- using string_type = std::basic_string;
-
- // http://en.cppreference.com/w/cpp/filesystem/path/path
- path() noexcept;
- path(const path&);
- path(const string_type&);
- template
- path(const TSource& source)
- {
- *this = source;
- }
-
- path& operator=(const path&) = default;
- path& operator=(path&&) = default;
- template
- path& operator=(const TSource& source)
- {
- p_ = to_native(source);
- return *this;
- }
-
- path& operator/=(const path&); // http://en.cppreference.com/w/cpp/filesystem/path/append
- template
- path& operator/=(const TSource& source) // http://en.cppreference.com/w/cpp/filesystem/path/append
- {
- return (*this) /= path(to_native(source));
- }
- void clear() noexcept; // http://en.cppreference.com/w/cpp/filesystem/path/clear
-
- // http://en.cppreference.com/w/cpp/filesystem/path/native
- const value_type* c_str() const noexcept;
- const string_type& native() const noexcept;
- operator string_type() const;
-
- std::string string() const; // http://en.cppreference.com/w/cpp/filesystem/path/string
-
- path root_path() const; // https://en.cppreference.com/w/cpp/filesystem/path/root_path
- path parent_path() const; // http://en.cppreference.com/w/cpp/filesystem/path/parent_path
- path filename() const; // http://en.cppreference.com/w/cpp/filesystem/path/filename
- path stem() const; // http://en.cppreference.com/w/cpp/filesystem/path/stem
- path extension() const; // https://en.cppreference.com/w/cpp/filesystem/path/extension
-
- bool empty() const noexcept; // http://en.cppreference.com/w/cpp/filesystem/path/empty
- bool is_absolute() const; // http://en.cppreference.com/w/cpp/filesystem/path/is_absrel
- bool is_relative() const; // http://en.cppreference.com/w/cpp/filesystem/path/is_absrel
-
- CODA_OSS_API friend bool operator==(const path& lhs, const path& rhs) noexcept // https://en.cppreference.com/w/cpp/filesystem/path/operator_cmp
- {
- return details::Equals(lhs, rhs);
- }
- CODA_OSS_API friend bool operator!=(const path& lhs, const path& rhs) noexcept // https://en.cppreference.com/w/cpp/filesystem/path/operator_cmp
- {
- return !(lhs == rhs);
- }
- CODA_OSS_API friend std::ostream& operator<<(std::ostream& os, const path& p) // https://en.cppreference.com/w/cpp/filesystem/path/operator_ltltgtgt
- {
- return details::Ostream(os, p);
- }
-
-private:
- string_type p_;
- static string_type to_native(const std::string& s);
-};
-
-CODA_OSS_API path operator/(const path& lhs, const path& rhs); // http://en.cppreference.com/w/cpp/filesystem/path/operator_slash
-
-CODA_OSS_API path absolute(const path&); // http://en.cppreference.com/w/cpp/filesystem/absolute
-CODA_OSS_API bool create_directory(const path&); // https://en.cppreference.com/w/cpp/filesystem/create_directory
-CODA_OSS_API path current_path(); // https://en.cppreference.com/w/cpp/filesystem/current_path
-CODA_OSS_API bool remove(const path& p); // https://en.cppreference.com/w/cpp/filesystem/remove
-CODA_OSS_API path temp_directory_path(); // https://en.cppreference.com/w/cpp/filesystem/temp_directory_path
-
-CODA_OSS_API bool is_regular_file(const path& p); // https://en.cppreference.com/w/cpp/filesystem/is_regular_file
-CODA_OSS_API bool is_directory(const path& p); // https://en.cppreference.com/w/cpp/filesystem/is_directory
-CODA_OSS_API bool exists(const path& p); // https://en.cppreference.com/w/cpp/filesystem/exists
-CODA_OSS_API std::uintmax_t file_size(const path& p); // https://en.cppreference.com/w/cpp/filesystem/file_size
-
+ using std::filesystem::file_type;
+ using std::filesystem::path;
+
+ using std::filesystem::absolute;
+ using std::filesystem::create_directory;
+ using std::filesystem::current_path;
+ using std::filesystem::exists;
+ using std::filesystem::is_directory;
+ using std::filesystem::is_regular_file;
+ using std::filesystem::remove;
+ using std::filesystem::temp_directory_path;
+ using std::filesystem::file_size;
}
}
diff --git a/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp b/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp
index fb3126f735..8d91933a71 100644
--- a/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp
+++ b/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp
@@ -1,306 +1 @@
#include "sys/sys_filesystem.h"
-
-#include
-#ifdef _WIN32
-#include
-#else
-#include
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "sys/Path.h"
-#include "gsl/gsl.h"
-
-namespace fs = sys::filesystem;
-
-static inline std::string strerror_(int errnum)
-{
-#ifdef _MSC_VER
- std::array errmsg;
- strerror_s(errmsg.data(), errmsg.size(), errnum);
- return errmsg.data();
-#else
- return ::strerror(errnum);
-#endif
-}
-
-static inline std::string make_what(const char* curfile, const int lineNum, const std::string& msg)
-{
- std::ostringstream what;
- what << "ERROR: " << curfile << ", Line " << lineNum << ": " << msg;
- return what.str();
-}
-static inline std::string make_what(const char* curfile, const int lineNum, const std::ostringstream& msg)
-{
- return make_what(curfile, lineNum, msg.str());
-}
-// A macro for conveniently throwing errors.
-// Need "throw" to be visible, not hidden inside of a function, so that code-analysis tools can see it.
-#define CODA_OSS_sys_filesystem_THROW_ERR(MSG) throw std::runtime_error(make_what(__FILE__, __LINE__, MSG)) // TODO: std::filesystem_error
-
-fs::path::string_type fs::path::to_native(const std::string& s_)
-{
-
-#ifdef _WIN32
- return str::details::to_wstring(s_);
-#else
- return s_;
-#endif
-}
-
-fs::path::path() noexcept
-{
-}
-fs::path::path(const path& p) : p_(p.native())
-{
-}
-fs::path::path(const string_type& p) : p_(p)
-{
-}
-
-fs::path& fs::path::operator/=(const path& p)
-{
- // https://en.cppreference.com/w/cpp/filesystem/path/append
-
- if (p.is_absolute()) // || (p.has_root_name() && p.root_name() != root_name())
- {
- p_ = p.native(); // "If p.is_absolute() ... replaces the current path with p ..."
- }
- else
- {
- // TODO: there is more to do here ... see http://en.cppreference.com/w/cpp/filesystem/path/append
- p_ = to_native(sys::Path::joinPaths(string(), p.string()));
- }
-
- return *this;
-}
-
-void fs::path::clear() noexcept
-{
- p_.clear();
-}
-
-const fs::path::value_type* fs::path::c_str() const noexcept
-{
- return native().c_str();
-}
-
-const fs::path::string_type& fs::path::native() const noexcept
-{
- return p_;
-}
-
-fs::path::operator string_type() const
-{
- return native();
-}
-
-std::string fs::path::string() const
-{
- return str::details::to_string(p_);
-}
-
-fs::path fs::path::root_path() const
-{
- return parent_path() / stem();
-}
-
-fs::path fs::path::parent_path() const
-{
- return sys::Path::splitPath(string()).first;
-}
-
-fs::path fs::path::filename() const
-{
- return sys::Path::basename(string(), false /*rmvExt*/);
-}
-
-fs::path fs::path::stem() const
-{
- return sys::Path::basename(string(), true /*rmvExt*/);
-}
-
-fs::path fs::path::extension() const
-{
- // https://en.cppreference.com/w/cpp/filesystem/path/extension
-
- // "If the pathname is either . or .., ... then empty path is returned."
- const auto pathname = string();
- if ((pathname == ".") || (pathname == ".."))
- {
- return fs::path();
- }
-
- auto fn = filename().string();
- const auto dot = fn.find(".");
-
- // "If ... filename() does not contain the . character, then empty path is returned."
- if (dot == std::string::npos)
- {
- return fs::path();
- }
-
- // "If the first character in the filename is a period, that period is ignored
- // (a filename like '.profile' is not treated as an extension)"
- if (dot == 0)
- {
- fn = fn.substr(1);
- }
-
- return sys::Path::splitExt(fn).second;
-}
-
-bool fs::path::empty() const noexcept
-{
- return native().empty();
-}
-
-bool fs::path::is_absolute() const
-{
- return sys::Path::isAbsolutePath(string());
-}
-bool fs::path::is_relative() const
-{
- return !is_absolute(); // "... the other way round." http://en.cppreference.com/w/cpp/filesystem/path/is_absrel
-}
-
-fs::path fs::operator/(const fs::path& lhs, const fs::path& rhs)
-{
- return fs::path(lhs) /= rhs; // "... returns path(lhs) /= rhs." http://en.cppreference.com/w/cpp/filesystem/path/operator_slash
-}
-
-fs::path fs::absolute(const path& p)
-{
- return sys::Path::absolutePath(p.string());
-}
-
-fs::path fs::temp_directory_path()
-{
- // https://en.cppreference.com/w/cpp/filesystem/temp_directory_path
- //
- // On POSIX systems, the path may be the one specified in the environment variables TMPDIR, TMP, TEMP, TEMPDIR, and, if none of them are
- // specified, the path "/tmp" is returned.
- //
- // On Windows systems, the path is typically the one returned by GetTempPath
-#if defined(_WIN32)
-
- // https://msdn.microsoft.com/en-us/library/b0084kay.aspx
- // "_WIN32 Defined as 1 when the compilation target is 32 - bit ARM, 64 - bit ARM, x86, or x64.Otherwise, undefined."
-
- // https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-gettemppatha
- std::array buf; // "The maximum possible return value is MAX_PATH+1 (261)."
- const auto result = GetTempPathA(static_cast(buf.size()), buf.data());
- if (result == 0) // "If the function fails, the return value is zero"
- {
- CODA_OSS_sys_filesystem_THROW_ERR("GetTempPathA() failed.");
- }
-
- return buf.data();
-
-#else // assume Linux
-
- // https://stackoverflow.com/questions/31068/how-do-i-find-the-temp-directory-in-linux
- const std::vector tmpdirs{"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
- for (const auto& dir : tmpdirs)
- {
- if (auto result = getenv(dir))
- {
- return result;
- }
- }
-
- return "/tmp";
-#endif
-}
-
-bool fs::create_directory(const path& p_)
-{
- const sys::OS os;
- const auto p = p_.string();
- const bool created = os.makeDirectory(p);
- if (created)
- {
- // If it exists, see if it's a file
- if (os.isFile(p))
- {
- const std::string stat_failed("stat failed: " + p);
- const std::string error("Error:\n" + strerror_(errno));
- CODA_OSS_sys_filesystem_THROW_ERR(stat_failed + "\n" + error);
- }
- else if (!os.isDirectory(p))
- {
- std::stringstream ss;
- ss << "Path '" << p << "' exists and is not a directory.";
- CODA_OSS_sys_filesystem_THROW_ERR(ss.str());
- }
-
- // If we got here, the path exists and is a directory, which is what we want
- }
- return created;
-}
-
-bool fs::is_regular_file(const path& p)
-{
- const sys::OS os;
- return os.isFile(p.string());
-}
-
-bool fs::is_directory(const path& p)
-{
- const sys::OS os;
- return os.isDirectory(p.string());
-}
-
-bool fs::exists(const path& p)
-{
- const sys::OS os;
- return os.exists(p.string());
-}
-
-bool fs::remove(const path& p_)
-{
- // https://en.cppreference.com/w/cpp/io/c/remove
- const auto p = p_.string();
- return ::remove(p.c_str()) == 0; // "0 upon success or non-zero value on error."
-}
-
-fs::path fs::current_path()
-{
- // https://en.cppreference.com/w/cpp/filesystem/current_path
-
- // https://stackoverflow.com/questions/2203159/is-there-a-c-equivalent-to-getcwd
- char temp[1024];
- return
-#ifdef _WIN32
- _getcwd
-#else
- getcwd
-#endif
- (temp, sizeof(temp))
- ? std::string(temp)
- : std::string();
-}
-
-std::uintmax_t fs::file_size(const fs::path& p)
-{
- const sys::Path path(p.string());
- return gsl::narrow (path.length());
-}
-
-bool fs::details::Equals(const path& lhs, const path& rhs) noexcept
-{
- return sys::Path::normalizePath(lhs.string()) == sys::Path::normalizePath(rhs.string());
-}
-
-std::ostream& fs::details::Ostream(std::ostream& os, const path& p)
-{
- // https://en.cppreference.com/w/cpp/filesystem/path/operator_ltltgtgt
- os << "\"" << p.string() << "\"";
- return os;
-}
diff --git a/externals/coda-oss/test_package/CMakeLists.txt b/externals/coda-oss/test_package/CMakeLists.txt
index be886e92a6..f3c77f2c94 100644
--- a/externals/coda-oss/test_package/CMakeLists.txt
+++ b/externals/coda-oss/test_package/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14)
project(coda-oss-test_package)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED true)
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
diff --git a/modules/c++/CMakeLists.txt b/modules/c++/CMakeLists.txt
index 6b60cd28f5..018d321933 100644
--- a/modules/c++/CMakeLists.txt
+++ b/modules/c++/CMakeLists.txt
@@ -1,6 +1,5 @@
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.
diff --git a/modules/c++/nitf-c++.vcxproj b/modules/c++/nitf-c++.vcxproj
index 7e669fcc85..fdd83e20d4 100644
--- a/modules/c++/nitf-c++.vcxproj
+++ b/modules/c++/nitf-c++.vcxproj
@@ -234,8 +234,8 @@
true
MultiThreadedDebugDLL
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
@@ -266,8 +266,8 @@
Level3
AdvancedVectorExtensions2
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
diff --git a/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj b/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj
index c4ebcd8314..b95751999f 100644
--- a/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj
+++ b/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj
@@ -66,8 +66,8 @@
AdvancedVectorExtensions2
true
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
@@ -94,8 +94,8 @@
Level3
AdvancedVectorExtensions2
true
- stdcpp17
- stdc11
+ stdcpp20
+ stdc17
true
diff --git a/sync_externals.csh b/sync_externals.csh
index 3e8a32927e..2f042f6c7b 100755
--- a/sync_externals.csh
+++ b/sync_externals.csh
@@ -14,7 +14,7 @@ git remote add -f coda-oss_remote git@github.com:mdaus/coda-oss.git
# Now we just want to update
# Here I'm assuming you're running this on the master branch... otherwise the push command should change
-git subtree pull --prefix externals/coda-oss coda-oss_remote cpp17 --squash
+git subtree pull --prefix externals/coda-oss coda-oss_remote cpp20 --squash
# If when you do this command you git a merge conflict because a file that has been removed here has been updated in CODA-OSS, you just need to do a 'git rm ' to resolve the merge conflict. Then a 'git commit'.
# TODO: Make this script smart enough to do this.