Skip to content

Commit 41f1602

Browse files
authored
Add gcc-5 constraint value [BUILD-650] (#65)
* Add gcc-5 constraint value * Forward visibility in cc_static_libarary * Set default value for visibility
1 parent 6c2373a commit 41f1602

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

cc/constraints/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ package(default_visibility = ["//visibility:public"])
44

55
constraint_setting(name = "compiler")
66

7+
constraint_value(
8+
name = "gcc-5",
9+
constraint_setting = ":compiler",
10+
)
11+
712
constraint_value(
813
name = "gcc-6",
914
constraint_setting = ":compiler",

cc/copts.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ DEFAULT_COPTS = [
4848

4949
GCC6_DISABLED_COPTS = ["-Wimplicit-fallthrough"]
5050
GCC6_COPTS = [copt for copt in DEFAULT_COPTS if copt not in GCC6_DISABLED_COPTS]
51+
GCC5_COPTS = GCC6_COPTS

cc/defs.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
load("//tools:stamp_file.bzl", "stamp_file")
1414
load(":utils.bzl", "construct_local_include")
15-
load(":copts.bzl", "DEFAULT_COPTS", "GCC6_COPTS")
15+
load(":copts.bzl", "DEFAULT_COPTS", "GCC5_COPTS", "GCC6_COPTS")
1616
load(":cc_static_library.bzl", _cc_static_library = "cc_static_library")
1717

1818
# Name for a unit test
@@ -49,6 +49,7 @@ def _cxx_standard(default, override):
4949
def _common_cc_opts(nocopts, pedantic = False):
5050
return select({
5151
Label("//cc/constraints:gcc-6"): [copt for copt in GCC6_COPTS if copt not in nocopts],
52+
Label("//cc/constraints:gcc-5"): [copt for copt in GCC5_COPTS if copt not in nocopts],
5253
"//conditions:default": [copt for copt in DEFAULT_COPTS if copt not in nocopts],
5354
}) + ["-pedantic"] if pedantic else []
5455

@@ -137,7 +138,7 @@ def cc_stamped_library(name, out, template, hdrs, includes, defaults, visibility
137138
visibility = visibility,
138139
)
139140

140-
def cc_static_library(name, deps):
141+
def cc_static_library(name, deps, visibility = ["//visibility:private"]):
141142
_cc_static_library(
142143
name = name,
143144
deps = deps,
@@ -146,6 +147,7 @@ def cc_static_library(name, deps):
146147
"@platforms//os:macos": ["@platforms//:incompatible"],
147148
"//conditions:default": [],
148149
}),
150+
visibility = visibility,
149151
)
150152

151153
def swift_c_library(**kwargs):

0 commit comments

Comments
 (0)