From 8016448fb15c374c649479c816ec16beefcff1cf Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 28 Mar 2019 16:28:25 +0800 Subject: [PATCH 1/2] coap: silence format truncation warning (appears with GCC 8) --- components/coap/CMakeLists.txt | 2 ++ components/coap/component.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/coap/CMakeLists.txt b/components/coap/CMakeLists.txt index 5c3fcd783d..45788001c8 100644 --- a/components/coap/CMakeLists.txt +++ b/components/coap/CMakeLists.txt @@ -29,3 +29,5 @@ register_component() # TODO: find a way to move this to a port header target_compile_definitions(${COMPONENT_TARGET} PUBLIC WITH_POSIX) +# Silence format truncation warning, until it is fixed upstream +set_source_files_properties(libcoap/src/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation) diff --git a/components/coap/component.mk b/components/coap/component.mk index b5a50afeb7..2eb07afd2c 100644 --- a/components/coap/component.mk +++ b/components/coap/component.mk @@ -10,3 +10,5 @@ COMPONENT_SRCDIRS := libcoap/src libcoap port COMPONENT_SUBMODULES += libcoap +# Silence format truncation warning, until it is fixed upstream +libcoap/src/coap_debug.o: CFLAGS += -Wno-format-truncation From 624725d6e0f5d4557f3dbbb8f3c7597b17698163 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 28 Mar 2019 16:29:13 +0800 Subject: [PATCH 2/2] coap: define WITH_POSIX in coap_config.h instead of globally --- components/coap/CMakeLists.txt | 5 ----- components/coap/Makefile.projbuild | 1 - components/coap/port/include/coap_config.h | 7 +++++-- 3 files changed, 5 insertions(+), 8 deletions(-) delete mode 100644 components/coap/Makefile.projbuild diff --git a/components/coap/CMakeLists.txt b/components/coap/CMakeLists.txt index 45788001c8..1ec70b4990 100644 --- a/components/coap/CMakeLists.txt +++ b/components/coap/CMakeLists.txt @@ -24,10 +24,5 @@ set(COMPONENT_REQUIRES lwip) register_component() -# Needed for coap headers in public builds, also. -# -# TODO: find a way to move this to a port header -target_compile_definitions(${COMPONENT_TARGET} PUBLIC WITH_POSIX) - # Silence format truncation warning, until it is fixed upstream set_source_files_properties(libcoap/src/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation) diff --git a/components/coap/Makefile.projbuild b/components/coap/Makefile.projbuild deleted file mode 100644 index e900b0f9a1..0000000000 --- a/components/coap/Makefile.projbuild +++ /dev/null @@ -1 +0,0 @@ -CPPFLAGS += -DWITH_POSIX diff --git a/components/coap/port/include/coap_config.h b/components/coap/port/include/coap_config.h index db314f2de9..1efa37aa7f 100644 --- a/components/coap/port/include/coap_config.h +++ b/components/coap/port/include/coap_config.h @@ -18,10 +18,13 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ -#ifdef WITH_POSIX -#include "coap_config_posix.h" +/* Always enabled in ESP-IDF */ +#ifndef WITH_POSIX +#define WITH_POSIX #endif +#include "coap_config_posix.h" + #define HAVE_STDIO_H #define HAVE_ASSERT_H