Skip to content

Commit 1f8da02

Browse files
Abseil Teamcopybara-github
Abseil Team
authored andcommitted
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
1 parent 9a2c7bf commit 1f8da02

File tree

3 files changed

+263
-180
lines changed

3 files changed

+263
-180
lines changed

absl/base/attributes.h

+2-19
Original file line numberDiff line numberDiff line change
@@ -716,26 +716,9 @@
716716
#define ABSL_CONST_INIT
717717
#endif
718718

719-
// ABSL_ATTRIBUTE_PURE_FUNCTION
720-
//
721-
// ABSL_ATTRIBUTE_PURE_FUNCTION is used to annotate declarations of "pure"
722-
// functions. A function is pure if its return value is only a function of its
723-
// arguments. The pure attribute prohibits a function from modifying the state
724-
// of the program that is observable by means other than inspecting the
725-
// function's return value. Declaring such functions with the pure attribute
726-
// allows the compiler to avoid emitting some calls in repeated invocations of
727-
// the function with the same argument values.
728-
//
729-
// Example:
730-
//
731-
// ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Milliseconds(Duration d);
732-
#if ABSL_HAVE_CPP_ATTRIBUTE(gnu::pure)
733-
#define ABSL_ATTRIBUTE_PURE_FUNCTION [[gnu::pure]]
734-
#elif ABSL_HAVE_ATTRIBUTE(pure)
735-
#define ABSL_ATTRIBUTE_PURE_FUNCTION __attribute__((pure))
736-
#else
719+
// These annotations are not available yet due to fear of breaking code.
737720
#define ABSL_ATTRIBUTE_PURE_FUNCTION
738-
#endif
721+
#define ABSL_ATTRIBUTE_CONST_FUNCTION
739722

740723
// ABSL_ATTRIBUTE_LIFETIME_BOUND indicates that a resource owned by a function
741724
// parameter or implicit object parameter is retained by the return value of the

0 commit comments

Comments
 (0)