From 27de9bcc00513247daf778a5505295c453139dfe Mon Sep 17 00:00:00 2001 From: lucylq Date: Tue, 4 Feb 2025 16:27:03 -0800 Subject: [PATCH] [executorch] Suppress wdeprecated warnings on tensor_layout.h and named_data_map.h Context: ET_EXPERIMENTAL is tagged with [[deprecated]]. This causes errors when ET_EXPERIMENTAL features are used in core ET and code is built with -Werror. See errors on D67127327. This diff applies Option1 to 'tensor_layout.h' and Option2 to 'named_data_map.h' Option 1: - gate with `#pragma GCC diagnostic ignored "-Wdeprecated-declarations"`, for users of tensor_layout.h and program.h Option 2: - use ET_DISABLE_EXPERIMENTAL_ANNOTATION=1, for users of tensor_layout.h and program.h ---- Users - tensor_layout.h: named_data_map.h - named_data_map.h: method.h, program.h Generally, I think we can apply either option1/option2 to `tensor_layout.h`. For `named_data_map.h`, I think we should apply option2, to make ET_EXPERIMENTAL a no-op, or remove the ET_EXPERIMENTAL annotation to the implementation class. Option 1 would disable deprecation warnings for the entire file. Differential Revision: [D69145438](https://our.internmc.facebook.com/intern/diff/D69145438/) [ghstack-poisoned] --- runtime/core/named_data_map.h | 5 +++++ runtime/executor/method.h | 5 +++++ runtime/executor/program.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/runtime/core/named_data_map.h b/runtime/core/named_data_map.h index 31a60abb89f..68639ed872a 100644 --- a/runtime/core/named_data_map.h +++ b/runtime/core/named_data_map.h @@ -7,6 +7,9 @@ */ #pragma once +// Disable -Wdeprecated-declarations, as some builds use 'Werror'. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include #include @@ -75,3 +78,5 @@ class ET_EXPERIMENTAL NamedDataMap { } // namespace runtime } // namespace executorch + +#pragma GCC diagnostic pop diff --git a/runtime/executor/method.h b/runtime/executor/method.h index 7ce0604724a..a49eba5cdf8 100644 --- a/runtime/executor/method.h +++ b/runtime/executor/method.h @@ -7,6 +7,9 @@ */ #pragma once +// Disable -Wdeprecated-declarations, as some builds use 'Werror'. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include #include @@ -364,3 +367,5 @@ namespace executor { using ::executorch::runtime::Method; } // namespace executor } // namespace torch + +#pragma GCC diagnostic pop diff --git a/runtime/executor/program.h b/runtime/executor/program.h index 08d5e392768..5ddb59bb745 100644 --- a/runtime/executor/program.h +++ b/runtime/executor/program.h @@ -7,6 +7,9 @@ */ #pragma once +// Disable -Wdeprecated-declarations, as some builds use 'Werror'. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include #include @@ -302,3 +305,5 @@ namespace executor { using ::executorch::runtime::Program; } // namespace executor } // namespace torch + +#pragma GCC diagnostic pop