From 410f5c3f7d168a92af490679e6a8965b52c69af3 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Mon, 15 Apr 2019 11:34:43 +0700 Subject: [PATCH] build: Add a standard way to use GNU extensions from libc, since we have a general configured newlib in the toolchain --- make/project.mk | 3 +++ tools/cmake/idf_functions.cmake | 3 +++ 2 files changed, 6 insertions(+) diff --git a/make/project.mk b/make/project.mk index 17f07c2cd9..034ad2a15e 100644 --- a/make/project.mk +++ b/make/project.mk @@ -427,6 +427,9 @@ ifdef CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED CPPFLAGS += -DNDEBUG endif +# IDF uses some GNU extension from libc +CPPFLAGS += -D_GNU_SOURCE + # Enable generation of debugging symbols # (we generate even in Release mode, as this has no impact on final binary size.) DEBUG_FLAGS ?= -ggdb diff --git a/tools/cmake/idf_functions.cmake b/tools/cmake/idf_functions.cmake index 104144ac13..d5b7fff1ac 100644 --- a/tools/cmake/idf_functions.cmake +++ b/tools/cmake/idf_functions.cmake @@ -107,6 +107,9 @@ function(idf_set_global_compile_options) list(APPEND c_compile_options "-std=gnu99") list(APPEND cxx_compile_options "-std=gnu++11" "-fno-rtti") + # IDF uses some GNU extension from libc + list(APPEND compile_definitions "_GNU_SOURCE") + if(CONFIG_CXX_EXCEPTIONS) list(APPEND cxx_compile_options "-fexceptions") else()