From 8ba96a8244bbe334d09542e92d566673a65c1f78 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 19 Nov 2019 14:43:59 -0800 Subject: Export of internal Abseil changes -- 87f85071a96c6d10f471cdf8a8c2d6c550c926e0 by Matt Kulukundis : Expose ABSL_HAVE_SOURCE_LOCATION_CURRENT as a public api. PiperOrigin-RevId: 281383411 GitOrigin-RevId: 87f85071a96c6d10f471cdf8a8c2d6c550c926e0 Change-Id: I4dfc18a5ba8e064bf9b749892aa8293470459e6b --- absl/base/config.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'absl') diff --git a/absl/base/config.h b/absl/base/config.h index 46a84f1a76f6..556b186cb94f 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -85,6 +85,12 @@ #define ABSL_HAVE_BUILTIN(x) 0 #endif +#if defined(__is_identifier) +#define ABSL_INTERNAL_HAS_KEYWORD(x) !(__is_identifier(x)) +#else +#define ABSL_INTERNAL_HAS_KEYWORD(x) 0 +#endif + // ABSL_HAVE_TLS is defined to 1 when __thread should be supported. // We assume __thread is supported on Linux when compiled with Clang or compiled // against libstdc++ with _GLIBCXX_HAVE_TLS defined. @@ -133,6 +139,17 @@ #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1 #endif +// ABSL_HAVE_SOURCE_LOCATION_CURRENT +// +// Indicates whether `absl::SourceLocation::current()` will return useful +// information in some contexts. +#ifndef ABSL_HAVE_SOURCE_LOCATION_CURRENT +#if ABSL_INTERNAL_HAS_KEYWORD(__builtin_LINE) && \ + ABSL_INTERNAL_HAS_KEYWORD(__builtin_FILE) +#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1 +#endif +#endif + // ABSL_HAVE_THREAD_LOCAL // // Checks whether C++11's `thread_local` storage duration specifier is @@ -539,4 +556,6 @@ #define ABSL_INTERNAL_MSVC_2017_DBG_MODE #endif +#undef ABSL_INTERNAL_HAS_KEYWORD + #endif // ABSL_BASE_CONFIG_H_ -- cgit 1.4.1