From 07e8b2a14d340984ff72fbea1181cc1469a4277a Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Wed, 17 May 2023 13:36:58 -0700 Subject: 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 --- absl/base/attributes.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'absl/base') 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 -- cgit v1.2.3