Skip to content

Commit

Permalink
[executorch] Suppress wdeprecated warnings on tensor_layout.h and nam…
Browse files Browse the repository at this point in the history
…ed_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/)
  • Loading branch information
lucylq committed Feb 5, 2025
1 parent 821a2fe commit 15c8bdf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions runtime/core/named_data_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <executorch/runtime/core/exec_aten/exec_aten.h>
#include <executorch/runtime/core/freeable_buffer.h>
Expand Down Expand Up @@ -75,3 +78,5 @@ class ET_EXPERIMENTAL NamedDataMap {

} // namespace runtime
} // namespace executorch

#pragma GCC diagnostic pop
5 changes: 5 additions & 0 deletions runtime/executor/method.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <executorch/runtime/core/evalue.h>
#include <executorch/runtime/core/event_tracer.h>
Expand Down Expand Up @@ -358,3 +361,5 @@ namespace executor {
using ::executorch::runtime::Method;
} // namespace executor
} // namespace torch

#pragma GCC diagnostic pop
5 changes: 5 additions & 0 deletions runtime/executor/program.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cinttypes>
#include <cstdint>
Expand Down Expand Up @@ -301,3 +304,5 @@ namespace executor {
using ::executorch::runtime::Program;
} // namespace executor
} // namespace torch

#pragma GCC diagnostic pop

0 comments on commit 15c8bdf

Please sign in to comment.