From: Igor Sugak Date: Sun, 8 Nov 2015 08:32:52 +0000 (-0800) Subject: folly/portability: add clang version check X-Git-Tag: deprecate-dynamic-initializer~271 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=408597e5bc528477608785709ba3fa67ef64823f;p=folly.git folly/portability: add clang version check Summary: Define `__CLANG_PREREQ` macro to check version of clang. Reviewed By: yfeldblum Differential Revision: D2630325 fb-gh-sync-id: 3d666e554e8ddfc2c1fecd439aaf93f015829025 --- diff --git a/folly/Portability.h b/folly/Portability.h index 594ab9aa..bdac6cc3 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -174,6 +174,18 @@ namespace std { typedef ::max_align_t max_align_t; } #endif +// portable version check for clang +#ifndef __CLANG_PREREQ +# if defined __clang__ && defined __clang_major__ && defined __clang_minor__ +/* nolint */ +# define __CLANG_PREREQ(maj, min) \ + ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) +# else +/* nolint */ +# define __CLANG_PREREQ(maj, min) 0 +# endif +#endif + /* Platform specific TLS support * gcc implements __thread * msvc implements __declspec(thread)