summaryrefslogtreecommitdiff
path: root/absl/base
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-05-17 13:36:58 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-05-17 13:37:55 -0700
commit07e8b2a14d340984ff72fbea1181cc1469a4277a (patch)
tree16dc3118374db8312a36e65ff162901efb7e07fa /absl/base
parentc8b33b0191a2db8364cacf94b267ea8a3f20ad83 (diff)
Add compiler deprecation warnings for absl::ConvertDateTime() and absl::FromDateTime().
These have been marked deprecated in the comments for some time, (since f340f773edab951656b19b6f1a77c964a78ec4c2) but the warnings were never enabled. A warning suppression is enabled for Abseil code so that when we declare types in our code, we don't get a warning. PiperOrigin-RevId: 532891102 Change-Id: Ife0c5696a061ea44769e02869e4e3d1196e86f9d
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/attributes.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h
index 3e5aafba..34a35538 100644
--- a/absl/base/attributes.h
+++ b/absl/base/attributes.h
@@ -685,6 +685,28 @@
#define ABSL_DEPRECATED(message)
#endif
+// When deprecating Abseil code, it is sometimes necessary to turn off the
+// warning within Abseil, until the deprecated code is actually removed. The
+// deprecated code can be surrounded with these directives to acheive that
+// result.
+//
+// class ABSL_DEPRECATED("Use Bar instead") Foo;
+//
+// ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
+// Baz ComputeBazFromFoo(Foo f);
+// ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
+#ifdef __GNUC__
+// Clang also supports these GCC pragmas.
+#define ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#define ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING \
+ _Pragma("GCC diagnostic pop")
+#else
+#define ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
+#define ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
+#endif // __GNUC__
+
// ABSL_CONST_INIT
//
// A variable declaration annotated with the `ABSL_CONST_INIT` attribute will