Skip to content

Commit

Permalink
Squashed 'externals/coda-oss/' changes from 1582c6ac9..986307c9c
Browse files Browse the repository at this point in the history
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 "<filesystem> is in C++17"
0fe38c16f restore recent buld.py changes
0c75411ee <filesystem> 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: 986307c9c05f6b341e78245d220115fabe5b2fdb
  • Loading branch information
Dan Smith authored and Dan Smith committed Jan 3, 2023
1 parent 7548f8d commit 4ac75b8
Show file tree
Hide file tree
Showing 24 changed files with 142 additions and 31 deletions.
7 changes: 5 additions & 2 deletions build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,11 @@ def configureCompilerOptions(self):
# The "fastest-possible" option is new; see comments above.
config['cxx']['optz_fastest-possible'] = [ config['cxx']['optz_fastest'], '-march=native' ]

self.env.append_value('CXXFLAGS', '-fPIC'.split())
if not Options.options.enablecpp17:
gxxCompileFlags='-fPIC -std=c++14'
gxxCompileFlags='-std=c++14'
else:
gxxCompileFlags='-fPIC -std=c++17'
gxxCompileFlags='-std=c++17'
self.env.append_value('CXXFLAGS', gxxCompileFlags.split())

# DEFINES and LINKFLAGS will apply to both gcc and g++
Expand Down Expand Up @@ -952,6 +953,8 @@ def configureCompilerOptions(self):
config['cc']['optz_fastest-possible'] = [ config['cc']['optz_fastest'], '-march=native' ]

self.env.append_value('CFLAGS', '-fPIC'.split())
# "gnu99" enables POSIX and BSD
self.env.append_value('CFLAGS', '-std=gnu99'.split())

elif re.match(winRegex, sys_platform):
crtFlag = '/%s' % Options.options.crt
Expand Down
18 changes: 16 additions & 2 deletions modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,28 @@

#if defined(__GNUC__)
#endif // __GNUC__

#if defined(__INTEL_COMPILER)
#endif // __INTEL_COMPILER
#endif // CODA_OSS_cplusplus

#if CODA_OSS_cplusplus < 201402L
// oops ... try to fix
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER_BUILD_DATE >= 20151021)
// __cplusplus is 201300, not 201402L
// Enough C++14, at least with our std/ work-arounds
#undef CODA_OSS_cplusplus
#define CODA_OSS_cplusplus 201402L
#endif
#endif // CODA_OSS_cplusplus

#if CODA_OSS_cplusplus < 202002L
// oops ... try to fix
#if defined(__GNUC__) && (__cplusplus >= 201709L) // note > C++ 17 of 201703L
#if defined(__GNUC__) && (__cplusplus >= 201709L) // note > C++ 17 of 201703L
// Enough C++20 for our needs
#undef CODA_OSS_cplusplus
#define CODA_OSS_cplusplus 202002L
#endif
#endif
#endif // CODA_OSS_cplusplus

// Define a few macros as that's less verbose than testing against a version number
Expand Down
37 changes: 37 additions & 0 deletions modules/c++/coda_oss/include/coda_oss/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,42 @@
#pragma once

#include <memory>
#include <type_traits>
#include <utility>

#include "config/compiler_extensions.h"

#include "coda_oss/namespace_.h"
namespace coda_oss
{
// C++11 inadvertently ommitted make_unique; provide it here. (Swiped from <memory>.)
template <typename T, typename... TArgs, typename std::enable_if<!std::is_array<T>::value, int>::type = 0>
std::unique_ptr<T> make_unique(TArgs&&... args)
{
CODA_OSS_disable_warning_push
#if _MSC_VER
#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r .11).
#endif
return std::unique_ptr<T>(new T(std::forward<TArgs>(args)...));
CODA_OSS_disable_warning_pop
}

template <typename T, typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0, int>::type = 0>
std::unique_ptr<T> make_unique(size_t size)
{
using element_t = typename std::remove_extent<T>::type;

CODA_OSS_disable_warning_push
#if _MSC_VER
#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r .11).
#endif
return std::unique_ptr<T>(new element_t[size]());
CODA_OSS_disable_warning_pop
}

template <typename T, typename... TArgs, typename std::enable_if<std::extent<T>::value != 0, int>::type = 0>
void make_unique(TArgs&&...) = delete;

} // namespace coda_oss

#endif // CODA_OSS_coda_oss_memory_h_INCLUDED_
19 changes: 19 additions & 0 deletions modules/c++/coda_oss/include/coda_oss/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,23 @@

#include <type_traits>

#include "CPlusPlus.h"

#include "coda_oss/namespace_.h"
namespace coda_oss
{
// workaround missing "is_trivially_copyable" in g++ < 5.0
// https://stackoverflow.com/a/31798726/8877
#if defined(__GNUC__) && (__GNUC__ < 5)
template <typename T>
struct is_trivially_copyable final
{
static_assert(CODA_OSS_cplusplus < 201402L, "C++14 must have is_trivially_copyable.");
static constexpr bool value = __has_trivial_copy(T);
};
#else
using std::is_trivially_copyable;
#endif
}

