Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 1 | From aa706d714294b83db696de2beca9a722a512796f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 19 Apr 2022 14:04:40 -0700 |
| 4 | Subject: [PATCH] cmake: Disable nonnull-compare warning on gcc |
| 5 | |
| 6 | GCC finds a legit warning which clang does not on code like this |
| 7 | |
| 8 | class Message; |
| 9 | void SendResponse(Message & aMessage) |
| 10 | { |
| 11 | if ((&aMessage) != nullptr) { return; } |
| 12 | } |
| 13 | |
| 14 | Perhaps it should be fixed upstream but for now disable treating this |
| 15 | warning as error when using gcc |
| 16 | |
| 17 | Upstream-Status: Pending |
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 19 | --- |
| 20 | CMakeLists.txt | 4 ++++ |
| 21 | 1 file changed, 4 insertions(+) |
| 22 | |
| 23 | diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 24 | index 59a567e729..3134740ff6 100644 |
| 25 | --- a/CMakeLists.txt |
| 26 | +++ b/CMakeLists.txt |
| 27 | @@ -57,6 +57,10 @@ endif() |
| 28 | |
| 29 | set(CMAKE_CXX_EXTENSIONS OFF) |
| 30 | |
| 31 | +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") |
| 32 | + add_compile_options(-Wno-error=nonnull-compare) |
| 33 | +endif() |
| 34 | + |
| 35 | if (OTBR_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") |
| 36 | message(STATUS "Coverage: ON") |
| 37 | target_compile_options(otbr-config INTERFACE -g -O0 --coverage) |
| 38 | -- |
| 39 | 2.36.0 |
| 40 | |