about summary refs log tree commit diff
path: root/absl/base/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/base/config.h')
-rw-r--r--absl/base/config.h19
1 files changed, 19 insertions, 0 deletions
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_