From bde85071e497254e954c27b1b81b442a441ad4b0 Mon Sep 17 00:00:00 2001 From: Andy Getzendanner Date: Wed, 28 Jun 2023 16:53:38 -0700 Subject: Wrap the Emscripten version macros into an (internal) macro blob for easier comparison. PiperOrigin-RevId: 544197983 Change-Id: I7eb39563e696d6561ad193d4d25b4161eb6419ae --- absl/base/config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/absl/base/config.h b/absl/base/config.h index 4a167a2e..6d38d3f4 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -924,4 +924,24 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || #define ABSL_HAVE_CONSTANT_EVALUATED 1 #endif +// ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros +// into an integer that can be compared against. +#ifdef ABSL_INTERNAL_EMSCRIPTEN_VERSION +#error ABSL_INTERNAL_EMSCRIPTEN_VERSION cannot be directly set +#endif +#ifdef __EMSCRIPTEN__ +#include +#ifdef __EMSCRIPTEN_major__ +#if __EMSCRIPTEN_minor__ >= 1000 +#error __EMSCRIPTEN_minor__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION +#endif +#if __EMSCRIPTEN_tiny__ >= 1000 +#error __EMSCRIPTEN_tiny__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION +#endif +#define ABSL_INTERNAL_EMSCRIPTEN_VERSION \ + ((__EMSCRIPTEN_major__)*1000000 + (__EMSCRIPTEN_minor__)*1000 + \ + (__EMSCRIPTEN_tiny__)) +#endif +#endif + #endif // ABSL_BASE_CONFIG_H_ -- cgit v1.2.3