Skip to content

Commit 1e104fe

Browse files
[features] distinguish between C-only features
The `-Wstrict-prototypes` warning is only applicable to C code, not C++ code. See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstrict-prototypes Signed-off-by: Tim Trippel <ttrippel@google.com>
1 parent 952f0da commit 1e104fe

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

config/features.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def reify_with_features_set(
7979
fail("the argument to with_features must be an array of values created by with_feature_set")
8080
return with_feature_set(
8181
features,
82-
not_features
82+
not_features,
8383
)
8484

8585
def reify_flag_set(
@@ -89,7 +89,7 @@ def reify_flag_set(
8989
type_name = None):
9090
return __flag_set(
9191
actions,
92-
with_features =[reify_with_features_set(**v) for v in with_features],
92+
with_features = [reify_with_features_set(**v) for v in with_features],
9393
flag_groups = [reify_flag_group(**v) for v in flag_groups],
9494
)
9595

@@ -183,14 +183,14 @@ feature = rule(
183183
provides = [FeatureInfo],
184184
)
185185

186-
def feature_single_flag_c_cpp(name, flag, enabled = True):
186+
def feature_single_flag_c_cpp(name, flag, c_only = False, enabled = True):
187187
"""This macro produces a C/C++ feature() that enables a single flag."""
188188
feature(
189189
name = name,
190190
enabled = enabled,
191191
flag_sets = [
192192
flag_set(
193-
actions = CPP_ALL_COMPILE_ACTIONS + C_ALL_COMPILE_ACTIONS,
193+
actions = C_ALL_COMPILE_ACTIONS + ([] if c_only else CPP_ALL_COMPILE_ACTIONS),
194194
flag_groups = [
195195
flag_group(
196196
flags = [flag],

features/common/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ feature_single_flag_c_cpp(
8484

8585
feature_single_flag_c_cpp(
8686
name = "strict_prototypes_warnings",
87+
c_only = True,
8788
flag = "-Wstrict-prototypes",
8889
)
8990

@@ -174,7 +175,7 @@ feature(
174175
flag_groups = [
175176
flag_group(
176177
flags = [
177-
"-flto"
178+
"-flto",
178179
],
179180
),
180181
],

0 commit comments

Comments
 (0)