#endif // CODA_OSS_coda_oss_type_traits_h_INCLUDED_
2 changes: 1 addition & 1 deletion modules/c++/io/include/io/PipeStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef __IO_PIPE_STREAM_H__
#define __IO_PIPE_STREAM_H__

#include <memory>
#include <std/memory>

#include <import/except.h>
#include <str/Convert.h>
Expand Down
2 changes: 2 additions & 0 deletions modules/c++/logging/include/logging/FileHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include <string>
#include <iostream>
#include <std/memory>

#include "logging/LogRecord.h"
#include "logging/StreamHandler.h"
#include <import/io.h>
Expand Down
2 changes: 1 addition & 1 deletion modules/c++/math.linear/include/math/linear/Matrix2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <cmath>
#include <algorithm>
#include <functional>
#include <memory>
#include <std/memory>
#include <cstddef>

#include <import/sys.h>
Expand Down
2 changes: 1 addition & 1 deletion modules/c++/mem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(MODULE_NAME mem)
coda_add_module(
${MODULE_NAME}
VERSION 1.0
DEPS sys-c++ gsl-c++)
DEPS sys-c++ gsl-c++ std-c++)

coda_add_tests(
MODULE_NAME ${MODULE_NAME}
Expand Down
2 changes: 1 addition & 1 deletion modules/c++/mem/include/mem/ScopedPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#pragma once

#include <cstddef>
#include <memory>
#include <std/memory>
#include <type_traits>

#include "sys/Conf.h"
Expand Down
2 changes: 1 addition & 1 deletion modules/c++/mt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ coda_generate_module_config_header(${MODULE_NAME})
coda_add_module(
${MODULE_NAME}
VERSION 1.1
DEPS sys-c++ except-c++ math-c++ mem-c++ types-c++)
DEPS sys-c++ except-c++ math-c++ mem-c++ types-c++ std-c++)

