1# Copyright 2021 the gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""
16Includes default copts.
17"""
18
19# This is a list of llvm flags to be used when being built with use_strict_warning=1
20GRPC_LLVM_WARNING_FLAGS = [
21    # Enable all & extra warnings
22    "-Wall",
23    "-Wextra",
24    # Avoid some known traps
25    "-Wimplicit-fallthrough",
26    # Consider warnings as errors
27    "-Werror",
28    # Ignore unknown warning flags
29    "-Wno-unknown-warning-option",
30    # A list of enabled flags coming from internal build system
31    "-Wc++20-extensions",
32    "-Wctad-maybe-unsupported",
33    "-Wdeprecated-increment-bool",
34    "-Wfloat-overflow-conversion",
35    "-Wfloat-zero-conversion",
36    "-Wfor-loop-analysis",
37    "-Wformat-security",
38    "-Wgnu-redeclared-enum",
39    "-Winfinite-recursion",
40    "-Wliteral-conversion",
41    "-Wnon-virtual-dtor",
42    "-Woverloaded-virtual",
43    "-Wself-assign",
44    "-Wstring-conversion",
45    "-Wtautological-overlap-compare",
46    "-Wthread-safety-analysis",
47    "-Wthread-safety-beta",
48    "-Wunused-but-set-variable",
49    "-Wunused-comparison",
50    "-Wvla",
51    # -Wextra compatibility between gcc and clang
52    "-Wtype-limits",
53    # A list of disabled flags coming from internal build system
54    "-Wno-string-concatenation",
55    # Exceptions but will be removed
56    "-Wno-deprecated-declarations",
57    "-Wno-unused-function",
58]
59
60GRPC_DEFAULT_COPTS = select({
61    "//:use_strict_warning": GRPC_LLVM_WARNING_FLAGS + ["-DUSE_STRICT_WARNING=1"],
62    "//conditions:default": [],
63})
64