Przeglądaj źródła

Merge branch 'bugfix/coap_gcc8_format_error' into 'master'

coap: fix format error with GCC 8, define WITH_POSIX in the port header

See merge request idf/esp-idf!4639
Ivan Grokhotkov 6 lat temu
rodzic
commit
7cbd863d04

+ 2 - 5
components/coap/CMakeLists.txt

@@ -24,8 +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)

+ 0 - 1
components/coap/Makefile.projbuild

@@ -1 +0,0 @@
-CPPFLAGS += -DWITH_POSIX

+ 2 - 0
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

+ 5 - 2
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