aboutsummaryrefslogtreecommitdiffhomepage
path: root/absl/flags/flag.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-12-19 12:03:35 -0800
committerGravatar CJ Johnson <johnsoncj@google.com>2019-12-19 15:40:56 -0500
commitad904b6cd3906ddf79878003d92b7bc08d7786ae (patch)
treef30a1740ab8e8b7c3ea37e6d0cb94bfd820b72e7 /absl/flags/flag.h
parent7bd1935dcbaf08701798d17fe408c960adec2da4 (diff)
Export of internal Abseil changes
-- 24162e64040e89f174531fa78fc0ff43c3a67da4 by Abseil Team <absl-team@google.com>: Make ABSL_RETIRED_FLAG behave consistently with ABSL_FLAG. Before the change: ABSL_RETIRED_FLAG does not compile when there are competing ctors in the type, even when ABSL_FLAG does. After the change: ABSL_RETIRED_FLAG compiles when ABSL_FLAG does. PiperOrigin-RevId: 286437395 -- 870d4cb4d114813e9cefe30d26d020b0fdcdc4b4 by Tom Manshreck <shreck@google.com>: Add docs on bind_front PiperOrigin-RevId: 286433540 -- b0c328bd9bb64e0382f942f93b85054229dafeac by Tom Manshreck <shreck@google.com>: Specify the format for LogSeverity flags PiperOrigin-RevId: 286402811 GitOrigin-RevId: 24162e64040e89f174531fa78fc0ff43c3a67da4 Change-Id: I89785145d049fee49c6b9cf3357893ece9a6231c
Diffstat (limited to 'absl/flags/flag.h')
-rw-r--r--absl/flags/flag.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/absl/flags/flag.h b/absl/flags/flag.h
index b6fbd11..f18e9f5 100644
--- a/absl/flags/flag.h
+++ b/absl/flags/flag.h
@@ -384,11 +384,19 @@ ABSL_NAMESPACE_END
//
// `default_value` is only used as a double check on the type. `explanation` is
// unused.
+//
+// ABSL_RETIRED_FLAG support omitting the default value for default
+// constructible value type, so that users can delete the code generatring this
+// value.
+//
// TODO(rogeeff): Return an anonymous struct instead of bool, and place it into
// the unnamed namespace.
#define ABSL_RETIRED_FLAG(type, flagname, default_value, explanation) \
- ABSL_ATTRIBUTE_UNUSED static const bool ignored_##flagname = \
- ([] { return type(default_value); }, \
+ ABSL_ATTRIBUTE_UNUSED static const bool ignored_##flagname = \
+ ([] { \
+ return absl::flags_internal::MakeFromDefaultValueOrEmpty<type>( \
+ default_value); \
+ }, \
absl::flags_internal::RetiredFlag<type>(#flagname))
#endif // ABSL_FLAGS_FLAG_H_