Use sandboxed clang
Change-Id: I0b9b5b7940b441aba6c6214e621d8997feef90b1
diff --git a/WORKSPACE b/WORKSPACE
index e250a5c..3e6145d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -14,6 +14,13 @@
url = 'http://frc971.org/Build-Dependencies/python.tar.gz',
)
+new_http_archive(
+ name = 'clang_3p6_repo',
+ build_file = 'tools/cpp/clang_3p6/clang_3p6.BUILD',
+ sha256 = '5ee9e04c55c2c99d0c0f83722102a49e98f485fc274f73111b33a7ac4e34e03e',
+ url = 'http://frc971.org/Build-Dependencies/clang_3p6.tar.gz',
+)
+
new_local_repository(
name = 'usr_repo',
path = '/usr',
diff --git a/aos/build/queues/BUILD b/aos/build/queues/BUILD
index b75d12f..b3ec3f6 100644
--- a/aos/build/queues/BUILD
+++ b/aos/build/queues/BUILD
@@ -17,6 +17,9 @@
deps = [
':lib',
],
+ data = [
+ '@clang_3p6_repo//:clang-format',
+ ],
)
ruby_binary(
diff --git a/aos/build/queues/compiler.rb b/aos/build/queues/compiler.rb
index 5164670..f47763d 100644
--- a/aos/build/queues/compiler.rb
+++ b/aos/build/queues/compiler.rb
@@ -77,7 +77,9 @@
end
def format_pipeline(output)
read_in, write_in = IO.pipe()
- child = Process.spawn('/usr/bin/clang-format-3.5 --style=google',
+ # TODO(phil): Is there a better way to use the sandboxed clang-format here?
+ child = Process.spawn({'LD_LIBRARY_PATH' => './bazel-out/host/bin/aos/build/queues/compiler.runfiles/org_frc971/external/clang_3p6_repo/usr/lib/x86_64-linux-gnu'},
+ './bazel-out/host/bin/aos/build/queues/compiler.runfiles/org_frc971/external/clang_3p6_repo/usr/bin/clang-format-3.6 --style=google',
{:in=>read_in, write_in=>:close,
:out=>output.fileno})
read_in.close
diff --git a/aos/common/logging/BUILD b/aos/common/logging/BUILD
index cc961b3..6d0d956 100644
--- a/aos/common/logging/BUILD
+++ b/aos/common/logging/BUILD
@@ -1,194 +1,194 @@
# The primary client logging interface.
cc_library(
- name = 'logging',
- visibility = ['//visibility:public'],
- hdrs = [
- 'logging.h',
- 'interface.h',
- 'context.h',
- ],
- srcs = [
- 'interface.cc',
- 'context.cc',
- ],
- deps = [
- '//aos/common:die',
- '//aos/common/libc:aos_strerror',
- '//aos/common:macros',
- '//aos/linux_code:complex_thread_local',
- ':sizes',
- ],
+ name = "logging",
+ srcs = [
+ "context.cc",
+ "interface.cc",
+ ],
+ hdrs = [
+ "context.h",
+ "interface.h",
+ "logging.h",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":sizes",
+ "//aos/common:die",
+ "//aos/common:macros",
+ "//aos/common/libc:aos_strerror",
+ "//aos/linux_code:complex_thread_local",
+ ],
)
cc_library(
- name = 'replay',
- visibility = ['//visibility:public'],
- srcs = [
- 'replay.cc',
- ],
- hdrs = [
- 'replay.h',
- ],
- deps = [
- ':binary_log_file',
- '//aos/common:queues',
- ':logging',
- '//aos/linux_code/ipc_lib:queue',
- ],
+ name = "replay",
+ srcs = [
+ "replay.cc",
+ ],
+ hdrs = [
+ "replay.h",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":binary_log_file",
+ ":logging",
+ "//aos/common:queues",
+ "//aos/linux_code/ipc_lib:queue",
+ ],
)
cc_binary(
- name = 'binary_log_writer',
- visibility = ['//visibility:public'],
- srcs = [
- 'binary_log_writer.cc',
- ],
- deps = [
- ':logging',
- ':implementations',
- '//aos/linux_code:init',
- '//aos/linux_code:configuration',
- '//aos/linux_code/ipc_lib:queue',
- '//aos/common:die',
- ':binary_log_file',
- '//aos/common:queue_types',
- '//aos/common:time',
- ],
+ name = "binary_log_writer",
+ srcs = [
+ "binary_log_writer.cc",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":binary_log_file",
+ ":implementations",
+ ":logging",
+ "//aos/common:die",
+ "//aos/common:queue_types",
+ "//aos/common:time",
+ "//aos/linux_code:configuration",
+ "//aos/linux_code:init",
+ "//aos/linux_code/ipc_lib:queue",
+ ],
)
cc_binary(
- name = 'log_streamer',
- visibility = ['//visibility:public'],
- srcs = [
- 'log_streamer.cc',
- ],
- deps = [
- ':logging',
- ':implementations',
- '//aos/linux_code:init',
- '//aos/common:time',
- '//aos/linux_code/ipc_lib:queue',
- ],
+ name = "log_streamer",
+ srcs = [
+ "log_streamer.cc",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":implementations",
+ ":logging",
+ "//aos/common:time",
+ "//aos/linux_code:init",
+ "//aos/linux_code/ipc_lib:queue",
+ ],
)
cc_binary(
- name = 'log_displayer',
- visibility = ['//visibility:public'],
- srcs = [
- 'log_displayer.cc',
- ],
- deps = [
- ':logging',
- ':implementations',
- '//aos/linux_code:init',
- ':binary_log_file',
- '//aos/common:queue_types',
- '//aos/linux_code:configuration',
- '//aos/common/util:string_to_num',
- ],
+ name = "log_displayer",
+ srcs = [
+ "log_displayer.cc",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":binary_log_file",
+ ":implementations",
+ ":logging",
+ "//aos/common:queue_types",
+ "//aos/common/util:string_to_num",
+ "//aos/linux_code:configuration",
+ "//aos/linux_code:init",
+ ],
)
cc_library(
- name = 'binary_log_file',
- srcs = [
- 'binary_log_file.cc',
- ],
- hdrs = [
- 'binary_log_file.h',
- ],
- deps = [
- ':implementations',
- ],
+ name = "binary_log_file",
+ srcs = [
+ "binary_log_file.cc",
+ ],
+ hdrs = [
+ "binary_log_file.h",
+ ],
+ deps = [
+ ":implementations",
+ ],
)
cc_library(
- name = 'sizes',
- hdrs = [
- 'sizes.h',
- ],
+ name = "sizes",
+ hdrs = [
+ "sizes.h",
+ ],
)
cc_test(
- name = 'implementations_test',
- srcs = [
- 'implementations_test.cc',
- ],
- deps = [
- '//aos/testing:googletest',
- ':logging',
- ':implementations',
- ],
+ name = "implementations_test",
+ srcs = [
+ "implementations_test.cc",
+ ],
+ deps = [
+ ":implementations",
+ ":logging",
+ "//aos/testing:googletest",
+ ],
)
cc_library(
- name = 'queue_logging',
- visibility = ['//visibility:public'],
- srcs = [
- 'queue_logging.cc',
- ],
- hdrs = [
- 'queue_logging.h',
- ],
- deps = [
- ':logging',
- ':sizes',
- '//aos/common:die',
- '//aos/common:queue_types',
- ],
+ name = "queue_logging",
+ srcs = [
+ "queue_logging.cc",
+ ],
+ hdrs = [
+ "queue_logging.h",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":logging",
+ ":sizes",
+ "//aos/common:die",
+ "//aos/common:queue_types",
+ ],
)
cc_library(
- name = 'matrix_logging',
- visibility = ['//visibility:public'],
- srcs = [
- 'matrix_logging.cc',
- ],
- hdrs = [
- 'matrix_logging.h',
- ],
- deps = [
- '//aos/common:generated_queue_headers',
- ':logging',
- ':sizes',
- '//aos/common:die',
- '//aos/common:queue_types',
- '//third_party/eigen',
- ],
+ name = "matrix_logging",
+ srcs = [
+ "matrix_logging.cc",
+ ],
+ hdrs = [
+ "matrix_logging.h",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":logging",
+ ":sizes",
+ "//aos/common:die",
+ "//aos/common:generated_queue_headers",
+ "//aos/common:queue_types",
+ "//third_party/eigen",
+ ],
)
cc_library(
- name = 'printf_formats',
- visibility = ['//visibility:public'],
- hdrs = [
- 'printf_formats.h',
- ],
- deps = [
- '//aos/common:macros',
- ],
+ name = "printf_formats",
+ hdrs = [
+ "printf_formats.h",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//aos/common:macros",
+ ],
)
cc_library(
- name = 'implementations',
- visibility = ['//visibility:public'],
- srcs = [
- 'implementations.cc',
- ],
- hdrs = [
- 'implementations.h',
- ],
- linkopts = [
- '-pthread',
- ],
- deps = [
- '//aos/common:die',
- '//aos/common:time',
- '//aos:once',
- '//aos/common:queue_types',
- ':logging',
- '//aos/common:type_traits',
- '//aos/common:mutex',
- '//aos/common:macros',
- ':sizes',
- '//aos/linux_code/ipc_lib:queue',
- ],
+ name = "implementations",
+ srcs = [
+ "implementations.cc",
+ ],
+ hdrs = [
+ "implementations.h",
+ ],
+ linkopts = [
+ "-lpthread",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":logging",
+ ":sizes",
+ "//aos:once",
+ "//aos/common:die",
+ "//aos/common:macros",
+ "//aos/common:mutex",
+ "//aos/common:queue_types",
+ "//aos/common:time",
+ "//aos/common:type_traits",
+ "//aos/linux_code/ipc_lib:queue",
+ ],
)
diff --git a/aos/linux_code/BUILD b/aos/linux_code/BUILD
index 259538c..3884130 100644
--- a/aos/linux_code/BUILD
+++ b/aos/linux_code/BUILD
@@ -1,92 +1,92 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
cc_binary(
- name = 'dump_rtprio',
- srcs = [
- 'dump_rtprio.cc',
- ],
- deps = [
- '//aos/common/logging',
- '//aos/common/logging:implementations',
- '//aos/common:time',
- ],
+ name = "dump_rtprio",
+ srcs = [
+ "dump_rtprio.cc",
+ ],
+ deps = [
+ "//aos/common:time",
+ "//aos/common/logging",
+ "//aos/common/logging:implementations",
+ ],
)
cc_library(
- name = 'queue',
- visibility = ['//aos/common:__pkg__'],
- hdrs = [
- 'queue-tmpl.h',
- ],
+ name = "queue",
+ hdrs = [
+ "queue-tmpl.h",
+ ],
+ visibility = ["//aos/common:__pkg__"],
)
cc_library(
- name = 'complex_thread_local',
- srcs = [
- 'complex_thread_local.cc',
- ],
- hdrs = [
- 'complex_thread_local.h',
- ],
- deps = [
- '//aos:once',
- '//aos/common:die',
- ],
- linkopts = [
- "-pthread",
- ],
+ name = "complex_thread_local",
+ srcs = [
+ "complex_thread_local.cc",
+ ],
+ hdrs = [
+ "complex_thread_local.h",
+ ],
+ linkopts = [
+ "-lpthread",
+ ],
+ deps = [
+ "//aos:once",
+ "//aos/common:die",
+ ],
)
cc_test(
- name = 'complex_thread_local_test',
- srcs = [
- 'complex_thread_local_test.cc',
- ],
- deps = [
- ':complex_thread_local',
- '//aos/testing:googletest',
- '//aos/common/util:thread',
- '//aos/common/logging',
- ],
+ name = "complex_thread_local_test",
+ srcs = [
+ "complex_thread_local_test.cc",
+ ],
+ deps = [
+ ":complex_thread_local",
+ "//aos/common/logging",
+ "//aos/common/util:thread",
+ "//aos/testing:googletest",
+ ],
)
cc_library(
- name = 'init',
- srcs = [
- 'init.cc',
- ],
- hdrs = [
- 'init.h',
- ],
- deps = [
- '//aos/linux_code/ipc_lib:shared_mem',
- '//aos/common:die',
- '//aos/common/logging:implementations',
- ],
+ name = "init",
+ srcs = [
+ "init.cc",
+ ],
+ hdrs = [
+ "init.h",
+ ],
+ deps = [
+ "//aos/common:die",
+ "//aos/common/logging:implementations",
+ "//aos/linux_code/ipc_lib:shared_mem",
+ ],
)
cc_library(
- name = 'configuration',
- srcs = [
- 'configuration.cc',
- ],
- hdrs = [
- 'configuration.h',
- ],
- deps = [
- '//aos:once',
- '//aos/common/logging',
- '//aos/common:unique_malloc_ptr',
- ],
+ name = "configuration",
+ srcs = [
+ "configuration.cc",
+ ],
+ hdrs = [
+ "configuration.h",
+ ],
+ deps = [
+ "//aos:once",
+ "//aos/common:unique_malloc_ptr",
+ "//aos/common/logging",
+ ],
)
cc_binary(
- name = 'core',
- srcs = [
- 'core.cc',
- ],
- deps = [
- ':init',
- '//aos/common/util:run_command',
- ],
+ name = "core",
+ srcs = [
+ "core.cc",
+ ],
+ deps = [
+ ":init",
+ "//aos/common/util:run_command",
+ ],
)
diff --git a/aos/linux_code/ipc_lib/BUILD b/aos/linux_code/ipc_lib/BUILD
index 8b8686d..d5d2c8d 100644
--- a/aos/linux_code/ipc_lib/BUILD
+++ b/aos/linux_code/ipc_lib/BUILD
@@ -1,150 +1,150 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
cc_library(
- name = 'aos_sync',
- srcs = [
- 'aos_sync.cc',
- ],
- hdrs = [
- 'aos_sync.h',
- ],
- linkopts = [
- '-pthread',
- ],
- deps = [
- '//aos/common/logging',
- '//aos:once',
- '//aos/common:macros',
- '//aos/common/util:compiler_memory_barrier',
- ],
+ name = "aos_sync",
+ srcs = [
+ "aos_sync.cc",
+ ],
+ hdrs = [
+ "aos_sync.h",
+ ],
+ linkopts = [
+ "-lpthread",
+ ],
+ deps = [
+ "//aos:once",
+ "//aos/common:macros",
+ "//aos/common/logging",
+ "//aos/common/util:compiler_memory_barrier",
+ ],
)
cc_library(
- name = 'core_lib',
- srcs = [
- 'core_lib.c',
- ],
- hdrs = [
- 'core_lib.h',
- ],
- deps = [
- ':aos_sync',
- ':shared_mem_types',
- ],
+ name = "core_lib",
+ srcs = [
+ "core_lib.c",
+ ],
+ hdrs = [
+ "core_lib.h",
+ ],
+ deps = [
+ ":aos_sync",
+ ":shared_mem_types",
+ ],
)
cc_library(
- name = 'shared_mem',
- srcs = [
- 'shared_mem.c',
- ],
- hdrs = [
- 'shared_mem.h',
- ],
- deps = [
- ':aos_sync',
- ':core_lib',
- ':shared_mem_types',
- '//aos/common/logging',
- ],
- linkopts = [
- '-lrt',
- ],
+ name = "shared_mem",
+ srcs = [
+ "shared_mem.c",
+ ],
+ hdrs = [
+ "shared_mem.h",
+ ],
+ linkopts = [
+ "-lrt",
+ ],
+ deps = [
+ ":aos_sync",
+ ":core_lib",
+ ":shared_mem_types",
+ "//aos/common/logging",
+ ],
)
cc_library(
- # TODO(Brian): This should be shared_mem{,.h}, and the other one should be
- # shared_mem_init{,.cc,.h}.
- name = 'shared_mem_types',
- hdrs = [
- 'shared_mem_types.h',
- ],
- deps = [
- ':aos_sync',
- ],
+ # TODO(Brian): This should be shared_mem{,.h}, and the other one should be
+ # shared_mem_init{,.cc,.h}.
+ name = "shared_mem_types",
+ hdrs = [
+ "shared_mem_types.h",
+ ],
+ deps = [
+ ":aos_sync",
+ ],
)
cc_library(
- name = 'queue',
- srcs = [
- 'queue.cc',
- ],
- hdrs = [
- 'queue.h',
- ],
- deps = [
- '//aos/common:condition',
- '//aos/common:mutex',
- ':core_lib',
- ':shared_mem',
- '//aos/common/logging',
- '//aos/common/util:options',
- ],
- linkopts = [
- '-lrt',
- ],
+ name = "queue",
+ srcs = [
+ "queue.cc",
+ ],
+ hdrs = [
+ "queue.h",
+ ],
+ linkopts = [
+ "-lrt",
+ ],
+ deps = [
+ ":core_lib",
+ ":shared_mem",
+ "//aos/common:condition",
+ "//aos/common:mutex",
+ "//aos/common/logging",
+ "//aos/common/util:options",
+ ],
)
cc_test(
- name = 'raw_queue_test',
- srcs = [
- 'raw_queue_test.cc',
- ],
- deps = [
- '//aos/testing:googletest',
- '//aos/testing:prevent_exit',
- ':queue',
- '//aos/common/logging',
- ':core_lib',
- '//aos/testing:test_shm',
- '//aos/common:time',
- '//aos/common:die',
- '//aos/common/util:thread',
- '//aos/common/util:death_test_log_implementation',
- ],
+ name = "raw_queue_test",
+ srcs = [
+ "raw_queue_test.cc",
+ ],
+ deps = [
+ ":core_lib",
+ ":queue",
+ "//aos/common:die",
+ "//aos/common:time",
+ "//aos/common/logging",
+ "//aos/common/util:death_test_log_implementation",
+ "//aos/common/util:thread",
+ "//aos/testing:googletest",
+ "//aos/testing:prevent_exit",
+ "//aos/testing:test_shm",
+ ],
)
cc_test(
- name = 'ipc_stress_test',
- srcs = [
- 'ipc_stress_test.cc',
- ],
- tags = [
- 'manual',
- ],
- deps = [
- '//aos/testing:googletest',
- '//aos/common:time',
- '//aos/testing:test_shm',
- '//aos/common:mutex',
- ':core_lib',
- '//aos/common:die',
- '//aos/common/libc:dirname',
- '//aos/common/libc:aos_strsignal',
- '//aos/common/logging',
- ],
+ name = "ipc_stress_test",
+ srcs = [
+ "ipc_stress_test.cc",
+ ],
+ tags = [
+ "manual",
+ ],
+ deps = [
+ ":core_lib",
+ "//aos/common:die",
+ "//aos/common:mutex",
+ "//aos/common:time",
+ "//aos/common/libc:aos_strsignal",
+ "//aos/common/libc:dirname",
+ "//aos/common/logging",
+ "//aos/testing:googletest",
+ "//aos/testing:test_shm",
+ ],
)
cc_library(
- name = 'scoped_message_ptr',
- deps = [
- ':queue',
- ],
+ name = "scoped_message_ptr",
+ deps = [
+ ":queue",
+ ],
)
cc_binary(
- name = 'ipc_comparison',
- srcs = [
- 'ipc_comparison.cc',
- ],
- deps = [
- '//aos/common:mutex',
- '//aos/common:event',
- '//aos/common:condition',
- '//third_party/gflags',
- '//aos/common/logging',
- '//aos/common/logging:implementations',
- '//aos/linux_code:init',
- ':queue',
- ],
+ name = "ipc_comparison",
+ srcs = [
+ "ipc_comparison.cc",
+ ],
+ deps = [
+ ":queue",
+ "//aos/common:condition",
+ "//aos/common:event",
+ "//aos/common:mutex",
+ "//aos/common/logging",
+ "//aos/common/logging:implementations",
+ "//aos/linux_code:init",
+ "//third_party/gflags",
+ ],
)
diff --git a/third_party/gflags/BUILD b/third_party/gflags/BUILD
index 2b84041..5e8b505 100644
--- a/third_party/gflags/BUILD
+++ b/third_party/gflags/BUILD
@@ -1,52 +1,53 @@
-licenses(['notice'])
+licenses(["notice"])
common_copts = [
- '-Ithird_party/gflags/include/gflags',
- '-Ithird_party/empty_config_h',
-
- '-DHAVE_STDINT_H=',
- '-DHAVE_SYS_TYPES_H=',
- '-DHAVE_INTTYPES_H=',
- '-DHAVE_SYS_STAT_H=',
- '-DHAVE_UNISTD_H=',
- '-DHAVE_FNMATCH_H=',
- '-DHAVE_STRTOLL=',
- '-DHAVE_PTHREAD=',
- '-DHAVE_RWLOCK=',
- '-D__STDC_FORMAT_MACROS=1',
- '-DPATH_SEPARATOR=\"\'/\'\"',
- '-DGFLAGS_IS_A_DLL=0',
- '-DGFLAGS_DLL_DECL=',
- '-DGFLAGS_DLL_DEFINE_FLAG=',
-
- '-Wno-format-nonliteral',
- '-Wno-unused-local-typedefs',
- '-Wno-sign-compare',
- '-Wno-missing-field-initializers',
+ "-Ithird_party/gflags/include/gflags",
+ "-Ithird_party/empty_config_h",
+ "-DHAVE_STDINT_H=",
+ "-DHAVE_SYS_TYPES_H=",
+ "-DHAVE_INTTYPES_H=",
+ "-DHAVE_SYS_STAT_H=",
+ "-DHAVE_UNISTD_H=",
+ "-DHAVE_FNMATCH_H=",
+ "-DHAVE_STRTOLL=",
+ "-DHAVE_PTHREAD=",
+ "-DHAVE_RWLOCK=",
+ "-D__STDC_FORMAT_MACROS=1",
+ "-DPATH_SEPARATOR=\"'/'\"",
+ "-DGFLAGS_IS_A_DLL=0",
+ "-DGFLAGS_DLL_DECL=",
+ "-DGFLAGS_DLL_DEFINE_FLAG=",
+ "-Wno-format-nonliteral",
+ "-Wno-unused-local-typedefs",
+ "-Wno-sign-compare",
+ "-Wno-missing-field-initializers",
]
cc_library(
- name = 'gflags',
- visibility = ['//visibility:public'],
- srcs = glob([
- 'src/*.cc',
- 'src/*.h',
- ], exclude=[
- 'src/windows_*',
- ]) + [
- 'include/gflags/gflags_declare.h',
- 'include/gflags/gflags_gflags.h',
- ],
- hdrs = [
- 'include/gflags/gflags.h',
- 'include/gflags/gflags_completions.h',
- ],
- deps = [
- '//third_party/empty_config_h',
- ],
- linkopts = [
- '-pthread',
- ],
- copts = common_copts,
- includes = [ 'include' ],
+ name = "gflags",
+ srcs = glob(
+ [
+ "src/*.cc",
+ "src/*.h",
+ ],
+ exclude = [
+ "src/windows_*",
+ ],
+ ) + [
+ "include/gflags/gflags_declare.h",
+ "include/gflags/gflags_gflags.h",
+ ],
+ hdrs = [
+ "include/gflags/gflags.h",
+ "include/gflags/gflags_completions.h",
+ ],
+ copts = common_copts,
+ includes = ["include"],
+ linkopts = [
+ "-lpthread",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//third_party/empty_config_h",
+ ],
)
diff --git a/third_party/googletest/BUILD b/third_party/googletest/BUILD
index 67ada7c..c082b0c 100644
--- a/third_party/googletest/BUILD
+++ b/third_party/googletest/BUILD
@@ -6,32 +6,27 @@
# build targets here, the libraries are independent of their location in
# a more straightforward way.
-load('//tools/build_rules:empty_main.bzl', 'empty_main_if_asan')
+load("//tools/build_rules:empty_main.bzl", "empty_main_if_asan")
licenses(["notice"])
cc_library(
name = "googletest",
- visibility = ["//visibility:public"],
srcs = glob([
- "googletest/src/gtest.cc",
- "googletest/src/gtest-death-test.cc",
- "googletest/src/gtest-filepath.cc",
- "googletest/src/gtest-internal-inl.h",
- "googletest/src/gtest-port.cc",
- "googletest/src/gtest-printers.cc",
- "googletest/src/gtest-test-part.cc",
- "googletest/src/gtest-typed-test.cc",
- "googletest/include/gtest/internal/*.h",
- "googletest/include/gtest/internal/custom/*.h",
+ "googletest/src/gtest.cc",
+ "googletest/src/gtest-death-test.cc",
+ "googletest/src/gtest-filepath.cc",
+ "googletest/src/gtest-internal-inl.h",
+ "googletest/src/gtest-port.cc",
+ "googletest/src/gtest-printers.cc",
+ "googletest/src/gtest-test-part.cc",
+ "googletest/src/gtest-typed-test.cc",
+ "googletest/include/gtest/internal/*.h",
+ "googletest/include/gtest/internal/custom/*.h",
]),
hdrs = glob([
- "googletest/include/gtest/*.h"
+ "googletest/include/gtest/*.h",
]),
- includes = [
- "googletest",
- "googletest/include",
- ],
copts = [
"-g",
"-Wall",
@@ -40,25 +35,29 @@
"-Wno-switch-enum",
"-Wno-missing-field-initializers",
],
+ includes = [
+ "googletest",
+ "googletest/include",
+ ],
linkopts = [
- "-pthread",
+ "-lpthread",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "googletest_main",
+ srcs = [
+ "googletest/src/gtest_main.cc",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":googletest",
],
)
cc_library(
- name = "googletest_main",
- visibility = ["//visibility:public"],
- srcs = [
- "googletest/src/gtest_main.cc",
- ],
- deps = [
- ":googletest",
- ],
-)
-
-cc_library(
- name = "googlemock",
- visibility = ["//visibility:public"],
+ name = "googlemock",
srcs = glob([
"googlemock/src/gmock-cardinalities.cc",
"googlemock/src/gmock.cc",
@@ -70,13 +69,8 @@
"googlemock/include/gmock/internal/custom/*.h",
]),
hdrs = glob([
- "googlemock/include/gmock/*.h"
+ "googlemock/include/gmock/*.h",
]),
- includes = [
- "googletest/include",
- "googlemock",
- "googlemock/include",
- ],
copts = [
"-std=c++11",
"-g",
@@ -86,9 +80,15 @@
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
],
- linkopts = [
- "-pthread",
+ includes = [
+ "googlemock",
+ "googlemock/include",
+ "googletest/include",
],
+ linkopts = [
+ "-lpthread",
+ ],
+ visibility = ["//visibility:public"],
deps = [
":googletest",
],
@@ -104,35 +104,35 @@
)
cc_library(
- name = "googletest_sample_libs",
- hdrs = [
- "googletest/samples/prime_tables.h",
- "googletest/samples/sample1.h",
- "googletest/samples/sample2.h",
- "googletest/samples/sample3-inl.h",
- "googletest/samples/sample4.h",
- ],
- srcs = [
- "googletest/samples/sample1.cc",
- "googletest/samples/sample2.cc",
- "googletest/samples/sample4.cc",
- ],
+ name = "googletest_sample_libs",
+ srcs = [
+ "googletest/samples/sample1.cc",
+ "googletest/samples/sample2.cc",
+ "googletest/samples/sample4.cc",
+ ],
+ hdrs = [
+ "googletest/samples/prime_tables.h",
+ "googletest/samples/sample1.h",
+ "googletest/samples/sample2.h",
+ "googletest/samples/sample3-inl.h",
+ "googletest/samples/sample4.h",
+ ],
)
test_suite(
- name = "googletest_example_tests",
- tests = [
- ":googletest_sample1_test",
- ":googletest_sample2_test",
- ":googletest_sample3_test",
- ":googletest_sample4_test",
- ":googletest_sample5_test",
- ":googletest_sample6_test",
- ":googletest_sample7_test",
- ":googletest_sample8_test",
- ":googletest_sample9_test",
- ":googletest_sample10_test",
- ],
+ name = "googletest_example_tests",
+ tests = [
+ ":googletest_sample10_test",
+ ":googletest_sample1_test",
+ ":googletest_sample2_test",
+ ":googletest_sample3_test",
+ ":googletest_sample4_test",
+ ":googletest_sample5_test",
+ ":googletest_sample6_test",
+ ":googletest_sample7_test",
+ ":googletest_sample8_test",
+ ":googletest_sample9_test",
+ ],
)
test_suite(
@@ -181,104 +181,105 @@
)
cc_test(
- name = "googletest_sample1_test",
- srcs = ["googletest/samples/sample1_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample1_test",
+ srcs = ["googletest/samples/sample1_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample2_test",
- srcs = ["googletest/samples/sample2_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample2_test",
+ srcs = ["googletest/samples/sample2_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample3_test",
- srcs = ["googletest/samples/sample3_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample3_test",
+ srcs = ["googletest/samples/sample3_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample4_test",
- srcs = ["googletest/samples/sample4_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample4_test",
+ srcs = ["googletest/samples/sample4_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample5_test",
- srcs = ["googletest/samples/sample5_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample5_test",
+ srcs = ["googletest/samples/sample5_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample6_test",
- srcs = ["googletest/samples/sample6_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample6_test",
+ srcs = ["googletest/samples/sample6_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample7_test",
- srcs = ["googletest/samples/sample7_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample7_test",
+ srcs = ["googletest/samples/sample7_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample8_test",
- srcs = ["googletest/samples/sample8_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample8_test",
+ srcs = ["googletest/samples/sample8_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample9_test",
- srcs = ["googletest/samples/sample9_unittest.cc"],
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample9_test",
+ srcs = ["googletest/samples/sample9_unittest.cc"],
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
cc_test(
- name = "googletest_sample10_test",
- srcs = empty_main_if_asan(["googletest/samples/sample10_unittest.cc"]),
- deps = [
- ":googletest_main",
- ":googletest_sample_libs",
- ],
+ name = "googletest_sample10_test",
+ srcs = empty_main_if_asan(["googletest/samples/sample10_unittest.cc"]),
+ deps = [
+ ":googletest_main",
+ ":googletest_sample_libs",
+ ],
)
""" Tests on the googletest library itself."""
+
cc_library(
name = "gtest_production",
- hdrs = [
- "googletest/test/production.h",
- ],
srcs = [
"googletest/test/production.cc",
],
+ hdrs = [
+ "googletest/test/production.h",
+ ],
deps = [
":googletest_main",
],
@@ -333,12 +334,12 @@
srcs = [
"googletest/test/gtest-port_test.cc",
],
+ copts = [
+ "-Wno-empty-body",
+ ],
deps = [
":googletest_main",
],
- copts = [
- "-Wno-empty-body",
- ]
)
cc_test(
@@ -379,8 +380,8 @@
cc_test(
name = "googletest_gtest_typed_test_test",
srcs = [
- "googletest/test/gtest-typed-test_test.h",
"googletest/test/gtest-typed-test_test.cc",
+ "googletest/test/gtest-typed-test_test.h",
],
deps = [
":googletest_main",
@@ -390,8 +391,8 @@
cc_test(
name = "googletest_gtest_typed_test2_test",
srcs = [
- "googletest/test/gtest-typed-test_test.h",
"googletest/test/gtest-typed-test2_test.cc",
+ "googletest/test/gtest-typed-test_test.h",
],
deps = [
":googletest_main",
@@ -403,20 +404,20 @@
srcs = [
"googletest/test/gtest_unittest.cc",
],
- deps = [
- ":googletest_main",
- ],
copts = [
"-Wno-empty-body",
"-Wno-missing-field-initializers",
- ]
+ ],
+ deps = [
+ ":googletest_main",
+ ],
)
cc_test(
name = "googletest_gtest_production_test",
srcs = [
- "googletest/test/production.h",
"googletest/test/production.cc",
+ "googletest/test/production.h",
],
deps = [
":googletest_main",
@@ -424,6 +425,7 @@
)
""" Tests on the googlemock library itself."""
+
cc_test(
name = "googlemock_gmock_actions_test",
srcs = [
@@ -449,7 +451,7 @@
],
)
-'''
+"""
cc_test(
name = "googlemock_gmock_ex_test",
srcs = [
@@ -460,7 +462,7 @@
":googletest_main",
],
)
-'''
+"""
cc_test(
name = "googlemock_gmock_generated_actions_test",
@@ -500,13 +502,13 @@
srcs = [
"googlemock/test/gmock-generated-matchers_test.cc",
],
+ copts = [
+ "-Wno-unused-parameter",
+ ],
deps = [
":googlemock",
":googletest_main",
],
- copts = [
- "-Wno-unused-parameter",
- ],
)
cc_test(
@@ -536,8 +538,8 @@
cc_test(
name = "googlemock_gmock_link_test",
srcs = [
- "googlemock/test/gmock_link_test.h",
"googlemock/test/gmock_link_test.cc",
+ "googlemock/test/gmock_link_test.h",
],
deps = [
":googlemock",
@@ -548,8 +550,8 @@
cc_test(
name = "googlemock_gmock_link2_test",
srcs = [
- "googlemock/test/gmock_link_test.h",
"googlemock/test/gmock_link2_test.cc",
+ "googlemock/test/gmock_link_test.h",
],
deps = [
":googlemock",
@@ -562,13 +564,13 @@
srcs = [
"googlemock/test/gmock-matchers_test.cc",
],
+ copts = [
+ "-Wno-unused-parameter",
+ ],
deps = [
":googlemock",
":googletest_main",
],
- copts = [
- "-Wno-unused-parameter",
- ],
)
cc_test(
diff --git a/third_party/gperftools/BUILD b/third_party/gperftools/BUILD
index c0fa7c0..d5a742e 100644
--- a/third_party/gperftools/BUILD
+++ b/third_party/gperftools/BUILD
@@ -1,426 +1,429 @@
-licenses(['notice'])
+licenses(["notice"])
-load('//tools/build_rules:select.bzl', 'cpu_select', 'compiler_select')
-load('//tools/build_rules:empty_main.bzl', 'empty_main_if_asan')
+load("//tools/build_rules:select.bzl", "cpu_select", "compiler_select")
+load("//tools/build_rules:empty_main.bzl", "empty_main_if_asan")
common_copts = [
- # Stuff from their Makefile.
- '-Wno-cast-align',
- '-Wno-sign-compare',
- '-fno-builtin-malloc',
- '-fno-builtin-free',
- '-fno-builtin-realloc',
- '-fno-builtin-calloc',
- '-fno-builtin-cfree',
- '-fno-builtin-memalign',
- '-fno-builtin-posix_memalign',
- '-fno-builtin-valloc',
- '-fno-builtin-pvalloc',
- '-Wno-unused-result',
- '-fno-omit-frame-pointer',
- '-DNDEBUG',
+ # Stuff from their Makefile.
+ "-Wno-cast-align",
+ "-Wno-sign-compare",
+ "-fno-builtin-malloc",
+ "-fno-builtin-free",
+ "-fno-builtin-realloc",
+ "-fno-builtin-calloc",
+ "-fno-builtin-cfree",
+ "-fno-builtin-memalign",
+ "-fno-builtin-posix_memalign",
+ "-fno-builtin-valloc",
+ "-fno-builtin-pvalloc",
+ "-Wno-unused-result",
+ "-fno-omit-frame-pointer",
+ "-DNDEBUG",
- # Stuff to make it work for us.
- '-Ithird_party/gperftools/src/',
- '-Ithird_party/empty_config_h',
- '-Wno-unused-parameter',
- '-Wno-missing-field-initializers',
- '-Wno-unused-function',
- '-Wno-unused-variable',
- '-Wno-format-nonliteral',
- '-Wno-switch-enum',
- '-Wno-error=cast-align',
- '-Wno-error=cast-qual',
+ # Stuff to make it work for us.
+ "-Ithird_party/gperftools/src/",
+ "-Ithird_party/empty_config_h",
+ "-Wno-unused-parameter",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-function",
+ "-Wno-unused-variable",
+ "-Wno-format-nonliteral",
+ "-Wno-switch-enum",
+ "-Wno-error=cast-align",
+ "-Wno-error=cast-qual",
- # Stuff pulled out of config.h.
- '-DHAVE_BUILTIN_EXPECT=1',
- '-DHAVE_DECL_CFREE=1',
- '-DHAVE_DECL_MEMALIGN=1',
- '-DHAVE_DECL_POSIX_MEMALIGN=1',
- '-DHAVE_DECL_PVALLOC=1',
- '-DHAVE_DECL_UNAME=1',
- '-DHAVE_DECL_VALLOC=1',
- '-DHAVE_DLFCN_H=1',
- '-DHAVE_ELF32_VERSYM=1',
- '-DHAVE_EXECINFO_H=1',
- '-DHAVE_FCNTL_H=1',
- '-DHAVE_FEATURES_H=1',
- '-DHAVE_FORK=1',
- '-DHAVE_GETEUID=1',
- '-DHAVE_GLOB_H=1',
- '-DHAVE_GRP_H=1',
- '-DHAVE_INTTYPES_H=1',
- '-DHAVE_LINUX_PTRACE_H=1',
- '-DHAVE_LINUX_SIGEV_THREAD_ID=1',
- '-DHAVE_MALLOC_H=1',
- '-DHAVE_MEMORY_H=1',
- '-DHAVE_MMAP=1',
- '-DHAVE_NAMESPACES=1',
- '-DHAVE_POLL_H=1',
- '-DHAVE_PROGRAM_INVOCATION_NAME=1',
- '-DHAVE_PTHREAD=1',
- '-DHAVE_PWD_H=1',
- '-DHAVE_SBRK=1',
- '-DHAVE_SCHED_H=1',
- '-DHAVE_STDINT_H=1',
- '-DHAVE_STDLIB_H=1',
- '-DHAVE_STRINGS_H=1',
- '-DHAVE_STRING_H=1',
- '-DHAVE_STRUCT_MALLINFO=1',
- '-DHAVE_SYS_CDEFS_H=1',
- '-DHAVE_SYS_PRCTL_H=1',
- '-DHAVE_SYS_RESOURCE_H=1',
- '-DHAVE_SYS_SOCKET_H=1',
- '-DHAVE_SYS_STAT_H=1',
- '-DHAVE_SYS_SYSCALL_H=1',
- '-DHAVE_SYS_TYPES_H=1',
- '-DHAVE_SYS_UCONTEXT_H=1',
- '-DHAVE_SYS_WAIT_H=1',
- '-DHAVE_TLS=1',
- '-DHAVE_UCONTEXT_H=1',
- '-DHAVE_UNISTD_H=1',
- '-DHAVE_UNWIND_H=1',
- '-DHAVE___ATTRIBUTE__=1',
- '-DHAVE___ENVIRON=1',
- '-DMALLOC_HOOK_MAYBE_VOLATILE=volatile',
- '-DPERFTOOLS_DLL_DECL=',
- '-DSTDC_HEADERS=1',
- '-DSTL_NAMESPACE=std',
- '-DPACKAGE_STRING=\\"gperftools\\ 2.4\\"',
- '-DPACKAGE_BUGREPORT=\\"http://frc971.org/contact\\"',
- '-DPACKAGE_VERSION=\\"2.4\\"',
+ # Stuff pulled out of config.h.
+ "-DHAVE_BUILTIN_EXPECT=1",
+ "-DHAVE_DECL_CFREE=1",
+ "-DHAVE_DECL_MEMALIGN=1",
+ "-DHAVE_DECL_POSIX_MEMALIGN=1",
+ "-DHAVE_DECL_PVALLOC=1",
+ "-DHAVE_DECL_UNAME=1",
+ "-DHAVE_DECL_VALLOC=1",
+ "-DHAVE_DLFCN_H=1",
+ "-DHAVE_ELF32_VERSYM=1",
+ "-DHAVE_EXECINFO_H=1",
+ "-DHAVE_FCNTL_H=1",
+ "-DHAVE_FEATURES_H=1",
+ "-DHAVE_FORK=1",
+ "-DHAVE_GETEUID=1",
+ "-DHAVE_GLOB_H=1",
+ "-DHAVE_GRP_H=1",
+ "-DHAVE_INTTYPES_H=1",
+ "-DHAVE_LINUX_PTRACE_H=1",
+ "-DHAVE_LINUX_SIGEV_THREAD_ID=1",
+ "-DHAVE_MALLOC_H=1",
+ "-DHAVE_MEMORY_H=1",
+ "-DHAVE_MMAP=1",
+ "-DHAVE_NAMESPACES=1",
+ "-DHAVE_POLL_H=1",
+ "-DHAVE_PROGRAM_INVOCATION_NAME=1",
+ "-DHAVE_PTHREAD=1",
+ "-DHAVE_PWD_H=1",
+ "-DHAVE_SBRK=1",
+ "-DHAVE_SCHED_H=1",
+ "-DHAVE_STDINT_H=1",
+ "-DHAVE_STDLIB_H=1",
+ "-DHAVE_STRINGS_H=1",
+ "-DHAVE_STRING_H=1",
+ "-DHAVE_STRUCT_MALLINFO=1",
+ "-DHAVE_SYS_CDEFS_H=1",
+ "-DHAVE_SYS_PRCTL_H=1",
+ "-DHAVE_SYS_RESOURCE_H=1",
+ "-DHAVE_SYS_SOCKET_H=1",
+ "-DHAVE_SYS_STAT_H=1",
+ "-DHAVE_SYS_SYSCALL_H=1",
+ "-DHAVE_SYS_TYPES_H=1",
+ "-DHAVE_SYS_UCONTEXT_H=1",
+ "-DHAVE_SYS_WAIT_H=1",
+ "-DHAVE_TLS=1",
+ "-DHAVE_UCONTEXT_H=1",
+ "-DHAVE_UNISTD_H=1",
+ "-DHAVE_UNWIND_H=1",
+ "-DHAVE___ATTRIBUTE__=1",
+ "-DHAVE___ENVIRON=1",
+ "-DMALLOC_HOOK_MAYBE_VOLATILE=volatile",
+ "-DPERFTOOLS_DLL_DECL=",
+ "-DSTDC_HEADERS=1",
+ "-DSTL_NAMESPACE=std",
+ "-DPACKAGE_STRING=\\\"gperftools\ 2.4\\\"",
+ "-DPACKAGE_BUGREPORT=\\\"http://frc971.org/contact\\\"",
+ "-DPACKAGE_VERSION=\\\"2.4\\\"",
] + cpu_select({
- 'amd64': [
- '-DHAVE_GETPAGESZE=1',
- '-DHAVE_SYS_PARAM_H=1',
- '-DPC_FROM_UCONTEXT=uc_mcontext.gregs[REG_RIP]',
- '-DPRIdS=\\"ld\\"',
- '-DPRIuS=\\"lu\\"',
- '-DPRIxS=\\"lx\\"',
- ],
- 'arm': [
- '-DPC_FROM_UCONTEXT=uc_mcontext.arm_pc',
- '-DPRIdS=\\"d\\"',
- '-DPRIuS=\\"u\\"',
- '-DPRIxS=\\"x\\"',
- ],
+ "amd64": [
+ "-DHAVE_GETPAGESZE=1",
+ "-DHAVE_SYS_PARAM_H=1",
+ "-DPC_FROM_UCONTEXT=uc_mcontext.gregs[REG_RIP]",
+ "-DPRIdS=\\\"ld\\\"",
+ "-DPRIuS=\\\"lu\\\"",
+ "-DPRIxS=\\\"lx\\\"",
+ ],
+ "arm": [
+ "-DPC_FROM_UCONTEXT=uc_mcontext.arm_pc",
+ "-DPRIdS=\\\"d\\\"",
+ "-DPRIuS=\\\"u\\\"",
+ "-DPRIxS=\\\"x\\\"",
+ ],
}) + compiler_select({
- 'clang': [
- '-Wno-unused-const-variable',
- '-Wno-gnu-alignof-expression',
- '-Wno-unused-private-field',
- ],
- 'gcc': [],
+ "clang": [
+ "-Wno-unused-const-variable",
+ "-Wno-gnu-alignof-expression",
+ "-Wno-unused-private-field",
+ ],
+ "gcc": [],
})
cc_library(
- name = 'tcmalloc',
- visibility = ['//visibility:public'],
- hdrs = glob([
- 'src/*.h',
- 'src/base/*.h',
- 'src/gperftools/*.h',
- ]) + [
- 'src/third_party/valgrind.h',
- ],
- srcs = glob(include = [
- 'src/*.cc',
- 'src/*.c',
- 'src/base/*.cc',
- 'src/base/*.c',
- ], exclude = [
- '**/*_unittest.cc',
- '**/*_test.cc',
- 'src/debugallocation.cc',
- ]),
- deps = [
- '//third_party/empty_config_h',
- ],
- copts = common_copts,
- linkopts = [
- '-lrt',
- '-pthread',
- ],
- alwayslink = True,
- nocopts = '-std=gnu\+\+1y',
+ name = "tcmalloc",
+ srcs = glob(
+ include = [
+ "src/*.cc",
+ "src/*.c",
+ "src/base/*.cc",
+ "src/base/*.c",
+ ],
+ exclude = [
+ "**/*_unittest.cc",
+ "**/*_test.cc",
+ "src/debugallocation.cc",
+ ],
+ ),
+ hdrs = glob([
+ "src/*.h",
+ "src/base/*.h",
+ "src/gperftools/*.h",
+ ]) + [
+ "src/third_party/valgrind.h",
+ ],
+ copts = common_copts,
+ linkopts = [
+ "-lrt",
+ "-lpthread",
+ ],
+ nocopts = "-std=gnu\+\+1y",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//third_party/empty_config_h",
+ ],
+ alwayslink = True,
)
cc_library(
- name = 'testutil',
- srcs = [
- 'src/tests/testutil.cc',
- ],
- hdrs = [
- 'src/tests/testutil.h',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
-)
-
-cc_test(
- name = 'low_level_alloc_unittest',
- srcs = [
- 'src/tests/low_level_alloc_unittest.cc',
- ],
- defines = [
- 'NO_TCMALLOC_SAMPLES',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'medium',
-)
-
-cc_test(
- name = 'atomicops_unittest',
- srcs = [
- 'src/tests/atomicops_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
-)
-
-cc_test(
- name = 'stacktrace_unittest',
- srcs = [
- 'src/tests/stacktrace_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
-)
-
-cc_test(
- name = 'tcmalloc_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/tcmalloc_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ':testutil',
- ],
- copts = common_copts + [
- '-fno-builtin',
- # Add this back in when we upgrade clang.
- #'-Wno-mismatched-new-delete',
- ],
- size = 'small',
-)
-
-cc_test(
- name = 'tcmalloc_large_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/tcmalloc_large_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts + [
- '-fno-builtin',
- ],
- size = 'small',
-)
-
-cc_test(
- name = 'addressmap_unittest',
- srcs = [
- 'src/tests/addressmap_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'medium',
-)
-
-cc_test(
- name = 'system_alloc_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/system-alloc_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts + [
- '-fno-builtin',
- ],
- size = 'small',
-)
-
-cc_test(
- name = 'packed_cache_test',
- srcs = [
- 'src/tests/packed-cache_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
-)
-
-cc_test(
- name = 'frag_unittest',
- srcs = [
- 'src/tests/frag_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
-)
-
-cc_test(
- name = 'markidle_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/markidle_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ':testutil',
- ],
- copts = common_copts,
- size = 'small',
-)
-
-cc_test(
- name = 'current_allocated_bytes_test',
- srcs = [
- 'src/tests/current_allocated_bytes_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
-)
-
-cc_test(
- name = 'malloc_hook_test',
- srcs = [
- 'src/tests/malloc_hook_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ':testutil',
- ],
- copts = common_copts + compiler_select({
- 'gcc': [
- '-Wno-maybe-uninitialized',
+ name = "testutil",
+ srcs = [
+ "src/tests/testutil.cc",
],
- 'clang': [],
- }),
- size = 'small',
+ hdrs = [
+ "src/tests/testutil.h",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'malloc_extension_test',
- srcs = empty_main_if_asan([
- 'src/tests/malloc_extension_test.cc',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "low_level_alloc_unittest",
+ size = "medium",
+ srcs = [
+ "src/tests/low_level_alloc_unittest.cc",
+ ],
+ copts = common_copts,
+ defines = [
+ "NO_TCMALLOC_SAMPLES",
+ ],
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'malloc_extension_c_test',
- srcs = empty_main_if_asan([
- 'src/tests/malloc_extension_c_test.c',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "atomicops_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/atomicops_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'memalign_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/memalign_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ':testutil',
- ],
- copts = common_copts,
- size = 'small',
+ name = "stacktrace_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/stacktrace_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'page_heap_test',
- srcs = [
- 'src/tests/page_heap_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "tcmalloc_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/tcmalloc_unittest.cc",
+ ]),
+ copts = common_copts + [
+ "-fno-builtin",
+ # Add this back in when we upgrade clang.
+ #'-Wno-mismatched-new-delete',
+ ],
+ deps = [
+ ":tcmalloc",
+ ":testutil",
+ ],
)
cc_test(
- name = 'pagemap_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/pagemap_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "tcmalloc_large_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/tcmalloc_large_unittest.cc",
+ ]),
+ copts = common_copts + [
+ "-fno-builtin",
+ ],
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'realloc_unittest',
- srcs = [
- 'src/tests/realloc_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "addressmap_unittest",
+ size = "medium",
+ srcs = [
+ "src/tests/addressmap_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'stack_trace_table_test',
- srcs = [
- 'src/tests/stack_trace_table_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "system_alloc_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/system-alloc_unittest.cc",
+ ]),
+ copts = common_copts + [
+ "-fno-builtin",
+ ],
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'thread_dealloc_unittest',
- srcs = [
- 'src/tests/thread_dealloc_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ':testutil',
- ],
- copts = common_copts,
- size = 'small',
+ name = "packed_cache_test",
+ size = "small",
+ srcs = [
+ "src/tests/packed-cache_test.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
-'''
+cc_test(
+ name = "frag_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/frag_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "markidle_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/markidle_unittest.cc",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ":testutil",
+ ],
+)
+
+cc_test(
+ name = "current_allocated_bytes_test",
+ size = "small",
+ srcs = [
+ "src/tests/current_allocated_bytes_test.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "malloc_hook_test",
+ size = "small",
+ srcs = [
+ "src/tests/malloc_hook_test.cc",
+ ],
+ copts = common_copts + compiler_select({
+ "gcc": [
+ "-Wno-maybe-uninitialized",
+ ],
+ "clang": [],
+ }),
+ deps = [
+ ":tcmalloc",
+ ":testutil",
+ ],
+)
+
+cc_test(
+ name = "malloc_extension_test",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/malloc_extension_test.cc",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "malloc_extension_c_test",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/malloc_extension_c_test.c",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "memalign_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/memalign_unittest.cc",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ":testutil",
+ ],
+)
+
+cc_test(
+ name = "page_heap_test",
+ size = "small",
+ srcs = [
+ "src/tests/page_heap_test.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "pagemap_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/pagemap_unittest.cc",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "realloc_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/realloc_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "stack_trace_table_test",
+ size = "small",
+ srcs = [
+ "src/tests/stack_trace_table_test.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
+)
+
+cc_test(
+ name = "thread_dealloc_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/thread_dealloc_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ":testutil",
+ ],
+)
+
+"""
We don't build this because it actually needs to be in a separate binary.
cc_test(
name = 'debugallocation_test',
@@ -433,91 +436,91 @@
copts = common_copts,
size = 'small',
)
-'''
+"""
cc_test(
- name = 'tcmalloc_large_heap_fragmentation_unittest',
- srcs = empty_main_if_asan([
- 'src/tests/large_heap_fragmentation_unittest.cc',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "tcmalloc_large_heap_fragmentation_unittest",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/large_heap_fragmentation_unittest.cc",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'raw_printer_test',
- srcs = [
- 'src/tests/raw_printer_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "raw_printer_test",
+ size = "small",
+ srcs = [
+ "src/tests/raw_printer_test.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'getpc_test',
- srcs = empty_main_if_asan([
- 'src/tests/getpc_test.cc',
- ]),
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "getpc_test",
+ size = "small",
+ srcs = empty_main_if_asan([
+ "src/tests/getpc_test.cc",
+ ]),
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'profiledata_unittest',
- srcs = [
- 'src/tests/profiledata_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "profiledata_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/profiledata_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'profile_handler_unittest',
- srcs = [
- 'src/tests/profile-handler_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- flaky = True,
- size = 'small',
+ name = "profile_handler_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/profile-handler_unittest.cc",
+ ],
+ copts = common_copts,
+ flaky = True,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'heap_profiler_unittest',
- srcs = [
- 'src/tests/heap-profiler_unittest.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts,
- size = 'small',
+ name = "heap_profiler_unittest",
+ size = "small",
+ srcs = [
+ "src/tests/heap-profiler_unittest.cc",
+ ],
+ copts = common_copts,
+ deps = [
+ ":tcmalloc",
+ ],
)
cc_test(
- name = 'sampler_test',
- srcs = [
- 'src/tests/sampler_test.cc',
- ],
- deps = [
- ':tcmalloc',
- ],
- copts = common_copts + [
- '-Wno-type-limits',
- ],
- size = 'small',
+ name = "sampler_test",
+ size = "small",
+ srcs = [
+ "src/tests/sampler_test.cc",
+ ],
+ copts = common_copts + [
+ "-Wno-type-limits",
+ ],
+ deps = [
+ ":tcmalloc",
+ ],
)
diff --git a/third_party/protobuf/gmock.BUILD b/third_party/protobuf/gmock.BUILD
index 82abf27..f8b486c 100644
--- a/third_party/protobuf/gmock.BUILD
+++ b/third_party/protobuf/gmock.BUILD
@@ -15,14 +15,14 @@
"gmock-1.7.0/gtest/include",
"gmock-1.7.0/include",
],
- linkopts = ["-pthread"],
+ linkopts = ["-lpthread"],
visibility = ["//visibility:public"],
)
cc_library(
name = "gtest_main",
srcs = ["gmock-1.7.0/src/gmock_main.cc"],
- linkopts = ["-pthread"],
+ linkopts = ["-lpthread"],
visibility = ["//visibility:public"],
deps = [":gtest"],
)
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD
index f5dfe10..bc094aa 100644
--- a/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -1,168 +1,200 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
cc_library(
- name = 'empty_main',
- srcs = [ 'empty_main.c' ],
+ name = "empty_main",
+ srcs = ["empty_main.c"],
)
cc_library(
- name = 'malloc',
- deps = select({
- '//tools:has_asan': [],
- '//tools:has_tsan': [],
- '//tools:cpu_cortex_m4f': [],
- '//conditions:default': ['//third_party/gperftools:tcmalloc'],
- }),
+ name = "malloc",
+ deps = select({
+ "//tools:has_asan": [],
+ "//tools:has_tsan": [],
+ "//tools:cpu_cortex_m4f": [],
+ "//conditions:default": ["//third_party/gperftools:tcmalloc"],
+ }),
)
cc_library(
- name = 'stl',
+ name = "stl",
)
filegroup(
- name = 'empty',
- srcs = [],
+ name = "empty",
+ srcs = [],
)
# This is the entry point for --crosstool_top.
cc_toolchain_suite(
- name = 'toolchain',
- toolchains = {
- 'k8|clang': ':cc-compiler-k8',
- 'roborio|gcc': ':cc-compiler-roborio',
- 'armhf-debian|clang': 'cc-compiler-armhf-debian',
- 'cortex-m4f|gcc': 'cc-compiler-cortex-m4f',
- },
+ name = "toolchain",
+ toolchains = {
+ "k8|clang": ":cc-compiler-k8",
+ "roborio|gcc": ":cc-compiler-roborio",
+ "armhf-debian|clang": "cc-compiler-armhf-debian",
+ "cortex-m4f|gcc": "cc-compiler-cortex-m4f",
+ },
)
# Compiler inputs given by --copt etc in //tools:bazel.rc.
filegroup(
- name = 'flags_compiler_inputs',
- srcs = select({
- '//tools:has_asan': [
- 'asan-blacklist',
+ name = "flags_compiler_inputs",
+ srcs = select({
+ "//tools:has_asan": [
+ "asan-blacklist",
+ ],
+ "//tools:has_ubsan": [
+ "ubsan-blacklist",
+ ],
+ "//conditions:default": [],
+ }),
+)
+
+filegroup(
+ name = "clang_3p6_all_files",
+ srcs = [
+ ":flags_compiler_inputs",
+ "//tools/cpp/clang_3p6:as",
+ "//tools/cpp/clang_3p6:tool-wrappers",
+ "@clang_3p6_repo//:compiler_pieces",
],
- '//tools:has_ubsan': [
- 'ubsan-blacklist',
+)
+
+filegroup(
+ name = "clang_3p6_linker_files",
+ srcs = [
+ "//tools/cpp/clang_3p6:ar",
+ "//tools/cpp/clang_3p6:clang",
+ "//tools/cpp/clang_3p6:clang-symlinks",
+ "//tools/cpp/clang_3p6:ld",
+ "@clang_3p6_repo//:compiler_pieces",
],
- '//conditions:default': [],
- }),
+)
+
+filegroup(
+ name = "clang_3p6_compiler_files",
+ srcs = [
+ "//tools/cpp/clang_3p6:clang",
+ "//tools/cpp/clang_3p6:ld",
+ "@clang_3p6_repo//:compiler_components",
+ "@clang_3p6_repo//:compiler_pieces",
+ ],
)
cc_toolchain(
- name = 'cc-compiler-k8',
- all_files = ':flags_compiler_inputs',
- compiler_files = ':flags_compiler_inputs',
- cpu = 'local',
- dwp_files = ':empty',
- dynamic_runtime_libs = [':empty'],
- linker_files = ':empty',
- objcopy_files = ':empty',
- static_runtime_libs = [':empty'],
- strip_files = ':empty',
- supports_param_files = 1,
+ name = "cc-compiler-k8",
+ all_files = ":clang_3p6_all_files",
+ compiler_files = ":clang_3p6_compiler_files",
+ cpu = "k8",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":clang_3p6_linker_files",
+ objcopy_files = "//tools/cpp/clang_3p6:objcopy",
+ static_runtime_libs = [":empty"],
+ strip_files = "//tools/cpp/clang_3p6:strip",
+ supports_param_files = 1,
)
filegroup(
- name = 'roborio-compiler-files',
- srcs = [
- '//tools/cpp/arm-frc-linux-gnueabi:tool-wrappers',
- '//tools/cpp/arm-frc-linux-gnueabi:as',
- '@arm_frc_linux_gnueabi_repo//:compiler_pieces',
- ':flags_compiler_inputs',
- ],
+ name = "roborio-compiler-files",
+ srcs = [
+ ":flags_compiler_inputs",
+ "//tools/cpp/arm-frc-linux-gnueabi:as",
+ "//tools/cpp/arm-frc-linux-gnueabi:tool-wrappers",
+ "@arm_frc_linux_gnueabi_repo//:compiler_pieces",
+ ],
)
filegroup(
- name = 'roborio_linker_files',
- srcs = [
- '//tools/cpp/arm-frc-linux-gnueabi:ld',
- '//tools/cpp/arm-frc-linux-gnueabi:ar',
- '//tools/cpp/arm-frc-linux-gnueabi:gcc',
- '//tools/cpp/arm-frc-linux-gnueabi:libs',
- '@arm_frc_linux_gnueabi_repo//:compiler_pieces',
- ],
+ name = "roborio_linker_files",
+ srcs = [
+ "//tools/cpp/arm-frc-linux-gnueabi:ar",
+ "//tools/cpp/arm-frc-linux-gnueabi:gcc",
+ "//tools/cpp/arm-frc-linux-gnueabi:ld",
+ "//tools/cpp/arm-frc-linux-gnueabi:libs",
+ "@arm_frc_linux_gnueabi_repo//:compiler_pieces",
+ ],
)
+
filegroup(
- name = 'roborio_compiler_files',
- srcs = [
- '//tools/cpp/arm-frc-linux-gnueabi:gcc',
- '//tools/cpp/arm-frc-linux-gnueabi:ld',
- '@arm_frc_linux_gnueabi_repo//:compiler_components',
- '@arm_frc_linux_gnueabi_repo//:compiler_pieces',
- ],
+ name = "roborio_compiler_files",
+ srcs = [
+ "//tools/cpp/arm-frc-linux-gnueabi:gcc",
+ "//tools/cpp/arm-frc-linux-gnueabi:ld",
+ "@arm_frc_linux_gnueabi_repo//:compiler_components",
+ "@arm_frc_linux_gnueabi_repo//:compiler_pieces",
+ ],
)
cc_toolchain(
- name = 'cc-compiler-roborio',
- all_files = ':roborio-compiler-files',
- compiler_files = ':roborio_compiler_files',
- cpu = 'roborio',
- dwp_files = ':empty',
- dynamic_runtime_libs = [':empty'],
- linker_files = ':roborio_linker_files',
- objcopy_files = '//tools/cpp/arm-frc-linux-gnueabi:objcopy',
- static_runtime_libs = [':empty'],
- strip_files = '//tools/cpp/arm-frc-linux-gnueabi:strip',
- supports_param_files = 1,
+ name = "cc-compiler-roborio",
+ all_files = ":roborio-compiler-files",
+ compiler_files = ":roborio_compiler_files",
+ cpu = "roborio",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":roborio_linker_files",
+ objcopy_files = "//tools/cpp/arm-frc-linux-gnueabi:objcopy",
+ static_runtime_libs = [":empty"],
+ strip_files = "//tools/cpp/arm-frc-linux-gnueabi:strip",
+ supports_param_files = 1,
)
filegroup(
- name = 'linaro-gcc-files',
- srcs = [
- '//tools/cpp/linaro_linux_gcc:clang-symlinks',
- '//tools/cpp/linaro_linux_gcc:tool-wrappers',
- '@linaro_linux_gcc_4_9_repo//:compiler_pieces',
- ],
+ name = "linaro-gcc-files",
+ srcs = [
+ "//tools/cpp/linaro_linux_gcc:clang-symlinks",
+ "//tools/cpp/linaro_linux_gcc:tool-wrappers",
+ "@linaro_linux_gcc_4_9_repo//:compiler_pieces",
+ ],
)
filegroup(
- name = 'linaro_linux_linker_files',
- srcs = [
- '//tools/cpp/linaro_linux_gcc:gcc',
- '//tools/cpp/linaro_linux_gcc:ld',
- '//tools/cpp/linaro_linux_gcc:ar',
- '//tools/cpp/linaro_linux_gcc:clang-ld',
- '//tools/cpp/linaro_linux_gcc:clang',
- '@linaro_linux_gcc_4_9_repo//:compiler_pieces',
- '//tools/cpp/linaro_linux_gcc:clang-symlinks',
- ],
+ name = "linaro_linux_linker_files",
+ srcs = [
+ "//tools/cpp/linaro_linux_gcc:ar",
+ "//tools/cpp/linaro_linux_gcc:clang",
+ "//tools/cpp/linaro_linux_gcc:clang-ld",
+ "//tools/cpp/linaro_linux_gcc:clang-symlinks",
+ "//tools/cpp/linaro_linux_gcc:gcc",
+ "//tools/cpp/linaro_linux_gcc:ld",
+ "@linaro_linux_gcc_4_9_repo//:compiler_pieces",
+ ],
)
filegroup(
- name = 'linaro_linux_compiler_files',
- srcs = [
- '//tools/cpp/linaro_linux_gcc:gcc',
- '//tools/cpp/linaro_linux_gcc:ld',
- '//tools/cpp/linaro_linux_gcc:clang',
- '//tools/cpp/linaro_linux_gcc:as',
- ],
+ name = "linaro_linux_compiler_files",
+ srcs = [
+ "//tools/cpp/linaro_linux_gcc:as",
+ "//tools/cpp/linaro_linux_gcc:clang",
+ "//tools/cpp/linaro_linux_gcc:gcc",
+ "//tools/cpp/linaro_linux_gcc:ld",
+ ],
)
cc_toolchain(
- name = 'cc-compiler-armhf-debian',
- all_files = ':linaro-gcc-files',
- compiler_files = ':linaro_linux_compiler_files',
- cpu = 'armhf',
- dwp_files = ':empty',
- dynamic_runtime_libs = [':empty'],
- linker_files = ':linaro_linux_linker_files',
- objcopy_files = '//tools/cpp/linaro_linux_gcc:objcopy',
- static_runtime_libs = [':empty'],
- strip_files = '//tools/cpp/linaro_linux_gcc:strip',
- supports_param_files = 1,
+ name = "cc-compiler-armhf-debian",
+ all_files = ":linaro-gcc-files",
+ compiler_files = ":linaro_linux_compiler_files",
+ cpu = "armhf",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":linaro_linux_linker_files",
+ objcopy_files = "//tools/cpp/linaro_linux_gcc:objcopy",
+ static_runtime_libs = [":empty"],
+ strip_files = "//tools/cpp/linaro_linux_gcc:strip",
+ supports_param_files = 1,
)
cc_toolchain(
- name = 'cc-compiler-cortex-m4f',
- all_files = ':empty',
- compiler_files = ':empty',
- cpu = 'cortex-m4',
- dwp_files = ':empty',
- dynamic_runtime_libs = [':empty'],
- linker_files = '//motors/core:linkerscript',
- objcopy_files = ':empty',
- static_runtime_libs = [':empty'],
- strip_files = ':empty',
- supports_param_files = 0,
+ name = "cc-compiler-cortex-m4f",
+ all_files = ":empty",
+ compiler_files = ":empty",
+ cpu = "cortex-m4",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = "//motors/core:linkerscript",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ supports_param_files = 0,
)
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index 55abdc4..b29c5ad 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -79,38 +79,64 @@
target_system_name: "k8"
toolchain_identifier: "k8_linux"
- tool_path { name: "ar" path: "/usr/bin/ar" }
- tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
- tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/clang-3.6" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ # These paths are relative to //tools/cpp.
+ tool_path { name: "ar" path: "clang_3p6/x86_64-linux-gnu-ar" }
+ tool_path { name: "compat-ld" path: "clang_3p6/x86_64-linux-gnu-ld" }
+ tool_path { name: "cpp" path: "clang_3p6/x86_64-linux-gnu-cpp" }
+ tool_path { name: "dwp" path: "clang_3p6/x86_64-linux-gnu-dwp" }
+ tool_path { name: "gcc" path: "clang_3p6/x86_64-linux-gnu-clang-3.6" }
+ tool_path { name: "gcov" path: "clang_3p6/x86_64-linux-gnu-gcov" }
# C(++) compiles invoke the compiler (as that is the one knowing where
# to find libraries), but we provide LD so other rules can invoke the linker.
- tool_path { name: "ld" path: "/usr/bin/ld" }
- tool_path { name: "nm" path: "/usr/bin/nm" }
- tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
+ tool_path { name: "ld" path: "clang_3p6/x86_64-linux-gnu-ld" }
+ tool_path { name: "nm" path: "clang_3p6/x86_64-linux-gnu-nm" }
+ tool_path { name: "objcopy" path: "clang_3p6/x86_64-linux-gnu-objcopy" }
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
- tool_path { name: "objdump" path: "/usr/bin/objdump" }
- tool_path { name: "strip" path: "/usr/bin/strip" }
+ tool_path { name: "objdump" path: "clang_3p6/x86_64-linux-gnu-objdump" }
+ tool_path { name: "strip" path: "clang_3p6/x86_64-linux-gnu-strip" }
linking_mode_flags { mode: DYNAMIC }
+ compiler_flag: "--sysroot=external/clang_3p6_repo/"
+ compiler_flag: "-nostdinc"
+ compiler_flag: "-isystem"
+ compiler_flag: "external/clang_3p6_repo/usr/include",
+ compiler_flag: "-isystem"
+ compiler_flag: "external/clang_3p6_repo/usr/include/x86_64-linux-gnu",
+ compiler_flag: "-isystem"
+ compiler_flag: "external/clang_3p6_repo/usr/lib/llvm-3.6/lib/clang/3.6.2/include",
+
+ cxx_flag: "-isystem"
+ cxx_flag: "external/clang_3p6_repo/usr/include/c++/4.9"
+ cxx_flag: "-isystem"
+ cxx_flag: "external/clang_3p6_repo/usr/include/x86_64-linux-gnu/c++/4.9"
+ cxx_flag: "-isystem"
+ cxx_flag: "external/clang_3p6_repo/usr/include/c++/4.9/backward"
+
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
# absolute locations and has no remote execution, yet. However, this will need
# to be fixed, maybe with auto-detection?
- cxx_builtin_include_directory: '/usr/include/c++/4.9'
- cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu/c++/4.9'
- cxx_builtin_include_directory: '/usr/include/c++/4.9/backward'
- cxx_builtin_include_directory: '/usr/local/include'
- cxx_builtin_include_directory: '/usr/lib/llvm-3.6/lib/clang/3.6.2/include'
- cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu'
- cxx_builtin_include_directory: '/usr/include'
- cxx_builtin_include_directory: '/usr/lib/clang/3.6.2/include'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/c++/4.9'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/x86_64-linux-gnu/c++/4.9'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/c++/4.9/backward'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/local/include'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/lib/llvm-3.6/lib/clang/3.6.2/include'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/x86_64-linux-gnu'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include'
+ cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/lib/clang/3.6.2/include'
+ linker_flag: "-nodefaultlibs"
+ linker_flag: "--sysroot=external/clang_3p6_repo/"
linker_flag: "-lstdc++"
- linker_flag: "-B/usr/bin/"
+ linker_flag: "-lc"
+ linker_flag: "-lgcc"
+ linker_flag: "-lgcc_s"
+ linker_flag: "-Bexternal/clang_3p6_repo/usr/bin/"
+ linker_flag: "-Ltools/cpp/clang_3p6/clang_more_libs"
+ linker_flag: "-Lexternal/clang_3p6/lib/x86_64-linux-gnu"
+ linker_flag: "-Lexternal/clang_3p6/usr/lib/x86_64-linux-gnu"
+ linker_flag: "-Lexternal/clang_3p6/usr/lib/gcc/x86_64-linux-gnu"
feature {
name: "opt"
diff --git a/tools/cpp/clang_3p6/BUILD b/tools/cpp/clang_3p6/BUILD
new file mode 100644
index 0000000..23504d7
--- /dev/null
+++ b/tools/cpp/clang_3p6/BUILD
@@ -0,0 +1,86 @@
+package(default_visibility = ["//tools/cpp:__pkg__"])
+
+filegroup(
+ name = "ar",
+ srcs = [
+ "x86_64-linux-gnu-ar",
+ "@clang_3p6_repo//:ar",
+ ],
+)
+
+filegroup(
+ name = "ld",
+ srcs = [
+ "x86_64-linux-gnu-ld",
+ "@clang_3p6_repo//:ld",
+ ],
+)
+
+filegroup(
+ name = "nm",
+ srcs = [
+ "x86_64-linux-gnu-nm",
+ "@clang_3p6_repo//:nm",
+ ],
+)
+
+filegroup(
+ name = "objcopy",
+ srcs = [
+ "x86_64-linux-gnu-objcopy",
+ "@clang_3p6_repo//:objcopy",
+ ],
+)
+
+filegroup(
+ name = "objdump",
+ srcs = [
+ "x86_64-linux-gnu-objdump",
+ "@clang_3p6_repo//:objdump",
+ ],
+)
+
+filegroup(
+ name = "strip",
+ srcs = [
+ "x86_64-linux-gnu-strip",
+ "@clang_3p6_repo//:strip",
+ ],
+)
+
+filegroup(
+ name = "as",
+ srcs = [
+ "x86_64-linux-gnu-as",
+ "@clang_3p6_repo//:as",
+ ],
+)
+
+filegroup(
+ name = "clang",
+ srcs = [
+ "x86_64-linux-gnu-clang-3.6",
+ "@clang_3p6_repo//:clang",
+ ],
+)
+
+filegroup(
+ name = "tool-wrappers",
+ srcs = [
+ ":ar",
+ ":as",
+ ":clang",
+ ":ld",
+ ":nm",
+ ":objcopy",
+ ":objdump",
+ ":strip",
+ ],
+)
+
+filegroup(
+ name = "clang-symlinks",
+ srcs = glob([
+ "clang_more_libs/**",
+ ]),
+)
diff --git a/tools/cpp/clang_3p6/clang_3p6.BUILD b/tools/cpp/clang_3p6/clang_3p6.BUILD
new file mode 100644
index 0000000..648a511
--- /dev/null
+++ b/tools/cpp/clang_3p6/clang_3p6.BUILD
@@ -0,0 +1,112 @@
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "clang-format",
+ srcs = [
+ "usr/bin/clang-3.6",
+ ":compiler_pieces",
+ ],
+)
+
+filegroup(
+ name = "clang",
+ srcs = [
+ "usr/bin/clang-3.6",
+ ],
+)
+
+filegroup(
+ name = "ar",
+ srcs = [
+ "usr/bin/ar",
+ ],
+)
+
+filegroup(
+ name = "ld",
+ srcs = [
+ "usr/bin/ld",
+ ],
+)
+
+filegroup(
+ name = "nm",
+ srcs = [
+ "usr/bin/nm",
+ ],
+)
+
+filegroup(
+ name = "objcopy",
+ srcs = [
+ "usr/bin/objcopy",
+ ],
+)
+
+filegroup(
+ name = "objdump",
+ srcs = [
+ "usr/bin/objdump",
+ ],
+)
+
+filegroup(
+ name = "strip",
+ srcs = [
+ "usr/bin/strip",
+ ],
+)
+
+filegroup(
+ name = "as",
+ srcs = [
+ "usr/bin/as",
+ ],
+)
+
+cc_library(
+ name = "librt",
+ srcs = [
+ "usr/lib/x86_64-linux-gnu/librt.so",
+ ],
+)
+
+cc_library(
+ name = "libdl",
+ srcs = [
+ "usr/lib/x86_64-linux-gnu/libdl.so",
+ ],
+)
+
+cc_library(
+ name = "libm",
+ srcs = [
+ "usr/lib/x86_64-linux-gnu/libm.so",
+ ],
+)
+
+filegroup(
+ name = "compiler_pieces",
+ srcs = glob(
+ [
+ "**",
+ ],
+ exclude = [
+ "usr/share/**",
+ ],
+ ),
+)
+
+filegroup(
+ name = "compiler_components",
+ srcs = [
+ ":ar",
+ ":as",
+ ":clang",
+ ":ld",
+ ":nm",
+ ":objcopy",
+ ":objdump",
+ ":strip",
+ ],
+)
diff --git a/tools/cpp/clang_3p6/clang_more_libs/libc.so b/tools/cpp/clang_3p6/clang_more_libs/libc.so
new file mode 100644
index 0000000..5800d08
--- /dev/null
+++ b/tools/cpp/clang_3p6/clang_more_libs/libc.so
@@ -0,0 +1,5 @@
+/* GNU ld script
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+OUTPUT_FORMAT(elf64-x86-64)
+GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-x86-64.so.2 ) )
diff --git a/tools/cpp/clang_3p6/clang_more_libs/libpthread.so b/tools/cpp/clang_3p6/clang_more_libs/libpthread.so
new file mode 100644
index 0000000..f02ce72
--- /dev/null
+++ b/tools/cpp/clang_3p6/clang_more_libs/libpthread.so
@@ -0,0 +1,5 @@
+/* GNU ld script
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+OUTPUT_FORMAT(elf64-x86-64)
+GROUP ( libpthread.so.0 libpthread_nonshared.a )
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-ar b/tools/cpp/clang_3p6/x86_64-linux-gnu-ar
new file mode 100755
index 0000000..b8ba259
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-ar
@@ -0,0 +1,9 @@
+#!/bin/bash --norc
+
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/lib"
+export LD_LIBRARY_PATH
+
+exec -a ar \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/ar \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-as b/tools/cpp/clang_3p6/x86_64-linux-gnu-as
new file mode 100755
index 0000000..f264544
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-as
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a as \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/as \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-clang-3.6 b/tools/cpp/clang_3p6/x86_64-linux-gnu-clang-3.6
new file mode 100755
index 0000000..369bf41
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-clang-3.6
@@ -0,0 +1,11 @@
+#!/bin/bash --norc
+
+LD_LIBRARY_PATH="${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/lib/x86_64-linux-gnu"
+# TODO(Brian): Figure out why it segfaults with this enabled, and re-enable it.
+#LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/lib/x86_64-linux-gnu"
+LD_LIBRARY_PATH+=":${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/lib"
+export LD_LIBRARY_PATH
+
+exec \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/clang-3.6 \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-cpp b/tools/cpp/clang_3p6/x86_64-linux-gnu-cpp
new file mode 100755
index 0000000..adf3869
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-cpp
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a cpp \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/cpp \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-gcc b/tools/cpp/clang_3p6/x86_64-linux-gnu-gcc
new file mode 100755
index 0000000..4fe1d67
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-gcc
@@ -0,0 +1,6 @@
+#!/bin/bash --norc
+
+PATH="${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/lib/gcc/x86_64-linux-gnu/4.9:$PATH" \
+ exec \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/gcc \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-gcov b/tools/cpp/clang_3p6/x86_64-linux-gnu-gcov
new file mode 100755
index 0000000..e71ab3e
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-gcov
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a gcov \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/gcov \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-ld b/tools/cpp/clang_3p6/x86_64-linux-gnu-ld
new file mode 100755
index 0000000..803a818
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-ld
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a ld \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/ld \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-nm b/tools/cpp/clang_3p6/x86_64-linux-gnu-nm
new file mode 100755
index 0000000..f8d1eb7
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-nm
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a nm \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/nm \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-objcopy b/tools/cpp/clang_3p6/x86_64-linux-gnu-objcopy
new file mode 100755
index 0000000..2a49155
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-objcopy
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a objcopy \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/objcopy \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-objdump b/tools/cpp/clang_3p6/x86_64-linux-gnu-objdump
new file mode 100755
index 0000000..a549b29
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-objdump
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a objdump \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/objdump \
+ "$@"
diff --git a/tools/cpp/clang_3p6/x86_64-linux-gnu-strip b/tools/cpp/clang_3p6/x86_64-linux-gnu-strip
new file mode 100755
index 0000000..0817069
--- /dev/null
+++ b/tools/cpp/clang_3p6/x86_64-linux-gnu-strip
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a strip \
+ ${BAZEL_OUTPUT_ROOT}external/clang_3p6_repo/usr/bin/strip \
+ "$@"