Enforce being pedantic.
PiperOrigin-RevId: 740991314
diff --git a/.bazelrc b/.bazelrc
index b33d137..145ffb1 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -18,17 +18,19 @@
build --action_env=CC=clang
build --action_env=CXX=clang++
-# Use the C++17 standard.
+# Use the C++17 standard in a pedantic manner.
build --cxxopt=-std=c++17
-# Warn about the extensions that are not supported in C++17.
-# TODO(b/391433873): Turn warnings into errors once existing warnings are fixed.
-build --cxxopt=-Wc++17-compat-pedantic
+build --cxxopt=-Wpedantic
+build --cxxopt=-Werror=pedantic
+build --cxxopt=-Wno-error=gcc-compat
# Required by the cc_fuzztest_grammar_library rule, which uses the
# "exec configuration" (https://bazel.build/reference/be/general#cross-compilation-considerations).
# The --cxxopt flag does not apply to the exec configuration, only the
# --host_cxxopt flag (https://bazel.build/docs/user-manual#host-cxxopt).
build --host_cxxopt=-std=c++17
-build --host_cxxopt=-Wc++17-compat-pedantic
+build --host_cxxopt=-Wpedantic
+build --host_cxxopt=-Werror=pedantic
+build --host_cxxopt=-Wno-error=gcc-compat
# Build GoogleTest with ABSL support.
build --define absl=1