| 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 |
""" |
| 16 |
Includes default copts. |
| 17 |
""" |
| 18 |
|
| 19 |
# This is a list of llvm flags to be used when being built with use_strict_warning=1 |
| 20 |
GRPC_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-comparison", |
| 49 |
"-Wvla", |
| 50 |
# -Wextra compatibility between gcc and clang |
| 51 |
"-Wtype-limits", |
| 52 |
# A list of disabled flags coming from internal build system |
| 53 |
"-Wno-string-concatenation", |
| 54 |
# Exceptions but will be removed |
| 55 |
"-Wno-deprecated-declarations", |
| 56 |
"-Wno-unused-function", |
| 57 |
] |
| 58 |
|
| 59 |
GRPC_DEFAULT_COPTS = select({ |
| 60 |
"//:use_strict_warning": GRPC_LLVM_WARNING_FLAGS + ["-DUSE_STRICT_WARNING=1"], |
| 61 |
"//conditions:default": [], |
| 62 |
}) |