Skip to content

Commit fa57bfc

Browse files
dinordcopybara-github
authored andcommitted
absl/log/internal: Document conditional ABSL_ATTRIBUTE_UNUSED, add C++17 TODO
Once absl's support floor moves to C++17, we'll be able to replace it with [`[[maybe_unused]]`](https://en.cppreference.com/w/cpp/language/attributes/maybe_unused). PiperOrigin-RevId: 625680108 Change-Id: I823b70c0f833dcf9c41bca0c2566b12ec65785de
1 parent e304ff5 commit fa57bfc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

absl/log/internal/strip.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
// logging in subtly different ways for subtly different reasons (see below).
3232
#if defined(STRIP_LOG) && STRIP_LOG
3333

34+
// Attribute for marking variables used in implementation details of logging
35+
// macros as unused, but only when `STRIP_LOG` is defined.
36+
// With `STRIP_LOG` on, not marking them triggers `-Wunused-but-set-variable`,
37+
// With `STRIP_LOG` off, marking them triggers `-Wused-but-marked-unused`.
38+
//
39+
// TODO(b/290784225): Replace this macro with attribute [[maybe_unused]] when
40+
// Abseil stops supporting C++14.
3441
#define ABSL_LOG_INTERNAL_ATTRIBUTE_UNUSED_IF_STRIP_LOG ABSL_ATTRIBUTE_UNUSED
3542

3643
#define ABSL_LOGGING_INTERNAL_LOG_INFO ::absl::log_internal::NullStream()

0 commit comments

Comments
 (0)