1From 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
23--- a/CMakeLists.txt
24+++ b/CMakeLists.txt
25@@ -59,6 +59,10 @@ endif()
26 set(CMAKE_CXX_EXTENSIONS OFF)
27 set(CMAKE_EXE_LINKER_FLAGS "-rdynamic ${CMAKE_EXE_LINKER_FLAGS}")
28
29+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
30+	add_compile_options(-Wno-error=nonnull-compare)
31+endif()
32+
33 if (OTBR_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
34     message(STATUS "Coverage: ON")
35     target_compile_options(otbr-config INTERFACE -g -O0 --coverage)
36