Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cc/constraints/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ package(default_visibility = ["//visibility:public"])

constraint_setting(name = "compiler")

constraint_value(
name = "gcc-5",
constraint_setting = ":compiler",
)

constraint_value(
name = "gcc-6",
constraint_setting = ":compiler",
Expand Down
1 change: 1 addition & 0 deletions cc/copts.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ DEFAULT_COPTS = [

GCC6_DISABLED_COPTS = ["-Wimplicit-fallthrough"]
GCC6_COPTS = [copt for copt in DEFAULT_COPTS if copt not in GCC6_DISABLED_COPTS]
GCC5_COPTS = GCC6_COPTS
6 changes: 4 additions & 2 deletions cc/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

load("//tools:stamp_file.bzl", "stamp_file")
load(":utils.bzl", "construct_local_include")
load(":copts.bzl", "DEFAULT_COPTS", "GCC6_COPTS")
load(":copts.bzl", "DEFAULT_COPTS", "GCC5_COPTS", "GCC6_COPTS")
load(":cc_static_library.bzl", _cc_static_library = "cc_static_library")

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

Expand Down Expand Up @@ -137,7 +138,7 @@ def cc_stamped_library(name, out, template, hdrs, includes, defaults, visibility
visibility = visibility,
)

def cc_static_library(name, deps):
def cc_static_library(name, deps, visibility = ["//visibility:private"]):
_cc_static_library(
name = name,
deps = deps,
Expand All @@ -146,6 +147,7 @@ def cc_static_library(name, deps):
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = visibility,
)

def swift_c_library(**kwargs):
Expand Down