diff --git a/configure.ac b/configure.ac index 4ac7264ab4..53f67d50f8 100644 --- a/configure.ac +++ b/configure.ac @@ -142,6 +142,13 @@ TEST_CFLAGS="-Wno-vla" # the compiler has a different built-in setting) STD_CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" +# +# Define constexpr if it is missing from the compiler +# +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[constexpr int foo = 0;]])], + [], + [AC_DEFINE([constexpr],[static const],[Define compatibility shim for non-C23 compilers.])]) + # # Additional compiler settings. # diff --git a/lib/isc/include/isc/attributes.h b/lib/isc/include/isc/attributes.h index 4ed540f5a8..eb1bb53e2e 100644 --- a/lib/isc/include/isc/attributes.h +++ b/lib/isc/include/isc/attributes.h @@ -102,9 +102,3 @@ #else #define ISC_ATTR_UNUSED __attribute__((__unused__)) #endif - -#if __STDC_VERSION__ >= 202311L -#define ISC_CONSTEXPR constexpr -#else -#define ISC_CONSTEXPR static const -#endif diff --git a/lib/isc/include/isc/time.h b/lib/isc/include/isc/time.h index 0ba40129fa..9fa025c9f4 100644 --- a/lib/isc/include/isc/time.h +++ b/lib/isc/include/isc/time.h @@ -18,18 +18,17 @@ #include #include -#include #include /* * Define various time conversion constants. */ -ISC_CONSTEXPR unsigned int MS_PER_SEC = 1000; -ISC_CONSTEXPR unsigned int US_PER_MS = 1000; -ISC_CONSTEXPR unsigned int NS_PER_US = 1000; -ISC_CONSTEXPR unsigned int US_PER_SEC = 1000 * 1000; -ISC_CONSTEXPR unsigned int NS_PER_MS = 1000 * 1000; -ISC_CONSTEXPR unsigned int NS_PER_SEC = 1000 * 1000 * 1000; +constexpr unsigned int MS_PER_SEC = 1000; +constexpr unsigned int US_PER_MS = 1000; +constexpr unsigned int NS_PER_US = 1000; +constexpr unsigned int US_PER_SEC = 1000 * 1000; +constexpr unsigned int NS_PER_MS = 1000 * 1000; +constexpr unsigned int NS_PER_SEC = 1000 * 1000 * 1000; /* * ISC_FORMATHTTPTIMESTAMP_SIZE needs to be 30 in C locale and potentially