Skip to content

Commit c1f9345

Browse files
committed
move warning suppression to .bzl files
1 parent 24671a9 commit c1f9345

File tree

10 files changed

+34
-44
lines changed

10 files changed

+34
-44
lines changed

backends/vulkan/runtime/utils/VecUtils.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,6 @@ inline constexpr bool less_than_lowest(const T& x) {
148148
x, std::is_unsigned<Limit>(), std::is_unsigned<T>());
149149
}
150150

151-
// Suppress sign compare warning when compiling with GCC
152-
// as later does not account for short-circuit rule before
153-
// raising the warning, see https://godbolt.org/z/Tr3Msnz99
154-
#ifdef __GNUC__
155-
#pragma GCC diagnostic push
156-
#pragma GCC diagnostic ignored "-Wsign-compare"
157-
#endif
158-
159151
/*
160152
* Returns true if x is greater than the greatest value of the type Limit
161153
*/
@@ -166,10 +158,6 @@ inline constexpr bool greater_than_max(const T& x) {
166158
return can_overflow && x > std::numeric_limits<Limit>::max();
167159
}
168160

169-
#ifdef __GNUC__
170-
#pragma GCC diagnostic pop
171-
#endif
172-
173161
template <typename To, typename From>
174162
std::enable_if_t<
175163
std::is_integral<From>::value && !std::is_same<From, bool>::value,

backends/vulkan/targets.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ load("@fbsource//tools/build_defs:platform_defs.bzl", "ANDROID", "CXX", "FBCODE"
55

66

77
def get_vulkan_compiler_flags():
8-
return ["-Wno-missing-prototypes", "-Wno-global-constructors"]
8+
return select({
9+
"DEFAULT": [
10+
"-Wno-global-constructors",
11+
"-Wno-missing-prototypes",
12+
"-Wno-sign-compare",
13+
],
14+
"ovr_config//os:windows": [],
15+
})
916

1017
def get_labels(no_volk):
1118
if no_volk:

runtime/core/named_data_map.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
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"
1310

1411
#include <executorch/runtime/core/exec_aten/exec_aten.h>
1512
#include <executorch/runtime/core/freeable_buffer.h>
@@ -77,5 +74,3 @@ class ET_EXPERIMENTAL NamedDataMap {
7774

7875
} // namespace runtime
7976
} // namespace executorch
80-
81-
#pragma GCC diagnostic pop

runtime/core/portable_type/c10/c10/targets.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ def get_sleef_preprocessor_flags():
55
return []
66
return ["-DAT_BUILD_ARM_VEC256_WITH_SLEEF"]
77

8+
def get_compiler_flags():
9+
return select({
10+
"DEFAULT": [
11+
"-Wno-sign-compare",
12+
],
13+
"ovr_config//os:windows": [],
14+
})
815

916
def define_common_targets():
1017
"""Defines targets that should be shared between fbcode and xplat.
@@ -14,6 +21,7 @@ def define_common_targets():
1421
"""
1522
runtime.cxx_library(
1623
name = "c10",
24+
compiler_flags = get_compiler_flags(),
1725
header_namespace = "c10",
1826
exported_headers = [
1927
"macros/Export.h",

runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ inline constexpr bool signs_differ(const T& a, const U& b) {
6666
return is_negative(a) != is_negative(b);
6767
}
6868

69-
// Suppress sign compare warning when compiling with GCC
70-
// as later does not account for short-circuit rule before
71-
// raising the warning, see https://godbolt.org/z/Tr3Msnz99
72-
#ifdef __GNUC__
73-
#pragma GCC diagnostic push
74-
#pragma GCC diagnostic ignored "-Wsign-compare"
75-
#endif
76-
7769
/// Returns true if x is greater than the greatest value of the type Limit
7870
template <typename Limit, typename T>
7971
inline constexpr bool greater_than_max(const T& x) {
@@ -82,10 +74,6 @@ inline constexpr bool greater_than_max(const T& x) {
8274
return can_overflow && x > std::numeric_limits<Limit>::max();
8375
}
8476

85-
#ifdef __GNUC__
86-
#pragma GCC diagnostic pop
87-
#endif
88-
8977
/// Returns true if x < lowest(Limit). Standard comparison
9078
template <typename Limit, typename T>
9179
inline constexpr bool less_than_lowest(

runtime/core/targets.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ def get_core_flags():
2626
core_flags += ["-DET_ENABLE_ENUM_STRINGS=" + ("1" if enable_enum_strings() else "0")]
2727
return core_flags
2828

29+
def get_compiler_flags():
30+
return select({
31+
"DEFAULT": [
32+
"-Wno-deprecated-declarations",
33+
],
34+
"ovr_config//os:windows": [],
35+
})
36+
2937
def define_common_targets():
3038
"""Defines targets that should be shared between fbcode and xplat.
3139
@@ -136,6 +144,7 @@ def define_common_targets():
136144

137145
runtime.cxx_library(
138146
name = "named_data_map",
147+
compiler_flags = get_compiler_flags(),
139148
exported_headers = [
140149
"named_data_map.h",
141150
],

runtime/executor/method.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
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"
1310

1411
#include <executorch/runtime/core/evalue.h>
1512
#include <executorch/runtime/core/event_tracer.h>
@@ -401,5 +398,3 @@ namespace executor {
401398
using ::executorch::runtime::Method;
402399
} // namespace executor
403400
} // namespace torch
404-
405-
#pragma GCC diagnostic pop

runtime/executor/program.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
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"
1310

1411
#include <cinttypes>
1512
#include <cstdint>
@@ -307,5 +304,3 @@ namespace executor {
307304
using ::executorch::runtime::Program;
308305
} // namespace executor
309306
} // namespace torch
310-
311-
#pragma GCC diagnostic pop

runtime/executor/targets.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ def _program_preprocessor_flags():
2121
fail("executorch.enable_program_verification must be one of 'true' or 'false'; saw '" +
2222
enable_verification + "'")
2323

24+
def get_compiler_flags():
25+
return select({
26+
"DEFAULT": [
27+
"-Wno-deprecated-declarations",
28+
],
29+
"ovr_config//os:windows": [],
30+
})
31+
2432
def define_common_targets():
2533
"""Defines targets that should be shared between fbcode and xplat.
2634
@@ -58,6 +66,7 @@ def define_common_targets():
5866

5967
runtime.cxx_library(
6068
name = "program_no_prim_ops" + aten_suffix,
69+
compiler_flags = get_compiler_flags(),
6170
srcs = [
6271
"method.cpp",
6372
"method_meta.cpp",

runtime/executor/tensor_parser.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
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"
1310

1411
#include <executorch/runtime/core/evalue.h>
1512
#include <executorch/runtime/core/exec_aten/exec_aten.h>
@@ -154,4 +151,3 @@ using ::executorch::runtime::deserialization::parseTensorList;
154151
} // namespace deserialization
155152
} // namespace executor
156153
} // namespace torch
157-
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)