Skip to content

Commit cc4136a

Browse files
authored
Merge pull request #835 from mhucka/mhucka-silence-some-warnings
Add bazel flags to silence compiler warnings we can't do anything about
2 parents a35288e + 9954814 commit cc4136a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

configure.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,28 @@ write_to_bazelrc "build -c opt"
102102
write_to_bazelrc "build --cxxopt=\"-D_GLIBCXX_USE_CXX11_ABI=1\""
103103
write_to_bazelrc "build --cxxopt=\"-std=c++17\""
104104

105+
# The transitive inclusion of build rules from TensorFlow ends up including
106+
# and building two copies of zlib (one from bazel_rules, one from the TF code
107+
# baase itself). The version of zlib you get (at least in TF 2.15.0) ends up
108+
# producing many compiler warnings that "a function declaration without a
109+
# prototype is deprecated". It's difficult to patch the particular build rules
110+
# involved, so the approach taken here is to silence those warnings for stuff
111+
# in external/. TODO: figure out how to patch the BUILD files and put it there.
112+
write_to_bazelrc "build --per_file_copt=external/.*@-Wno-deprecated-non-prototype"
113+
write_to_bazelrc "build --host_per_file_copt=external/.*@-Wno-deprecated-non-prototype"
114+
115+
# Similarly, these are other harmless warnings about unused functions coming
116+
# from things pulled in by the TF bazel config rules.
117+
write_to_bazelrc "build --per_file_copt=external/com_google_protobuf/.*@-Wno-unused-function"
118+
write_to_bazelrc "build --host_per_file_copt=external/com_google_protobuf/.*@-Wno-unused-function"
119+
120+
# The following supress warnings coming from qsim.
121+
# TODO: fix the code in qsim & update TFQ to use the updated version.
122+
write_to_bazelrc "build --per_file_copt=tensorflow_quantum/core/ops/noise/tfq_.*@-Wno-unused-but-set-variable"
123+
write_to_bazelrc "build --host_per_file_copt=tensorflow_quantum/core/ops/noise/tfq_.*@-Wno-unused-but-set-variable"
124+
write_to_bazelrc "build --per_file_copt=tensorflow_quantum/core/ops/math_ops/tfq_.*@-Wno-deprecated-declarations"
125+
write_to_bazelrc "build --host_per_file_copt=tensorflow_quantum/core/ops/math_ops/tfq_.*@-Wno-deprecated-declarations"
126+
105127

106128
if is_windows; then
107129
# Use pywrap_tensorflow instead of tensorflow_framework on Windows

0 commit comments

Comments
 (0)