Imported Upstream version 1.36.0
[platform/upstream/grpc.git] / bazel / copts.bzl
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 # This is a list of llvm flags to be used when being built with use_strict_warning=1
16 GRPC_LLVM_WARNING_FLAGS = [
17     # Enable all & extra waninrgs
18     "-Wall",
19     "-Wextra",
20     # Consider warnings as errors
21     "-Werror",
22     # Ignore unknown warning flags
23     "-Wno-unknown-warning-option",
24     # A list of flags coming from internal build system
25     "-Wc++20-extensions",
26     "-Wctad-maybe-unsupported",
27     "-Wdeprecated-increment-bool",
28     "-Wfloat-overflow-conversion",
29     "-Wfloat-zero-conversion",
30     "-Wfor-loop-analysis",
31     "-Wformat-security",
32     "-Wgnu-redeclared-enum",
33     "-Winfinite-recursion",
34     "-Wliteral-conversion",
35     "-Wnon-virtual-dtor",
36     "-Woverloaded-virtual",
37     "-Wself-assign",
38     "-Wstring-conversion",
39     "-Wtautological-overlap-compare",
40     "-Wthread-safety-analysis",
41     "-Wthread-safety-beta",
42     "-Wunused-comparison",
43     "-Wvla",
44     # Exceptions but will be removed
45     "-Wno-deprecated-declarations",
46     "-Wno-unused-function",
47 ]
48
49 GRPC_DEFAULT_COPTS = select({
50     "//:use_strict_warning": GRPC_LLVM_WARNING_FLAGS,
51     "//conditions:default": [],
52 })