coda_add_tests(
MODULE_NAME ${MODULE_NAME}
Expand Down
2 changes: 1 addition & 1 deletion modules/c++/mt/include/mt/BasicThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define __MT_BASIC_THREAD_POOL_H__

#include <vector>
#include <memory>
#include <std/memory>

#include "except/Exception.h"
#include "sys/Mutex.h"
Expand Down
1 change: 1 addition & 0 deletions modules/c++/mt/include/mt/Singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define __MT_SINGLETON_H__

#include <mutex>
#include <std/memory>

#include <import/sys.h>
#include <config/compiler_extensions.h>
Expand Down
3 changes: 1 addition & 2 deletions modules/c++/mt/wscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
NAME = 'mt'
MAINTAINER = '[email protected]'
VERSION = '1.1'
MODULE_DEPS = 'sys except math mem types'
MODULE_DEPS = 'sys except math mem types std'
TEST_DEPS = 'cli'

distclean = lambda p: None
Expand Down
5 changes: 3 additions & 2 deletions modules/c++/std/include/std/bit
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
#define CODA_OSS_std_bit_INCLUDED_
#pragma once

#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
#include "coda_oss/CPlusPlus.h"
#if CODA_OSS_cpp20
// Some implementations cliam to be C++20 w/o <bit>
#if __has_include(<bit>) // __has_include is C++17
Expand All @@ -34,7 +36,6 @@
#endif
// At this point, CODA_OSS_NO_std_endian will be set only if we were able to successfully use <bit> (above)
#ifndef CODA_OSS_NO_std_endian
#include "coda_oss/bit.h"
#define CODA_OSS_NO_std_endian 0 // <= C++17, use our own
#endif
#endif
Expand Down
3 changes: 2 additions & 1 deletion modules/c++/std/include/std/cstddef
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
#pragma once

#include <cstddef>
#include "coda_oss/cstddef.h"
#include "coda_oss/CPlusPlus.h"

// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_byte
#if defined(__cpp_lib_byte) && (__cpp_lib_byte >= 201603L) // https://en.cppreference.com/w/cpp/utility/feature_test
#undef CODA_OSS_NO_std_byte
#define CODA_OSS_NO_std_byte 1 // provided by implementation, probably C++20
#else
#include "coda_oss/cstddef.h"
#define CODA_OSS_NO_std_byte 0 // use our own
#endif
#endif
Expand Down
5 changes: 3 additions & 2 deletions modules/c++/std/include/std/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@
#define CODA_OSS_std_filesystem_INCLUDED_
#pragma once

#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
#include "coda_oss/CPlusPlus.h"
#if CODA_OSS_cpp17
// Some versions of G++ say they're C++17 but don't have <filesystem>
#if __has_include(<filesystem>) // __has_include is C++17
#include <filesystem>
#define CODA_OSS_NO_std_filesystem 1 // part of C++17
#endif
#else
#include "sys/filesystem.h"
#define CODA_OSS_NO_std_filesystem 0 // use our own
#endif
#endif
Expand Down
19 changes: 18 additions & 1 deletion modules/c++/std/include/std/memory
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,24 @@
#define CODA_OSS_std_memory_INCLUDED_
#pragma once

#include "coda_oss/CPlusPlus.h"
#include <memory>
#include "coda_oss/memory.h"
#include "coda_oss/CPlusPlus.h"

// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_make_unique
#if CODA_OSS_cpp14
#define CODA_OSS_NO_std_make_unique 1 // part of C++14
#else
#define CODA_OSS_NO_std_make_unique 0 // use our own
#endif
#endif

#if !CODA_OSS_NO_std_make_unique
namespace std // This is slightly uncouth: we're not supposed to augment "std".
{
using coda_oss::make_unique;
}
#endif // !CODA_OSS_NO_std_make_unique

#endif // CODA_OSS_std_memory_INCLUDED_
5 changes: 3 additions & 2 deletions modules/c++/std/include/std/optional
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
#define CODA_OSS_std_optional_INCLUDED_
#pragma once

#include "coda_oss/optional.h"
#include "coda_oss/CPlusPlus.h"

// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_optional
#include "coda_oss/CPlusPlus.h"
#if CODA_OSS_cpp17
#include <optional>
#define CODA_OSS_NO_std_optional 1 // part of C++17
#else
#include "coda_oss/optional.h"
#define CODA_OSS_NO_std_optional 0 // use our own
#endif
#endif
Expand Down
5 changes: 3 additions & 2 deletions modules/c++/std/include/std/span
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
#define CODA_OSS_std_span_INCLUDED_
#pragma once

#include "coda_oss/span.h"
#include "coda_oss/CPlusPlus.h"

// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_span
#include "coda_oss/CPlusPlus.h"
#if CODA_OSS_cpp20
#include <span>
#define CODA_OSS_NO_std_span 1 // part of C++20
#else
#include "coda_oss/span.h"
#define CODA_OSS_NO_std_span 0 // use our own
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions modules/c++/std/include/std/string
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#pragma once

#include <string>
#include "coda_oss/string.h"
#include "coda_oss/CPlusPlus.h"

// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_std_u8string
#include "coda_oss/CPlusPlus.h"
#if CODA_OSS_cpp20
#define CODA_OSS_NO_std_u8string 1 // part of C++20
#else
#include "coda_oss/string.h"
#define CODA_OSS_NO_std_u8string 0 // use our own
#endif
#endif
Expand Down
20 changes: 19 additions & 1 deletion modules/c++/std/include/std/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,26 @@
#define CODA_OSS_std_type_traits_INCLUDED_
#pragma once

#include "coda_oss/CPlusPlus.h"
#include <type_traits>
#include "coda_oss/type_traits.h"

// Make it (too?) easy for clients to get our various std:: implementations
#ifndef CODA_OSS_NO_is_trivially_copyable
// https://stackoverflow.com/a/31798726/8877
// workaround missing "is_trivially_copyable" in g++ < 5.0
#if defined(__GNUC__) && (__GNUC__ < 5)
#define CODA_OSS_NO_is_trivially_copyable 0 // *need* our own
#else
#define CODA_OSS_NO_is_trivially_copyable 1 // *disabled*, unless explicitly enabled
#endif
#endif

#if !CODA_OSS_NO_is_trivially_copyable
namespace std // This is slightly uncouth: we're not supposed to augment "std".
{
using coda_oss::is_trivially_copyable;
}
#endif // CODA_OSS_NO_is_trivially_copyable

#endif // CODA_OSS_std_type_traits_INCLUDED_

1 change: 1 addition & 0 deletions modules/c++/xml.lite/include/xml/lite/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <assert.h>

#include <utility>
#include <std/memory>
#include "coda_oss/string.h"
#include "coda_oss/memory.h"

Expand Down
2 changes: 1 addition & 1 deletion modules/c++/xml.lite/include/xml/lite/MinidomHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/

#include <stack>
#include <memory>
#include <std/memory>
#include "coda_oss/string.h"
#include "coda_oss/memory.h"

Expand Down
5 changes: 0 additions & 5 deletions modules/c++/xml.lite/source/ValidatorXerces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,9 @@ inline void reset(str::EncodedStringView xmlView, std::unique_ptr<std::wstring>&
pWString = std::make_unique<std::wstring>(xmlView.wstring());
}
#else
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER_BUILD_DATE < 20190815)
using XMLCh_t = uint16_t;
static_assert(std::is_same<::XMLCh, XMLCh_t>::value, "XMLCh should be uint16_t");
#else
using XMLCh_t = char16_t;
static_assert(std::is_same<::XMLCh, XMLCh_t>::value, "XMLCh should be char16_t");
#endif
#endif

inline void reset(str::EncodedStringView xmlView, std::unique_ptr<std::u16string>& pWString)
{
Expand Down

0 comments on commit 4ac75b8

Please sign in to comment.