about summary refs log tree commit diff
path: root/absl/base
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-01-12T15·45-0800
committerDerek Mauro <dmauro@google.com>2018-01-12T15·52-0500
commitbe40fdf1a86f4956d2f8125a7b6bd6d34e133c2d (patch)
treec6b5e1fa9df5114a350afdcd7334ed7ac4d44b77 /absl/base
parentc742b72354a84958b6a061755249822eeef87d06 (diff)
Changes imported from Abseil "staging" branch:
  - c01cbbc23470f60e54aa28f88faa49df17d26c9c Add constexpr function for max uint128 to replace global ... by Alex Strelnikov <strel@google.com>
  - 07491549940e51fb6a0c8aad0ce101cb2830ee8e fix __GNUC__ typo in ABSL_ATTRIBUTE_RETURNS_NONNULL test by Abseil Team <absl-team@google.com>
  - 1bc29bafa53c387b0e097856cffb2fb9ce56c331 Remove redundant uint128 function cast expressions. by Alex Strelnikov <strel@google.com>
  - e3dddbd7be9e85e1bac77648af35ddccdba4500e Add ABSL_ATTRIBUTE_RETURNS_NONNULL macro. by Chris Kennelly <ckennelly@google.com>

GitOrigin-RevId: c01cbbc23470f60e54aa28f88faa49df17d26c9c
Change-Id: I7a5f608f58fb53bf013cdf56018f5b39842427fc
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/attributes.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h
index 02bb030f5e5a..4e1fc8b550d1 100644
--- a/absl/base/attributes.h
+++ b/absl/base/attributes.h
@@ -281,6 +281,18 @@
 #define ABSL_ATTRIBUTE_NO_SANITIZE_CFI
 #endif
 
+// ABSL_ATTRIBUTE_RETURNS_NONNULL
+//
+// Tells the compiler that a particular function never returns a null pointer.
+#if ABSL_HAVE_ATTRIBUTE(returns_nonnull) || \
+    (defined(__GNUC__) && \
+     (__GNUC__ > 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && \
+     !defined(__clang__))
+#define ABSL_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
+#else
+#define ABSL_ATTRIBUTE_RETURNS_NONNULL
+#endif
+
 // ABSL_HAVE_ATTRIBUTE_SECTION
 //
 // Indicates whether labeled sections are supported. Labeled sections are not