diff options
author | Abseil Team <absl-team@google.com> | 2022-12-20 15:37:58 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-12-20 15:38:45 -0800 |
commit | 1f8da02dc8b8b0581326f90510ed8c4009fc1017 (patch) | |
tree | 3b0af550762a7d0e590563ed78866f38ec353909 /absl/base/attributes.h | |
parent | 9a2c7bf98fa2482d0cbba727dcc4499e6e7c5ee2 (diff) | |
download | abseil-1f8da02dc8b8b0581326f90510ed8c4009fc1017.tar.gz abseil-1f8da02dc8b8b0581326f90510ed8c4009fc1017.tar.bz2 abseil-1f8da02dc8b8b0581326f90510ed8c4009fc1017.zip |
Tagged most functions in absl/time/time.h as ABSL_ATTRIBUTE_CONST_FUNCTION or ABSL_ATTRIBUTE_PURE_FUNCTION
However, both absl_attributes are now unimplemented to avoid breaking existing users.
PiperOrigin-RevId: 496769399
Change-Id: I9c00cb60b885526300d744f9ea7c0f2178f092bb
Diffstat (limited to 'absl/base/attributes.h')
-rw-r--r-- | absl/base/attributes.h | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h index e11a064a..b7826e77 100644 --- a/absl/base/attributes.h +++ b/absl/base/attributes.h @@ -716,26 +716,9 @@ #define ABSL_CONST_INIT #endif -// ABSL_ATTRIBUTE_PURE_FUNCTION -// -// ABSL_ATTRIBUTE_PURE_FUNCTION is used to annotate declarations of "pure" -// functions. A function is pure if its return value is only a function of its -// arguments. The pure attribute prohibits a function from modifying the state -// of the program that is observable by means other than inspecting the -// function's return value. Declaring such functions with the pure attribute -// allows the compiler to avoid emitting some calls in repeated invocations of -// the function with the same argument values. -// -// Example: -// -// ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Milliseconds(Duration d); -#if ABSL_HAVE_CPP_ATTRIBUTE(gnu::pure) -#define ABSL_ATTRIBUTE_PURE_FUNCTION [[gnu::pure]] -#elif ABSL_HAVE_ATTRIBUTE(pure) -#define ABSL_ATTRIBUTE_PURE_FUNCTION __attribute__((pure)) -#else +// These annotations are not available yet due to fear of breaking code. #define ABSL_ATTRIBUTE_PURE_FUNCTION -#endif +#define ABSL_ATTRIBUTE_CONST_FUNCTION // ABSL_ATTRIBUTE_LIFETIME_BOUND indicates that a resource owned by a function // parameter or implicit object parameter is retained by the return value of the |