aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch
blob: 7c32166797fcbd96f09475d7f5c48c38bcdefc52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From aa706d714294b83db696de2beca9a722a512796f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 19 Apr 2022 14:04:40 -0700
Subject: [PATCH] cmake: Disable nonnull-compare warning on gcc

GCC finds a legit warning which clang does not on code like this

class Message;
void SendResponse(Message & aMessage)
{
    if ((&aMessage) != nullptr) { return; }
}

Perhaps it should be fixed upstream but for now disable treating this
warning as error when using gcc

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,10 @@ endif()
 set(CMAKE_CXX_EXTENSIONS OFF)
 set(CMAKE_EXE_LINKER_FLAGS "-rdynamic ${CMAKE_EXE_LINKER_FLAGS}")
 
+if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+	add_compile_options(-Wno-error=nonnull-compare)
+endif()
+
 if (OTBR_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
     message(STATUS "Coverage: ON")
     target_compile_options(otbr-config INTERFACE -g -O0 --coverage)