Suppress many compiler warnings

This includes ~200 -Wsign-compare warnings in TensorFlow, 15
-Wimplicit-function-declaration warnings in zlib, and more.

I'm also working on getting rid of 400 protobuf warnings here:
google/protobuf#2261
Change: 136555503
This commit is contained in:
Justine Tunney 2016-10-18 20:08:41 -08:00 committed by TensorFlower Gardener
parent 18708115af
commit 91d8a6f6a7
8 changed files with 18 additions and 5 deletions

View File

@ -10,6 +10,7 @@ package(default_visibility = ["//tensorflow:__subpackages__"])
cc_library( cc_library(
name = "set_kernels", name = "set_kernels",
srcs = ["set_kernels.cc"], srcs = ["set_kernels.cc"],
copts = ["-Wno-sign-compare"],
deps = [ deps = [
"//tensorflow/core:framework_headers_lib", "//tensorflow/core:framework_headers_lib",
"//third_party/eigen3", "//third_party/eigen3",

View File

@ -122,6 +122,7 @@ cc_library(
name = "tfprof_utils", name = "tfprof_utils",
srcs = ["tfprof_utils.cc"], srcs = ["tfprof_utils.cc"],
hdrs = ["tfprof_utils.h"], hdrs = ["tfprof_utils.h"],
copts = ["-Wno-sign-compare"],
deps = [ deps = [
":tfprof_options", ":tfprof_options",
"//tensorflow/core:lib", "//tensorflow/core:lib",
@ -182,6 +183,7 @@ cc_library(
name = "tfprof_tensor", name = "tfprof_tensor",
srcs = ["tfprof_tensor.cc"], srcs = ["tfprof_tensor.cc"],
hdrs = ["tfprof_tensor.h"], hdrs = ["tfprof_tensor.h"],
copts = ["-Wno-sign-compare"],
deps = [ deps = [
"//tensorflow/contrib/tfprof/tools/tfprof:protos_all_cc", "//tensorflow/contrib/tfprof/tools/tfprof:protos_all_cc",
"//tensorflow/core:framework", "//tensorflow/core:framework",

View File

@ -205,6 +205,7 @@ cc_library(
name = "ops_util", name = "ops_util",
srcs = ["ops_util.cc"], srcs = ["ops_util.cc"],
hdrs = ["ops_util.h"], hdrs = ["ops_util.h"],
copts = ["-Wno-sign-compare"],
deps = [ deps = [
"//tensorflow/core:framework", "//tensorflow/core:framework",
"//tensorflow/core:lib", "//tensorflow/core:lib",
@ -288,6 +289,7 @@ cc_library(
name = "save_restore_tensor", name = "save_restore_tensor",
srcs = ["save_restore_tensor.cc"], srcs = ["save_restore_tensor.cc"],
hdrs = ["save_restore_tensor.h"], hdrs = ["save_restore_tensor.h"],
copts = ["-Wno-sign-compare"],
deps = [ deps = [
":bounds_check", ":bounds_check",
"//tensorflow/core:framework", "//tensorflow/core:framework",

View File

@ -46,6 +46,7 @@ def tf_proto_library_cc(name, srcs = [], has_services = None,
srcs = srcs + tf_deps(deps, "_proto_srcs"), srcs = srcs + tf_deps(deps, "_proto_srcs"),
deps = deps + ["@protobuf//:cc_wkt_protos"], deps = deps + ["@protobuf//:cc_wkt_protos"],
cc_libs = cc_libs + ["@protobuf//:protobuf"], cc_libs = cc_libs + ["@protobuf//:protobuf"],
copts = ["-Wno-unused-but-set-variable", "-Wno-sign-compare"],
protoc = "@protobuf//:protoc", protoc = "@protobuf//:protoc",
default_runtime = "@protobuf//:protobuf", default_runtime = "@protobuf//:protobuf",
use_grpc_plugin = use_grpc_plugin, use_grpc_plugin = use_grpc_plugin,

View File

@ -24,6 +24,7 @@ cc_library(
name = "tensor_bundle", name = "tensor_bundle",
srcs = ["tensor_bundle.cc"], srcs = ["tensor_bundle.cc"],
hdrs = ["tensor_bundle.h"], hdrs = ["tensor_bundle.h"],
copts = ["-Wno-sign-compare"],
deps = [ deps = [
":naming", ":naming",
"//tensorflow/core:core_cpu_internal", "//tensorflow/core:core_cpu_internal",

View File

@ -175,6 +175,7 @@ cc_library(
cc_binary( cc_binary(
name = "framework/test_file_system.so", name = "framework/test_file_system.so",
srcs = ["framework/test_file_system.cc"], srcs = ["framework/test_file_system.cc"],
copts = ["-Wno-sign-compare"],
linkopts = select({ linkopts = select({
"//conditions:default": [ "//conditions:default": [
"-lm", "-lm",
@ -217,6 +218,7 @@ cc_library(
name = "cpp_shape_inference", name = "cpp_shape_inference",
srcs = ["framework/cpp_shape_inference.cc"], srcs = ["framework/cpp_shape_inference.cc"],
hdrs = ["framework/cpp_shape_inference.h"], hdrs = ["framework/cpp_shape_inference.h"],
copts = ["-Wno-sign-compare"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":numpy_lib", ":numpy_lib",

View File

@ -142,9 +142,10 @@ def if_not_mobile(a):
}) })
def tf_copts(): def tf_copts():
return (["-fno-exceptions", return (["-DEIGEN_AVOID_STL_ARRAY",
"-DEIGEN_AVOID_STL_ARRAY", "-Iexternal/gemmlowp",
"-Iexternal/gemmlowp",] + "-Wno-sign-compare",
"-fno-exceptions"] +
if_cuda(["-DGOOGLE_CUDA=1"]) + if_cuda(["-DGOOGLE_CUDA=1"]) +
if_android_arm(["-mfpu=neon"]) + if_android_arm(["-mfpu=neon"]) +
select({ select({
@ -155,7 +156,7 @@ def tf_copts():
"-O2", "-O2",
], ],
"//tensorflow:darwin": [], "//tensorflow:darwin": [],
"//tensorflow:ios": ["-std=c++11",], "//tensorflow:ios": ["-std=c++11"],
"//conditions:default": ["-pthread"]})) "//conditions:default": ["-pthread"]}))
def tf_opts_nortti_if_android(): def tf_opts_nortti_if_android():
@ -770,7 +771,9 @@ def tf_py_wrap_cc(name, srcs, swig_includes=[], deps=[], copts=[], **kwargs):
native.cc_binary( native.cc_binary(
name=cc_library_name, name=cc_library_name,
srcs=[module_name + ".cc"], srcs=[module_name + ".cc"],
copts=(copts + ["-Wno-self-assign", "-Wno-write-strings"] copts=(copts + ["-Wno-self-assign",
"-Wno-sign-compare",
"-Wno-write-strings"]
+ tf_extension_copts()), + tf_extension_copts()),
linkopts=tf_extension_linkopts() + extra_linkopts, linkopts=tf_extension_linkopts() + extra_linkopts,
linkstatic=1, linkstatic=1,

View File

@ -32,5 +32,6 @@ cc_library(
"zutil.h", "zutil.h",
], ],
hdrs = ["zlib.h"], hdrs = ["zlib.h"],
copts = ["-Wno-implicit-function-declaration"],
includes = ["."], includes = ["."],
) )