From 0f73144ee98a9c9c8b1e99de38edbe8c30372b12 Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Wed, 16 Feb 2022 21:02:08 +0200 Subject: [PATCH] cmake: Add compiler property for disabling pointer arithmetic warnings Add a compiler property for disabling pointer arithmetic warnings, and implement that property for GCC. Signed-off-by: Yonatan Schachter --- cmake/compiler/compiler_flags_template.cmake | 3 +++ cmake/compiler/gcc/compiler_flags.cmake | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index 63e1a0df6a1..b6fb8eb4d46 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -108,3 +108,6 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics) # Required ASM flags when compiling set_property(TARGET asm PROPERTY required) + +# Compiler flag for disabling pointer arithmetic warnings +set_compiler_property(PROPERTY warning_no_pointer_arithmetic) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 495cd8f0376..df242be4240 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -189,3 +189,6 @@ set_property(TARGET asm PROPERTY required "-xassembler-with-cpp") if (NOT COMPILER STREQUAL "xcc") set_compiler_property(PROPERTY diagnostic -fdiagnostics-color=always) endif() + +# Compiler flag for disabling pointer arithmetic warnings +set_compiler_property(PROPERTY warning_no_pointer_arithmetic "-Wno-pointer-arith")