summaryrefslogtreecommitdiff
path: root/absl/synchronization/barrier.cc
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-08-28 13:30:41 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-08-28 13:32:04 -0700
commit1d83ac7128a5898d580a8a4164a78648a93ce2d4 (patch)
treefcbf255d2f5fd7823c66f4d5e874a79d0014bc05 /absl/synchronization/barrier.cc
parent197bac8574c511b1937b60ce6405462f9af678ce (diff)
Implement ABSL_ATTRIBUTE_PURE_FUNCTION and ABSL_ATTRIBUTE_CONST_FUNCTION
Pure functions have no effects except to return a value, and their return value depends only on the parameters and global variables. Functions of this kind can be subject to data flow analysis and might be eliminated. In practice, this means that repeated calls to the same function with the same arguments may be optimized away and only evaluated once. Const functions are similar to pure functions, but may not depend on global variables at all. It is an error not to use the result of a function with one of these attributes, since these functions have no other visible effects. Since some Abseil functions are tagged with these attributes, this is potentially a breaking change for code that doesn't use the result of these functions. For example, absl::Minutes() is tagged with ABSL_ATTRIBUTE_CONST_FUNCTION. If, for example, the result of absl::Minutes(n) is unused, some compilers with issue a warning or error. If this is the case, it is likely that there is a typo in the code, or the call can be removed. PiperOrigin-RevId: 560803581 Change-Id: Icd6f218be2cfb7226f8ab6b2d97cd960c0d3d72f
Diffstat (limited to 'absl/synchronization/barrier.cc')
0 files changed, 0 insertions, 0 deletions