mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-05 21:24:27 +02:00
Merge branch 'master' of github.com:mpusz/units
This commit is contained in:
@@ -49,10 +49,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
find_package(range-v3)
|
||||
target_link_libraries(mp-units-core INTERFACE range-v3::range-v3)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(mp-units-core INTERFACE
|
||||
-Wno-non-template-friend
|
||||
)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(mp-units-core INTERFACE
|
||||
/utf-8 # Specifies both the source character set and the execution character set as UTF-8
|
||||
|
@@ -38,8 +38,11 @@ namespace units {
|
||||
template<typename BaseType>
|
||||
struct downcast_base {
|
||||
using downcast_base_type = BaseType;
|
||||
UNITS_DIAGNOSTIC_PUSH
|
||||
UNITS_DIAGNOSTIC_IGNORE_NON_TEMPLATE_FRIEND
|
||||
friend auto downcast_guide(downcast_base);
|
||||
friend auto downcast_poison_pill(downcast_base);
|
||||
UNITS_DIAGNOSTIC_POP
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
20
src/core/include/units/bits/external/hacks.h
vendored
20
src/core/include/units/bits/external/hacks.h
vendored
@@ -31,6 +31,26 @@
|
||||
#define UNITS_COMP_MSVC _MSC_VER
|
||||
#endif
|
||||
|
||||
// Adapted from https://github.com/ericniebler/range-v3/blob/master/include/range/v3/detail/config.hpp#L185.
|
||||
#define UNITS_PRAGMA(X) _Pragma(#X)
|
||||
#if !UNITS_COMP_MSVC
|
||||
#define UNITS_DIAGNOSTIC_PUSH UNITS_PRAGMA(GCC diagnostic push)
|
||||
#define UNITS_DIAGNOSTIC_POP UNITS_PRAGMA(GCC diagnostic pop)
|
||||
#define UNITS_DIAGNOSTIC_IGNORE_PRAGMAS UNITS_PRAGMA(GCC diagnostic ignored "-Wpragmas")
|
||||
#define UNITS_DIAGNOSTIC_IGNORE(X) \
|
||||
UNITS_DIAGNOSTIC_IGNORE_PRAGMAS \
|
||||
UNITS_PRAGMA(GCC diagnostic ignored "-Wunknown-pragmas") \
|
||||
UNITS_PRAGMA(GCC diagnostic ignored "-Wunknown-warning-option") \
|
||||
UNITS_PRAGMA(GCC diagnostic ignored X)
|
||||
#define UNITS_DIAGNOSTIC_IGNORE_NON_TEMPLATE_FRIEND UNITS_DIAGNOSTIC_IGNORE("-Wnon-template-friend")
|
||||
#else
|
||||
#define UNITS_DIAGNOSTIC_PUSH UNITS_PRAGMA(warning(push))
|
||||
#define UNITS_DIAGNOSTIC_POP UNITS_PRAGMA(warning(pop))
|
||||
#define UNITS_DIAGNOSTIC_IGNORE_PRAGMAS UNITS_PRAGMA(warning(disable : 4068))
|
||||
#define UNITS_DIAGNOSTIC_IGNORE(X) UNITS_DIAGNOSTIC_IGNORE_PRAGMAS UNITS_PRAGMA(warning(disable : X))
|
||||
#define UNITS_DIAGNOSTIC_IGNORE_NON_TEMPLATE_FRIEND
|
||||
#endif
|
||||
|
||||
#if UNITS_COMP_CLANG
|
||||
|
||||
#include <ciso646>
|
||||
|
Reference in New Issue
Block a user