diff options
author | Andy Getzendanner <durandal@google.com> | 2023-06-28 16:53:38 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-06-28 16:54:41 -0700 |
commit | bde85071e497254e954c27b1b81b442a441ad4b0 (patch) | |
tree | a165cdf000512e55ee8a21326a5a2cb2a82d6290 /absl/base | |
parent | 2119e40e17b56e38d077279fa7480b04d769d01d (diff) |
Wrap the Emscripten version macros into an (internal) macro blob for easier comparison.
PiperOrigin-RevId: 544197983
Change-Id: I7eb39563e696d6561ad193d4d25b4161eb6419ae
Diffstat (limited to 'absl/base')
-rw-r--r-- | absl/base/config.h | 20 |
1 files changed, 20 insertions, 0 deletions
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 <emscripten/version.h> +#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_ |