Skip to content

Commit

Permalink
Suppress many compiler warnings
Browse files Browse the repository at this point in the history
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:
protocolbuffers/protobuf#2261
Change: 136555503
  • Loading branch information
jart authored and tensorflower-gardener committed Oct 19, 2016
1 parent 1870811 commit 91d8a6f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions tensorflow/contrib/metrics/kernels/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package(default_visibility = ["//tensorflow:__subpackages__"])
cc_library(
name = "set_kernels",
srcs = ["set_kernels.cc"],
copts = ["-Wno-sign-compare"],
deps = [
"//tensorflow/core:framework_headers_lib",
"//third_party/eigen3",
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/contrib/tfprof/tools/tfprof/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ cc_library(
name = "tfprof_utils",
srcs = ["tfprof_utils.cc"],
hdrs = ["tfprof_utils.h"],
copts = ["-Wno-sign-compare"],
deps = [
":tfprof_options",
"//tensorflow/core:lib",
Expand Down Expand Up @@ -182,6 +183,7 @@ cc_library(
name = "tfprof_tensor",
srcs = ["tfprof_tensor.cc"],
hdrs = ["tfprof_tensor.h"],
copts = ["-Wno-sign-compare"],
deps = [
"//tensorflow/contrib/tfprof/tools/tfprof:protos_all_cc",
"//tensorflow/core:framework",
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/core/kernels/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ cc_library(
name = "ops_util",
srcs = ["ops_util.cc"],
hdrs = ["ops_util.h"],
copts = ["-Wno-sign-compare"],
deps = [
"//tensorflow/core:framework",
"//tensorflow/core:lib",
Expand Down Expand Up @@ -288,6 +289,7 @@ cc_library(
name = "save_restore_tensor",
srcs = ["save_restore_tensor.cc"],
hdrs = ["save_restore_tensor.h"],
copts = ["-Wno-sign-compare"],
deps = [
":bounds_check",
"//tensorflow/core:framework",
Expand Down
1 change: 1 addition & 0 deletions tensorflow/core/platform/default/build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def tf_proto_library_cc(name, srcs = [], has_services = None,
srcs = srcs + tf_deps(deps, "_proto_srcs"),
deps = deps + ["@protobuf//:cc_wkt_protos"],
cc_libs = cc_libs + ["@protobuf//:protobuf"],
copts = ["-Wno-unused-but-set-variable", "-Wno-sign-compare"],
protoc = "@protobuf//:protoc",
default_runtime = "@protobuf//:protobuf",
use_grpc_plugin = use_grpc_plugin,
Expand Down
1 change: 1 addition & 0 deletions tensorflow/core/util/tensor_bundle/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cc_library(
name = "tensor_bundle",
srcs = ["tensor_bundle.cc"],
hdrs = ["tensor_bundle.h"],
copts = ["-Wno-sign-compare"],
deps = [
":naming",
"//tensorflow/core:core_cpu_internal",
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ cc_library(
cc_binary(
name = "framework/test_file_system.so",
srcs = ["framework/test_file_system.cc"],
copts = ["-Wno-sign-compare"],
linkopts = select({
"//conditions:default": [
"-lm",
Expand Down Expand Up @@ -217,6 +218,7 @@ cc_library(
name = "cpp_shape_inference",
srcs = ["framework/cpp_shape_inference.cc"],
hdrs = ["framework/cpp_shape_inference.h"],
copts = ["-Wno-sign-compare"],
visibility = ["//visibility:public"],
deps = [
":numpy_lib",
Expand Down
13 changes: 8 additions & 5 deletions tensorflow/tensorflow.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ def if_not_mobile(a):
})

def tf_copts():
return (["-fno-exceptions",
"-DEIGEN_AVOID_STL_ARRAY",
"-Iexternal/gemmlowp",] +
return (["-DEIGEN_AVOID_STL_ARRAY",
"-Iexternal/gemmlowp",
"-Wno-sign-compare",
"-fno-exceptions"] +
if_cuda(["-DGOOGLE_CUDA=1"]) +
if_android_arm(["-mfpu=neon"]) +
select({
Expand All @@ -155,7 +156,7 @@ def tf_copts():
"-O2",
],
"//tensorflow:darwin": [],
"//tensorflow:ios": ["-std=c++11",],
"//tensorflow:ios": ["-std=c++11"],
"//conditions:default": ["-pthread"]}))

def tf_opts_nortti_if_android():
Expand Down Expand Up @@ -770,7 +771,9 @@ def tf_py_wrap_cc(name, srcs, swig_includes=[], deps=[], copts=[], **kwargs):
native.cc_binary(
name=cc_library_name,
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()),
linkopts=tf_extension_linkopts() + extra_linkopts,
linkstatic=1,
Expand Down
1 change: 1 addition & 0 deletions zlib.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ cc_library(
"zutil.h",
],
hdrs = ["zlib.h"],
copts = ["-Wno-implicit-function-declaration"],
includes = ["."],
)

0 comments on commit 91d8a6f

Please sign in to comment.