blob: f0bb392a9fa49d11759d24162e666e1d36a9e326 [file] [log] [blame]
Patrick Williams03907ee2022-05-01 06:28:52 -05001From aa706d714294b83db696de2beca9a722a512796f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 19 Apr 2022 14:04:40 -0700
4Subject: [PATCH] cmake: Disable nonnull-compare warning on gcc
5
6GCC finds a legit warning which clang does not on code like this
7
8class Message;
9void SendResponse(Message & aMessage)
10{
11 if ((&aMessage) != nullptr) { return; }
12}
13
14Perhaps it should be fixed upstream but for now disable treating this
15warning as error when using gcc
16
17Upstream-Status: Pending
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 CMakeLists.txt | 4 ++++
21 1 file changed, 4 insertions(+)
22
23diff --git a/CMakeLists.txt b/CMakeLists.txt
24index 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--
392.36.0
40