Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d00fd91d8d28
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fb453d776902
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jul 7, 2021

  1. Copy the full SHA
    b767055 View commit details
  2. Merge pull request #3055 from eggrobin/constexpr-overflow

    Strange clang version numbers on macintosh
    eggrobin authored Jul 7, 2021
    Copy the full SHA
    fb453d7 View commit details
Showing with 23 additions and 3 deletions.
  1. +23 −3 base/macros.hpp
26 changes: 23 additions & 3 deletions base/macros.hpp
Original file line number Diff line number Diff line change
@@ -162,13 +162,33 @@ inline void noreturn() { std::exit(0); }
#define CONSTEXPR_CHECK(condition) CHECK(condition)
#define CONSTEXPR_DCHECK(condition) DCHECK(condition)

// Lexicographic comparison (v1, v2, v3) ≥ (w1, w2, w3).
#define VERSION_GE(v1, v2, v3, w1, w2, w3) \
v1 > w1 || (v1 == w1 && v2 > w2) || (v1 == w1 && v2 == w2 && v3 >= w3)

#define CLANG_VERSION_GE(major, minor, patchlevel) \
VERSION_GE(__clang_major__, \
__clang_minor__, \
__clang_patchlevel__, \
major, \
minor, \
patchlevel)

// Clang for some reason doesn't like FP arithmetic that yields infinities by
// overflow (as opposed to division by zero, which the standard explicitly
// prohibits) in constexpr code (MSVC and GCC are fine with that). This will be
// fixed in Clang 9.0.0, all hail zygoloid.
#define PRINCIPIA_MAY_SIGNAL_OVERFLOW_IN_CONSTEXPR_ARITHMETIC \
!((PRINCIPIA_COMPILER_CLANG || PRINCIPIA_COMPILER_CLANG_CL) && \
__clang_major__ < 9)
#if PRINCIPIA_COMPILER_CLANG || PRINCIPIA_COMPILER_CLANG_CL
# if OS_MACOSX
# define PRINCIPIA_MAY_SIGNAL_OVERFLOW_IN_CONSTEXPR_ARITHMETIC \
CLANG_VERSION_GE(11, 0, 3)
# else
# define PRINCIPIA_MAY_SIGNAL_OVERFLOW_IN_CONSTEXPR_ARITHMETIC \
CLANG_VERSION_GE(9, 0, 0)
# endif
#else
# define PRINCIPIA_MAY_SIGNAL_OVERFLOW_IN_CONSTEXPR_ARITHMETIC 1
#endif
#if PRINCIPIA_MAY_SIGNAL_OVERFLOW_IN_CONSTEXPR_ARITHMETIC
# define CONSTEXPR_INFINITY constexpr
#else