Skip to content

Commit 9b0da59

Browse files
pytorchbotlucylq
andauthored
[executorch] Suppress wdeprecated warnings on tensor_layout.h and named_data_map.h
Pull Request resolved: #8201 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 '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.`~~ Using option 1, as option 2 correctness depends on if compiler.h, or named_data_map/tensor_layout is compiled first, and likely we would implement it as an ET-wide flag, which would remove warnings for ET_EXPERIMENTAL across ET. ghstack-source-id: 264730421 @exported-using-ghexport Differential Revision: [D69145438](https://our.internmc.facebook.com/intern/diff/D69145438/) Co-authored-by: lucylq <[email protected]>
1 parent e40f34f commit 9b0da59

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

runtime/core/named_data_map.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*/
88

99
#pragma once
10+
// Disable -Wdeprecated-declarations, as some builds use 'Werror'.
11+
#pragma GCC diagnostic push
12+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1013

1114
#include <executorch/runtime/core/exec_aten/exec_aten.h>
1215
#include <executorch/runtime/core/freeable_buffer.h>
@@ -75,3 +78,5 @@ class ET_EXPERIMENTAL NamedDataMap {
7578

7679
} // namespace runtime
7780
} // namespace executorch
81+
82+
#pragma GCC diagnostic pop

runtime/executor/method.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*/
88

99
#pragma once
10+
// Disable -Wdeprecated-declarations, as some builds use 'Werror'.
11+
#pragma GCC diagnostic push
12+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1013

1114
#include <executorch/runtime/core/evalue.h>
1215
#include <executorch/runtime/core/event_tracer.h>
@@ -358,3 +361,5 @@ namespace executor {
358361
using ::executorch::runtime::Method;
359362
} // namespace executor
360363
} // namespace torch
364+
365+
#pragma GCC diagnostic pop

runtime/executor/program.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*/
88

99
#pragma once
10+
// Disable -Wdeprecated-declarations, as some builds use 'Werror'.
11+
#pragma GCC diagnostic push
12+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1013

1114
#include <cinttypes>
1215
#include <cstdint>
@@ -301,3 +304,5 @@ namespace executor {
301304
using ::executorch::runtime::Program;
302305
} // namespace executor
303306
} // namespace torch
307+
308+
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)