copts.bzl 1.9 KB

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