diff --git a/configure.ac b/configure.ac index 144d32ec0..199767fb9 100644 --- a/configure.ac +++ b/configure.ac @@ -349,7 +349,7 @@ NL_ENABLE_TESTS([yes]) AM_CONDITIONAL([OPENTHREAD_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"]) -# +# # CLI Library # AC_ARG_ENABLE(cli-app, @@ -1128,34 +1128,27 @@ AC_MSG_NOTICE([checking required package dependencies]) # NL_WITH_PACKAGE(...) -# -# Checks for missing functions -# - -AC_DEFUN([CHECK_MISSING_FUNC], [ - AC_CHECK_FUNC($1, [], [ - nl_cv_missing_$1=yes - MISSING_CPPFLAGS="${MISSING_CPPFLAGS} "'-include $(top_srcdir)/src/missing/$1/$1.h' - MISSING_LIBADD="${MISSING_LIBADD} "'$(top_builddir)/src/missing/$1/lib$1.la' - ]) - AM_CONDITIONAL(m4_toupper(MISSING_$1), [test "${nl_cv_missing_$1}" = "yes"]) -]) -AC_SUBST(MISSING_CPPFLAGS) -AC_SUBST(MISSING_LIBADD) - -CHECK_MISSING_FUNC([strlcpy]) -CHECK_MISSING_FUNC([strlcat]) - # # Check for headers # + +OLD_CFLAGS="${CFLAGS}" +CFLAGS="${CFLAGS} -Wno-error=address" AC_HEADER_STDBOOL +CFLAGS="${OLD_CFLAGS}" AC_HEADER_STDC AC_CHECK_HEADERS([stdint.h]) AC_CHECK_HEADERS([string.h]) +# +# Missing Functions +# +AC_CHECK_FUNC([strlcpy], [AC_DEFINE([HAVE_STRLCPY], [1], [Define if strlcpy exists.])]) +AC_CHECK_FUNC([strlcat], [AC_DEFINE([HAVE_STRLCAT], [1], [Define if strlcpy exists.])]) +AC_CHECK_FUNC([strnlen], [AC_DEFINE([HAVE_STRNLEN], [1], [Define if strlcpy exists.])]) + # # Check for types and structures # @@ -1204,11 +1197,6 @@ src/cli/Makefile src/ncp/Makefile src/core/Makefile src/diag/Makefile -src/missing/Makefile -src/missing/stdbool/Makefile -src/missing/stdint/Makefile -src/missing/strlcat/Makefile -src/missing/strlcpy/Makefile third_party/Makefile third_party/mbedtls/Makefile examples/Makefile diff --git a/etc/visual-studio/libopenthread-cli-windows.vcxproj b/etc/visual-studio/libopenthread-cli-windows.vcxproj index e24ef0840..d3cd68dfb 100644 --- a/etc/visual-studio/libopenthread-cli-windows.vcxproj +++ b/etc/visual-studio/libopenthread-cli-windows.vcxproj @@ -49,7 +49,6 @@ ..\..\include; ..\..\src; ..\..\src\core; - ..\..\src\missing; Level3 true diff --git a/etc/visual-studio/libopenthread-cli.vcxproj b/etc/visual-studio/libopenthread-cli.vcxproj index 98e8898ad..b62fec851 100644 --- a/etc/visual-studio/libopenthread-cli.vcxproj +++ b/etc/visual-studio/libopenthread-cli.vcxproj @@ -49,7 +49,6 @@ ..\..\include; ..\..\src; ..\..\src\core; - ..\..\src\missing; ..\..\third_party\mbedtls; ..\..\third_party\mbedtls\repo\include; diff --git a/etc/visual-studio/libopenthread-ncp-spi.vcxproj b/etc/visual-studio/libopenthread-ncp-spi.vcxproj index 495e3f2bb..a03590ad5 100644 --- a/etc/visual-studio/libopenthread-ncp-spi.vcxproj +++ b/etc/visual-studio/libopenthread-ncp-spi.vcxproj @@ -51,7 +51,6 @@ ..\..\include; ..\..\src; ..\..\src\core; - ..\..\src\missing; ..\..\third_party\mbedtls; ..\..\third_party\mbedtls\repo\include; diff --git a/etc/visual-studio/libopenthread-ncp-uart.vcxproj b/etc/visual-studio/libopenthread-ncp-uart.vcxproj index 4288e9660..641503c07 100644 --- a/etc/visual-studio/libopenthread-ncp-uart.vcxproj +++ b/etc/visual-studio/libopenthread-ncp-uart.vcxproj @@ -51,7 +51,6 @@ ..\..\include; ..\..\src; ..\..\src\core; - ..\..\src\missing; ..\..\third_party\mbedtls; ..\..\third_party\mbedtls\repo\include; diff --git a/etc/visual-studio/libopenthread-windows.vcxproj b/etc/visual-studio/libopenthread-windows.vcxproj index f3c1a09b7..3d1980a4f 100644 --- a/etc/visual-studio/libopenthread-windows.vcxproj +++ b/etc/visual-studio/libopenthread-windows.vcxproj @@ -49,7 +49,6 @@ ..\..\include; ..\..\examples\platforms; ..\..\src\core; - ..\..\src\missing; true diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj index f6fa2f640..ec8140caf 100644 --- a/etc/visual-studio/libopenthread.vcxproj +++ b/etc/visual-studio/libopenthread.vcxproj @@ -48,9 +48,6 @@ %(AdditionalIncludeDirectories); ..\..\include; ..\..\src\core; - ..\..\src\missing; - ..\..\src\missing\stdint; - ..\..\src\missing\stdbool; ..\..\third_party\mbedtls; ..\..\third_party\mbedtls\repo\include; @@ -141,8 +138,9 @@ - - + + + @@ -227,8 +225,9 @@ - - + + + diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters index e17ff796e..42c6fd63d 100644 --- a/etc/visual-studio/libopenthread.vcxproj.filters +++ b/etc/visual-studio/libopenthread.vcxproj.filters @@ -300,6 +300,15 @@ Source Files\utils + + Source Files\utils + + + Source Files\utils + + + Source Files\utils + Source Files\meshcop @@ -312,12 +321,6 @@ Source Files\thread - - Source Files\missing - - - Source Files\missing - @@ -554,6 +557,15 @@ Header Files\utils + + Header Files\utils + + + Header Files\utils + + + Header Files\utils + Header Files\common @@ -566,11 +578,5 @@ Header Files\thread - - Header Files\missing - - - Header Files\missing - diff --git a/etc/visual-studio/libopenthread_k.vcxproj b/etc/visual-studio/libopenthread_k.vcxproj index 45f501ca5..5b5a9c7e6 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj +++ b/etc/visual-studio/libopenthread_k.vcxproj @@ -44,6 +44,8 @@ WINDOWS_LOGGING; OPENTHREAD_MULTIPLE_INSTANCE; OPENTHREAD_FTD=1; + HAVE_STDBOOL_H=1; + HAVE_STDINT_H=1; OTBUILD; @@ -51,11 +53,9 @@ ..\..\include; ..\..\examples\drivers\windows\include; ..\..\src\core; - ..\..\src\missing; - ..\..\src\missing\stdint; - ..\..\src\missing\stdbool; ..\..\third_party\mbedtls; ..\..\third_party\mbedtls\repo\include; + ..\..\examples\drivers\windows\include_c99; 4100;4706;4748;%(DisableSpecificWarnings) true @@ -146,8 +146,9 @@ - - + + + @@ -258,8 +259,9 @@ - - + + + diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters index 6e5adf504..a3dd892d2 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj.filters +++ b/etc/visual-studio/libopenthread_k.vcxproj.filters @@ -309,10 +309,13 @@ Source Files\common - + Source Files\missing - + + Source Files\missing + + Source Files\missing @@ -641,10 +644,13 @@ Header Files\api - + Header Files\missing - + + Header Files\missing + + Header Files\missing diff --git a/etc/visual-studio/mbedtls_k.vcxproj b/etc/visual-studio/mbedtls_k.vcxproj index 42ced4b07..a685c1268 100644 --- a/etc/visual-studio/mbedtls_k.vcxproj +++ b/etc/visual-studio/mbedtls_k.vcxproj @@ -39,15 +39,17 @@ ..\..\include; ..\..\src\core; - ..\..\src\missing\stdint; - ..\..\src\missing\stdbool; ..\..\third_party\mbedtls; ..\..\third_party\mbedtls\repo\include; - ..\..\third_party\mbedtls\repo\include\mbedtls + ..\..\third_party\mbedtls\repo\include\mbedtls; + ..\..\examples\drivers\windows\include_c99; %(PreprocessorDefinitions); MBEDTLS_CONFIG_FILE="mbedtls-config.h"; + OPENTHREAD_CONFIG_FILE="openthread-windows-config.h"; + HAVE_STDBOOL_H=1; + HAVE_STDINT_H=1; OPENTHREAD_MULTIPLE_INSTANCE; 4132;4242;4245;4603;4627;4986;4987;4996;%(DisableSpecificWarnings) diff --git a/etc/visual-studio/otLwf.vcxproj b/etc/visual-studio/otLwf.vcxproj index 83880616a..d4f568d47 100644 --- a/etc/visual-studio/otLwf.vcxproj +++ b/etc/visual-studio/otLwf.vcxproj @@ -49,11 +49,10 @@ %(AdditionalIncludeDirectories); ..\..\include; ..\..\examples\drivers\windows\include; + ..\..\examples\drivers\windows\include_c99; ..\..\examples\drivers\windows\otLwf; ..\..\src; ..\..\src\core; - ..\..\src\missing\stdint; - ..\..\src\missing\stdbool; Level4 true diff --git a/etc/visual-studio/spinel_k.vcxproj b/etc/visual-studio/spinel_k.vcxproj index 8778d122c..897d79779 100644 --- a/etc/visual-studio/spinel_k.vcxproj +++ b/etc/visual-studio/spinel_k.vcxproj @@ -40,13 +40,17 @@ %(PreprocessorDefinitions); HAVE_STRNLEN=1; OPENTHREAD_FTD=1; + HAVE_STDBOOL_H=1; + HAVE_STDINT_H=1; SPINEL_PLATFORM_DOESNT_IMPLEMENT_ERRNO_VAR=1; + OPENTHREAD_CONFIG_FILE="openthread-windows-config.h"; + OPENTHREAD_PROJECT_CORE_CONFIG_FILE="openthread-core-windows-config.h"; %(AdditionalIncludeDirectories); ..\..\include; - ..\..\src\missing\stdint; - ..\..\src\missing\stdbool; + ..\..\src\core; + ..\..\examples\drivers\windows\include_c99; 4100;4706;4748;%(DisableSpecificWarnings) true diff --git a/src/missing/stdbool/stdbool.h b/examples/drivers/windows/include_c99/stdbool.h similarity index 100% rename from src/missing/stdbool/stdbool.h rename to examples/drivers/windows/include_c99/stdbool.h diff --git a/src/missing/stdint/stdint.h b/examples/drivers/windows/include_c99/stdint.h similarity index 100% rename from src/missing/stdint/stdint.h rename to examples/drivers/windows/include_c99/stdint.h diff --git a/examples/platforms/da15000/alarm.c b/examples/platforms/da15000/alarm.c index aed477c5c..055618ddd 100644 --- a/examples/platforms/da15000/alarm.c +++ b/examples/platforms/da15000/alarm.c @@ -31,6 +31,12 @@ * Platform abstraction for the alarm */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include "openthread/platform/alarm.h" diff --git a/examples/platforms/da15000/uart.c b/examples/platforms/da15000/uart.c index e35d6a0f3..f235dcc1a 100644 --- a/examples/platforms/da15000/uart.c +++ b/examples/platforms/da15000/uart.c @@ -26,6 +26,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/examples/platforms/nrf52840/radio.c b/examples/platforms/nrf52840/radio.c index 54495167c..4ef8f24b6 100644 --- a/examples/platforms/nrf52840/radio.c +++ b/examples/platforms/nrf52840/radio.c @@ -32,6 +32,16 @@ * */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif +// NRF tools use #define PACKAGE - for other purposes +// ie: the physical package the chip comes in +// This conflicts with the GNU Autoconf "PACAKGE" define +#undef PACKAGE + #include #include #include diff --git a/examples/platforms/utils/settings.cpp b/examples/platforms/utils/settings.cpp index dd2df8bdf..8f8743f45 100644 --- a/examples/platforms/utils/settings.cpp +++ b/examples/platforms/utils/settings.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include "utils/wrap_string.h" #include #include diff --git a/include/openthread-windows-config.h b/include/openthread-windows-config.h index bea5d1925..322567776 100644 --- a/include/openthread-windows-config.h +++ b/include/openthread-windows-config.h @@ -107,11 +107,6 @@ // Redefine rand to random for test code #define random rand -#ifdef OTBUILD -#include -#include -#endif - // Disable a few warnings that we don't care about #pragma warning(disable:4200) // nonstandard extension used: zero-sized array in struct/union #pragma warning(disable:4201) // nonstandard extension used : nameless struct/union diff --git a/src/Makefile.am b/src/Makefile.am index 2a911e701..dd2b58c5c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,7 +31,6 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am # Always package (e.g. for 'make dist') these subdirectories. DIST_SUBDIRS = \ - missing \ core \ cli \ ncp \ @@ -41,7 +40,6 @@ DIST_SUBDIRS = \ # Always build (e.g. for 'make all') these subdirectories. SUBDIRS = \ - missing \ core \ $(NULL) @@ -62,7 +60,6 @@ endif PRETTY_SUBDIRS = \ cli \ core \ - missing \ $(NULL) include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am index 3b9f7b13c..8331e4ce6 100644 --- a/src/cli/Makefile.am +++ b/src/cli/Makefile.am @@ -118,7 +118,6 @@ CPPFLAGS_COMMON = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/core \ $(OPENTHREAD_TARGET_DEFINES) \ - $(MISSING_CPPFLAGS) \ $(NULL) diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index aa4c863fe..e5528866f 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include "utils/wrap_string.h" #ifdef OTDLL #include diff --git a/src/cli/cli_coap.cpp b/src/cli/cli_coap.cpp index 5ef456c6a..a536a3ec7 100644 --- a/src/cli/cli_coap.cpp +++ b/src/cli/cli_coap.cpp @@ -31,6 +31,12 @@ * This file implements a simple CLI coap server and client. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/cli/cli_console.cpp b/src/cli/cli_console.cpp index ddf062bb7..5a2785359 100644 --- a/src/cli/cli_console.cpp +++ b/src/cli/cli_console.cpp @@ -31,10 +31,16 @@ * This file implements the CLI server on the CONSOLE service. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/cli/cli_dataset.cpp b/src/cli/cli_dataset.cpp index d4bac0997..44920156b 100644 --- a/src/cli/cli_dataset.cpp +++ b/src/cli/cli_dataset.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include "utils/wrap_string.h" #include "openthread/openthread.h" diff --git a/src/cli/cli_instance.cpp b/src/cli/cli_instance.cpp index 9419d89d8..1fb1269d5 100644 --- a/src/cli/cli_instance.cpp +++ b/src/cli/cli_instance.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include "utils/wrap_string.h" #include #include "openthread/openthread.h" diff --git a/src/cli/cli_uart.cpp b/src/cli/cli_uart.cpp index c92591d20..0a7813af9 100644 --- a/src/cli/cli_uart.cpp +++ b/src/cli/cli_uart.cpp @@ -31,10 +31,16 @@ * This file implements the CLI server on the UART service. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include -#include +#include "utils/wrap_string.h" #include "openthread/cli.h" #include "openthread/platform/logging.h" diff --git a/src/cli/cli_udp.cpp b/src/cli/cli_udp.cpp index f4b7cb915..a591898af 100644 --- a/src/cli/cli_udp.cpp +++ b/src/cli/cli_udp.cpp @@ -31,9 +31,15 @@ * This file implements the CLI server on a UDP socket. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/Makefile.am b/src/core/Makefile.am index ba0d6923c..ace31f20e 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -37,7 +37,6 @@ CPPFLAGS_COMMON = \ -I$(top_srcdir)/include \ -I${abs_top_srcdir}/third_party/mbedtls/repo/include \ $(MBEDTLS_CPPFLAGS) \ - $(MISSING_CPPFLAGS) \ $(OPENTHREAD_TARGET_DEFINES) \ $(NULL) @@ -180,57 +179,19 @@ SOURCES_COMMON = \ thread/thread_netif.cpp \ thread/topology.cpp \ utils/jam_detector.cpp \ + utils/missing_strlcpy.c \ + utils/missing_strlcat.c \ + utils/missing_strnlen.c \ utils/slaac_address.cpp \ $(NULL) -SOURCES_MISSING = \ - $(NULL) - -if MISSING_STRLCPY -############################################################### -# You'll see something similar to the next four lines in all -# of these `MISSING_*` blocks. These makefile gynmastics are -# to work around some unfortunate bugs in automake which -# prevent a more elegant solution. We can't just pull in the -# convenience libraries in `$(MISSING_LIBADD)` because that -# doesn't seem to work on some platforms. Also, we can't -# just include `$(top_srcdir)/src/missing/X/X.c` directly -# because a bug in automake causes the `clean` target to -# break. The following code may look ugly, but it gets the -# job done. It does this by copying the source file to the -# local build directory as an intermediate target. We then -# compile that file. We have to add the path in CPPFLAGS -# because the file might include headers from that directory. -# Because the copied source file is explicitly labeled as -# an intermediate target, it will always get deleted (unless -# it already existed in the first place). -- RQ 2017-03-22 -strlcpy.c: $(top_srcdir)/src/missing/strlcpy/strlcpy.c - $(AM_V_GEN)cp $< $@ -.INTERMEDIATE: strlcpy.c -CPPFLAGS_COMMON += -I$(top_srcdir)/src/missing/strlcpy -SOURCES_MISSING += strlcpy.c -endif - -if MISSING_STRLCAT -# See comment above for explanation. -strlcat.c: $(top_srcdir)/src/missing/strlcat/strlcat.c - $(AM_V_GEN)cp $< $@ -.INTERMEDIATE: strlcat.c -CPPFLAGS_COMMON += -I$(top_srcdir)/src/missing/strlcat -SOURCES_MISSING += strlcat.c -endif - - - libopenthread_mtd_a_SOURCES = \ $(SOURCES_COMMON) \ - $(SOURCES_MISSING) \ $(NULL) libopenthread_ftd_a_SOURCES = \ $(SOURCES_COMMON) \ - $(SOURCES_MISSING) \ $(NULL) HEADERS_COMMON = \ @@ -336,6 +297,9 @@ HEADERS_COMMON = \ thread/topology.hpp \ utils/slaac_address.hpp \ utils/jam_detector.hpp \ + utils/wrap_stdbool.h \ + utils/wrap_stdint.h \ + utils/wrap_string.h \ $(NULL) noinst_HEADERS = \ diff --git a/src/core/coap/coap_base.cpp b/src/core/coap/coap_base.cpp index 472395689..8c67951eb 100644 --- a/src/core/coap/coap_base.cpp +++ b/src/core/coap/coap_base.cpp @@ -26,6 +26,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/core/coap/coap_client.cpp b/src/core/coap/coap_client.cpp index 12be70359..77fd49d34 100644 --- a/src/core/coap/coap_client.cpp +++ b/src/core/coap/coap_client.cpp @@ -26,7 +26,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + +#include "utils/wrap_string.h" #include "openthread/platform/random.h" diff --git a/src/core/coap/coap_header.cpp b/src/core/coap/coap_header.cpp index ca06a03c2..9f5fb678b 100644 --- a/src/core/coap/coap_header.cpp +++ b/src/core/coap/coap_header.cpp @@ -31,6 +31,12 @@ * This file implements the CoAP header generation and parsing. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/random.h" #include diff --git a/src/core/coap/coap_header.hpp b/src/core/coap/coap_header.hpp index 35245eea2..dfab1ad32 100644 --- a/src/core/coap/coap_header.hpp +++ b/src/core/coap/coap_header.hpp @@ -34,7 +34,7 @@ #ifndef COAP_HEADER_HPP_ #define COAP_HEADER_HPP_ -#include +#include "utils/wrap_string.h" #include "openthread/coap.h" diff --git a/src/core/coap/coap_server.cpp b/src/core/coap/coap_server.cpp index f7aa53847..5dc6f4146 100644 --- a/src/core/coap/coap_server.cpp +++ b/src/core/coap/coap_server.cpp @@ -31,6 +31,12 @@ * This file implements the CoAP server message dispatch. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/coap/secure_coap_client.cpp b/src/core/coap/secure_coap_client.cpp index 58b8acc0e..d876072b3 100644 --- a/src/core/coap/secure_coap_client.cpp +++ b/src/core/coap/secure_coap_client.cpp @@ -28,6 +28,12 @@ #define WPP_NAME "secure_coap_client.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/coap/secure_coap_server.cpp b/src/core/coap/secure_coap_server.cpp index f44849ceb..34f724d96 100644 --- a/src/core/coap/secure_coap_server.cpp +++ b/src/core/coap/secure_coap_server.cpp @@ -28,6 +28,12 @@ #define WPP_NAME "secure_coap_server.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/common/code_utils.hpp b/src/core/common/code_utils.hpp index 1b430e449..1fde41f4f 100644 --- a/src/core/common/code_utils.hpp +++ b/src/core/common/code_utils.hpp @@ -34,7 +34,7 @@ #ifndef CODE_UTILS_HPP_ #define CODE_UTILS_HPP_ -#include +#include "utils/wrap_stdbool.h" // Calculates the aligned variable size. #define otALIGNED_VAR_SIZE(size, align_type) \ diff --git a/src/core/common/crc16.cpp b/src/core/common/crc16.cpp index 240524cfa..158e76a3c 100644 --- a/src/core/common/crc16.cpp +++ b/src/core/common/crc16.cpp @@ -31,6 +31,12 @@ * This file implements CRC16 computations. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include namespace Thread { diff --git a/src/core/common/crc16.hpp b/src/core/common/crc16.hpp index 4d99551ee..21822258c 100644 --- a/src/core/common/crc16.hpp +++ b/src/core/common/crc16.hpp @@ -34,7 +34,7 @@ #ifndef CRC16_HPP_ #define CRC16_HPP_ -#include +#include "utils/wrap_stdint.h" namespace Thread { diff --git a/src/core/common/debug.hpp b/src/core/common/debug.hpp index cd98e2afe..2b0a471ea 100644 --- a/src/core/common/debug.hpp +++ b/src/core/common/debug.hpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include "utils/wrap_string.h" #if defined(OPENTHREAD_TARGET_DARWIN) || defined(OPENTHREAD_TARGET_LINUX) diff --git a/src/core/common/encoding.hpp b/src/core/common/encoding.hpp index 431dd68f9..6ff1469cd 100644 --- a/src/core/common/encoding.hpp +++ b/src/core/common/encoding.hpp @@ -35,7 +35,7 @@ #define ENCODING_HPP_ #include -#include +#include "utils/wrap_stdint.h" namespace Thread { namespace Encoding { diff --git a/src/core/common/logging.hpp b/src/core/common/logging.hpp index 2b36cad34..cedd52b0d 100644 --- a/src/core/common/logging.hpp +++ b/src/core/common/logging.hpp @@ -36,7 +36,7 @@ #include #include -#include +#include "utils/wrap_string.h" #include #include "openthread/types.h" diff --git a/src/core/common/message.cpp b/src/core/common/message.cpp index ebd4538a0..067f4e36d 100644 --- a/src/core/common/message.cpp +++ b/src/core/common/message.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "message.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/common/message.hpp b/src/core/common/message.hpp index 387d49e57..93ed3a954 100644 --- a/src/core/common/message.hpp +++ b/src/core/common/message.hpp @@ -40,8 +40,8 @@ #include #endif -#include -#include +#include "utils/wrap_stdint.h" +#include "utils/wrap_string.h" #include "openthread/message.h" #include "openthread/platform/messagepool.h" diff --git a/src/core/common/tasklet.cpp b/src/core/common/tasklet.cpp index 49605fef4..13934e1bf 100644 --- a/src/core/common/tasklet.cpp +++ b/src/core/common/tasklet.cpp @@ -31,6 +31,12 @@ * This file implements the tasklet scheduler. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/openthread.h" #include diff --git a/src/core/common/timer.cpp b/src/core/common/timer.cpp index 0568b7ae2..eeacc67ce 100644 --- a/src/core/common/timer.cpp +++ b/src/core/common/timer.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "timer.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/alarm.h" #include diff --git a/src/core/common/timer.hpp b/src/core/common/timer.hpp index b9fcc6380..af3ca4a1d 100644 --- a/src/core/common/timer.hpp +++ b/src/core/common/timer.hpp @@ -35,7 +35,7 @@ #define TIMER_HPP_ #include -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" #include "openthread/platform/alarm.h" diff --git a/src/core/common/tlvs.cpp b/src/core/common/tlvs.cpp index d48734d75..663e82c24 100644 --- a/src/core/common/tlvs.cpp +++ b/src/core/common/tlvs.cpp @@ -31,6 +31,12 @@ * This file implements common methods for manipulating MLE TLVs. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/common/tlvs.hpp b/src/core/common/tlvs.hpp index 30581f260..30fec9ea7 100644 --- a/src/core/common/tlvs.hpp +++ b/src/core/common/tlvs.hpp @@ -34,7 +34,7 @@ #ifndef TLVS_HPP_ #define TLVS_HPP_ -#include +#include "utils/wrap_string.h" #include "openthread/types.h" diff --git a/src/core/common/trickle_timer.cpp b/src/core/common/trickle_timer.cpp index 69187fed7..3ee94d592 100644 --- a/src/core/common/trickle_timer.cpp +++ b/src/core/common/trickle_timer.cpp @@ -31,6 +31,12 @@ * This file implements the trickle timer logic. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/random.h" #include diff --git a/src/core/crypto/aes_ccm.cpp b/src/core/crypto/aes_ccm.cpp index e1b1fc269..9231da299 100644 --- a/src/core/crypto/aes_ccm.cpp +++ b/src/core/crypto/aes_ccm.cpp @@ -31,6 +31,12 @@ * This file implements AES-CCM. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/crypto/aes_ccm.hpp b/src/core/crypto/aes_ccm.hpp index de4792afd..cab0b7a24 100644 --- a/src/core/crypto/aes_ccm.hpp +++ b/src/core/crypto/aes_ccm.hpp @@ -34,7 +34,7 @@ #ifndef AES_CCM_HPP_ #define AES_CCM_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/crypto/aes_ecb.cpp b/src/core/crypto/aes_ecb.cpp index 924256006..a30143353 100644 --- a/src/core/crypto/aes_ecb.cpp +++ b/src/core/crypto/aes_ecb.cpp @@ -31,6 +31,12 @@ * This file implements AES-ECB. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include namespace Thread { diff --git a/src/core/crypto/hmac_sha256.cpp b/src/core/crypto/hmac_sha256.cpp index 2b5f1379e..485a0d6a1 100644 --- a/src/core/crypto/hmac_sha256.cpp +++ b/src/core/crypto/hmac_sha256.cpp @@ -31,6 +31,12 @@ * This file implements HMAC SHA-256. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include namespace Thread { diff --git a/src/core/crypto/hmac_sha256.hpp b/src/core/crypto/hmac_sha256.hpp index c0c0947c7..2f3ede208 100644 --- a/src/core/crypto/hmac_sha256.hpp +++ b/src/core/crypto/hmac_sha256.hpp @@ -34,7 +34,7 @@ #ifndef HMAC_SHA256_HPP_ #define HMAC_SHA256_HPP_ -#include +#include "utils/wrap_stdint.h" #include diff --git a/src/core/crypto/mbedtls.cpp b/src/core/crypto/mbedtls.cpp index 539cd68ec..ba0f29022 100644 --- a/src/core/crypto/mbedtls.cpp +++ b/src/core/crypto/mbedtls.cpp @@ -31,6 +31,12 @@ * This file implements the use of mbedTLS. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include namespace Thread { diff --git a/src/core/crypto/pbkdf2_cmac.cpp b/src/core/crypto/pbkdf2_cmac.cpp index 25b718c97..17f20a97c 100644 --- a/src/core/crypto/pbkdf2_cmac.cpp +++ b/src/core/crypto/pbkdf2_cmac.cpp @@ -37,7 +37,7 @@ #include #endif -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/crypto/pbkdf2_cmac.h b/src/core/crypto/pbkdf2_cmac.h index a69d07a1b..1d5581bc7 100644 --- a/src/core/crypto/pbkdf2_cmac.h +++ b/src/core/crypto/pbkdf2_cmac.h @@ -35,8 +35,8 @@ #ifndef PBKDF2_CMAC_H_ #define PBKDF2_CMAC_H_ -#include -#include +#include "utils/wrap_stdint.h" +#include "utils/wrap_stdbool.h" #ifdef __cplusplus extern "C" { diff --git a/src/core/crypto/sha256.cpp b/src/core/crypto/sha256.cpp index ba7f28ee7..72bdff263 100644 --- a/src/core/crypto/sha256.cpp +++ b/src/core/crypto/sha256.cpp @@ -31,6 +31,12 @@ * This file implements SHA-256. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include namespace Thread { diff --git a/src/core/crypto/sha256.hpp b/src/core/crypto/sha256.hpp index 732fd8bb2..9b9cc8a32 100644 --- a/src/core/crypto/sha256.hpp +++ b/src/core/crypto/sha256.hpp @@ -34,7 +34,7 @@ #ifndef SHA256_HPP_ #define SHA256_HPP_ -#include +#include "utils/wrap_stdint.h" #include diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 330f6bffd..1b5c64c19 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -39,7 +39,7 @@ #include #endif -#include +#include "utils/wrap_string.h" #include "openthread/platform/random.h" #include "openthread/platform/usec-alarm.h" diff --git a/src/core/mac/mac_blacklist.cpp b/src/core/mac/mac_blacklist.cpp index 5802422e4..9f0198ac0 100644 --- a/src/core/mac/mac_blacklist.cpp +++ b/src/core/mac/mac_blacklist.cpp @@ -31,7 +31,13 @@ * This file implements blacklist IEEE 802.15.4 frame filtering based on MAC address. */ -#include +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + +#include "utils/wrap_string.h" #include #include diff --git a/src/core/mac/mac_blacklist_impl.hpp b/src/core/mac/mac_blacklist_impl.hpp index 2153b5001..dc10c1c4f 100644 --- a/src/core/mac/mac_blacklist_impl.hpp +++ b/src/core/mac/mac_blacklist_impl.hpp @@ -34,7 +34,7 @@ #ifndef MAC_BLACKLIST_HPP_ #define MAC_BLACKLIST_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/mac/mac_blacklist_stub.hpp b/src/core/mac/mac_blacklist_stub.hpp index e8bc5713f..f79e7f432 100644 --- a/src/core/mac/mac_blacklist_stub.hpp +++ b/src/core/mac/mac_blacklist_stub.hpp @@ -34,7 +34,7 @@ #ifndef MAC_BLACKLIST_HPP_ #define MAC_BLACKLIST_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/mac/mac_frame.cpp b/src/core/mac/mac_frame.cpp index 16be09412..16bfbe56d 100644 --- a/src/core/mac/mac_frame.cpp +++ b/src/core/mac/mac_frame.cpp @@ -38,7 +38,7 @@ #endif #include -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index d4d6671f9..0f8108019 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -37,8 +37,8 @@ #include #include -#include -#include +#include "utils/wrap_stdint.h" +#include "utils/wrap_string.h" #include "openthread/types.h" #include "openthread/platform/radio.h" diff --git a/src/core/mac/mac_whitelist.cpp b/src/core/mac/mac_whitelist.cpp index 4c48d24af..8c3c63027 100644 --- a/src/core/mac/mac_whitelist.cpp +++ b/src/core/mac/mac_whitelist.cpp @@ -31,7 +31,13 @@ * This file implements whitelist IEEE 802.15.4 frame filtering based on MAC address. */ -#include +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + +#include "utils/wrap_string.h" #include #include diff --git a/src/core/mac/mac_whitelist_impl.hpp b/src/core/mac/mac_whitelist_impl.hpp index 0ced1daef..3df37f441 100644 --- a/src/core/mac/mac_whitelist_impl.hpp +++ b/src/core/mac/mac_whitelist_impl.hpp @@ -34,7 +34,7 @@ #ifndef MAC_WHITELIST_HPP_ #define MAC_WHITELIST_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/mac/mac_whitelist_stub.hpp b/src/core/mac/mac_whitelist_stub.hpp index d4fb6a73f..981bd4814 100644 --- a/src/core/mac/mac_whitelist_stub.hpp +++ b/src/core/mac/mac_whitelist_stub.hpp @@ -34,7 +34,7 @@ #ifndef MAC_WHITELIST_HPP_ #define MAC_WHITELIST_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index b3db0b53e..268d2cff8 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -40,7 +40,7 @@ #endif #include -#include +#include "utils/wrap_string.h" #include "openthread/platform/random.h" diff --git a/src/core/meshcop/dataset.cpp b/src/core/meshcop/dataset.cpp index 49930530e..c45362005 100644 --- a/src/core/meshcop/dataset.cpp +++ b/src/core/meshcop/dataset.cpp @@ -32,6 +32,12 @@ * */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include "openthread/platform/settings.h" diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index 081b40c4a..3b0723c4d 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -34,6 +34,12 @@ #define WPP_NAME "dataset_manager.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include "openthread/platform/random.h" diff --git a/src/core/meshcop/timestamp.cpp b/src/core/meshcop/timestamp.cpp index 5ea2af21c..e34992f21 100644 --- a/src/core/meshcop/timestamp.cpp +++ b/src/core/meshcop/timestamp.cpp @@ -31,7 +31,13 @@ * This file implements common MeshCoP timestamp processing. */ -#include +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + +#include "utils/wrap_string.h" #include "openthread/types.h" diff --git a/src/core/meshcop/tlvs.hpp b/src/core/meshcop/tlvs.hpp index bc0fb9d64..44227abbd 100644 --- a/src/core/meshcop/tlvs.hpp +++ b/src/core/meshcop/tlvs.hpp @@ -35,7 +35,7 @@ #ifndef MESHCOP_TLVS_HPP_ #define MESHCOP_TLVS_HPP_ -#include +#include "utils/wrap_string.h" #include "openthread/types.h" diff --git a/src/core/net/dhcp6_client.cpp b/src/core/net/dhcp6_client.cpp index 05e19bd6f..77bdbeb24 100644 --- a/src/core/net/dhcp6_client.cpp +++ b/src/core/net/dhcp6_client.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "dhcp6_client.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/types.h" #include "openthread/platform/random.h" diff --git a/src/core/net/dns_client.cpp b/src/core/net/dns_client.cpp index 5154f7c7f..3e11521b6 100644 --- a/src/core/net/dns_client.cpp +++ b/src/core/net/dns_client.cpp @@ -32,7 +32,7 @@ #include #endif -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/net/dns_headers.hpp b/src/core/net/dns_headers.hpp index 558236367..e72c94592 100644 --- a/src/core/net/dns_headers.hpp +++ b/src/core/net/dns_headers.hpp @@ -34,7 +34,7 @@ #ifndef DNS_HEADER_HPP_ #define DNS_HEADER_HPP_ -#include +#include "utils/wrap_string.h" #include diff --git a/src/core/net/icmp6.cpp b/src/core/net/icmp6.cpp index f4fa58ee1..ded46848e 100644 --- a/src/core/net/icmp6.cpp +++ b/src/core/net/icmp6.cpp @@ -39,7 +39,7 @@ #include #endif -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index 8a4cb9e03..094fd78c1 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "ip6.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/net/ip6_address.cpp b/src/core/net/ip6_address.cpp index dbc4b0b47..bdfd39f34 100644 --- a/src/core/net/ip6_address.cpp +++ b/src/core/net/ip6_address.cpp @@ -38,7 +38,7 @@ #endif #include -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/net/ip6_address.hpp b/src/core/net/ip6_address.hpp index 99bb7018a..b5ffc5c61 100644 --- a/src/core/net/ip6_address.hpp +++ b/src/core/net/ip6_address.hpp @@ -34,7 +34,7 @@ #ifndef IP6_ADDRESS_HPP_ #define IP6_ADDRESS_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/net/ip6_filter.cpp b/src/core/net/ip6_filter.cpp index 267c48683..ee5c0031a 100644 --- a/src/core/net/ip6_filter.cpp +++ b/src/core/net/ip6_filter.cpp @@ -31,6 +31,12 @@ * This file implements IPv6 datagram filtering. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/core/net/ip6_mpl.cpp b/src/core/net/ip6_mpl.cpp index 87032a1d7..92f494bf6 100644 --- a/src/core/net/ip6_mpl.cpp +++ b/src/core/net/ip6_mpl.cpp @@ -31,6 +31,12 @@ * This file implements MPL. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/random.h" #include diff --git a/src/core/net/ip6_routes.cpp b/src/core/net/ip6_routes.cpp index a7572b060..5628a8656 100644 --- a/src/core/net/ip6_routes.cpp +++ b/src/core/net/ip6_routes.cpp @@ -31,6 +31,12 @@ * This file implements IPv6 route tables. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/net/netif.cpp b/src/core/net/netif.cpp index c8a5771de..01295b64c 100644 --- a/src/core/net/netif.cpp +++ b/src/core/net/netif.cpp @@ -30,6 +30,11 @@ * @file * This file implements IPv6 network interfaces. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif #include #include diff --git a/src/core/net/udp6.cpp b/src/core/net/udp6.cpp index bd81517d8..c611a84a8 100644 --- a/src/core/net/udp6.cpp +++ b/src/core/net/udp6.cpp @@ -31,6 +31,12 @@ * This file implements UDP/IPv6 sockets. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/core/openthread-instance.h b/src/core/openthread-instance.h index 049f105be..e45eb2b4b 100644 --- a/src/core/openthread-instance.h +++ b/src/core/openthread-instance.h @@ -35,8 +35,8 @@ #ifndef OPENTHREADINSTANCE_H_ #define OPENTHREADINSTANCE_H_ -#include -#include +#include "utils/wrap_stdint.h" +#include "utils/wrap_stdbool.h" #include diff --git a/src/core/thread/data_poll_manager.cpp b/src/core/thread/data_poll_manager.cpp index 8192e5f55..5ca385a13 100644 --- a/src/core/thread/data_poll_manager.cpp +++ b/src/core/thread/data_poll_manager.cpp @@ -31,6 +31,12 @@ * This file implements data poll (mac data request command) manager class. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #define WPP_NAME "data_poll_manager.tmh" #include "openthread/platform/random.h" diff --git a/src/core/thread/energy_scan_server.cpp b/src/core/thread/energy_scan_server.cpp index 33d2af019..a81e3b289 100644 --- a/src/core/thread/energy_scan_server.cpp +++ b/src/core/thread/energy_scan_server.cpp @@ -31,6 +31,12 @@ * This file implements the Energy Scan Server. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #define WPP_NAME "energy_scan_server.tmh" #include "openthread/platform/random.h" diff --git a/src/core/thread/key_manager.hpp b/src/core/thread/key_manager.hpp index 1c0576634..a03779aa7 100644 --- a/src/core/thread/key_manager.hpp +++ b/src/core/thread/key_manager.hpp @@ -34,7 +34,7 @@ #ifndef KEY_MANAGER_HPP_ #define KEY_MANAGER_HPP_ -#include +#include "utils/wrap_stdint.h" #include "openthread/types.h" diff --git a/src/core/thread/link_quality.cpp b/src/core/thread/link_quality.cpp index a6f0cf072..01d2e8205 100644 --- a/src/core/thread/link_quality.cpp +++ b/src/core/thread/link_quality.cpp @@ -38,7 +38,7 @@ #endif #include -#include +#include "utils/wrap_string.h" #include "openthread/types.h" diff --git a/src/core/thread/lowpan.cpp b/src/core/thread/lowpan.cpp index ce37fc1fb..1aedb9bf0 100644 --- a/src/core/thread/lowpan.cpp +++ b/src/core/thread/lowpan.cpp @@ -31,6 +31,12 @@ * This file implements 6LoWPAN header compression. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 452b9720f..b01d5aae7 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "mesh_forwarder.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/random.h" #include diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 476830e10..f41698c1a 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -31,6 +31,12 @@ * This file implements MLE functionality required for the Thread Child, Router and Leader roles. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #define WPP_NAME "mle.tmh" #include "openthread/platform/radio.h" diff --git a/src/core/thread/mle_router_ftd.hpp b/src/core/thread/mle_router_ftd.hpp index 85a3bb34f..3f2bda9a1 100644 --- a/src/core/thread/mle_router_ftd.hpp +++ b/src/core/thread/mle_router_ftd.hpp @@ -34,7 +34,7 @@ #ifndef MLE_ROUTER_HPP_ #define MLE_ROUTER_HPP_ -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/thread/mle_router_mtd.hpp b/src/core/thread/mle_router_mtd.hpp index 8837368f7..102eabebf 100644 --- a/src/core/thread/mle_router_mtd.hpp +++ b/src/core/thread/mle_router_mtd.hpp @@ -34,7 +34,7 @@ #ifndef MLE_ROUTER_HPP_ #define MLE_ROUTER_HPP_ -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/thread/mle_tlvs.hpp b/src/core/thread/mle_tlvs.hpp index 64976f883..a9dd23e4f 100644 --- a/src/core/thread/mle_tlvs.hpp +++ b/src/core/thread/mle_tlvs.hpp @@ -34,7 +34,7 @@ #ifndef MLE_TLVS_HPP_ #define MLE_TLVS_HPP_ -#include +#include "utils/wrap_string.h" #include "openthread/types.h" diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index a40f094cd..242f7d7c9 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "network_data.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/random.h" #include diff --git a/src/core/thread/network_data_leader.hpp b/src/core/thread/network_data_leader.hpp index 2ace05973..61f6d4656 100644 --- a/src/core/thread/network_data_leader.hpp +++ b/src/core/thread/network_data_leader.hpp @@ -34,7 +34,7 @@ #ifndef NETWORK_DATA_LEADER_HPP_ #define NETWORK_DATA_LEADER_HPP_ -#include +#include "utils/wrap_stdint.h" #include #include diff --git a/src/core/thread/network_data_leader_ftd.hpp b/src/core/thread/network_data_leader_ftd.hpp index e51ef743d..97c2a07e5 100644 --- a/src/core/thread/network_data_leader_ftd.hpp +++ b/src/core/thread/network_data_leader_ftd.hpp @@ -34,7 +34,7 @@ #ifndef NETWORK_DATA_LEADER_FTD_HPP_ #define NETWORK_DATA_LEADER_FTD_HPP_ -#include +#include "utils/wrap_stdint.h" #include #include diff --git a/src/core/thread/network_data_leader_mtd.hpp b/src/core/thread/network_data_leader_mtd.hpp index 6eec4594f..33569ee4d 100644 --- a/src/core/thread/network_data_leader_mtd.hpp +++ b/src/core/thread/network_data_leader_mtd.hpp @@ -34,7 +34,7 @@ #ifndef NETWORK_DATA_LEADER_MTD_HPP_ #define NETWORK_DATA_LEADER_MTD_HPP_ -#include +#include "utils/wrap_stdint.h" namespace Thread { diff --git a/src/core/thread/network_data_tlvs.hpp b/src/core/thread/network_data_tlvs.hpp index 3c449adb1..663c40395 100644 --- a/src/core/thread/network_data_tlvs.hpp +++ b/src/core/thread/network_data_tlvs.hpp @@ -34,7 +34,7 @@ #ifndef NETWORK_DATA_TLVS_HPP_ #define NETWORK_DATA_TLVS_HPP_ -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/core/thread/network_diagnostic.cpp b/src/core/thread/network_diagnostic.cpp index 3a30c2598..db436300c 100644 --- a/src/core/thread/network_diagnostic.cpp +++ b/src/core/thread/network_diagnostic.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "network_diagnostic.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/platform/random.h" #include diff --git a/src/core/thread/network_diagnostic_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp index 7b438b0e7..66d07a1e0 100644 --- a/src/core/thread/network_diagnostic_tlvs.hpp +++ b/src/core/thread/network_diagnostic_tlvs.hpp @@ -34,7 +34,7 @@ #ifndef NETWORK_DIAGNOSTIC_TLVS_HPP_ #define NETWORK_DIAGNOSTIC_TLVS_HPP_ -#include +#include "utils/wrap_string.h" #include "openthread/types.h" diff --git a/src/core/thread/panid_query_server.cpp b/src/core/thread/panid_query_server.cpp index 5c69c5dc1..658cf17b0 100644 --- a/src/core/thread/panid_query_server.cpp +++ b/src/core/thread/panid_query_server.cpp @@ -31,6 +31,12 @@ * This file implements the PAN ID Query Server. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #define WPP_NAME "panid_query_server.tmh" #include "openthread/platform/random.h" diff --git a/src/core/thread/src_match_controller.cpp b/src/core/thread/src_match_controller.cpp index 7446b112d..b32d79e74 100644 --- a/src/core/thread/src_match_controller.cpp +++ b/src/core/thread/src_match_controller.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "src_match_controller.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/thread/thread_netif.cpp b/src/core/thread/thread_netif.cpp index 0af877d79..335d58095 100644 --- a/src/core/thread/thread_netif.cpp +++ b/src/core/thread/thread_netif.cpp @@ -32,6 +32,12 @@ * This file implements the Thread network interface. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/thread/topology.cpp b/src/core/thread/topology.cpp index 25eca19ea..6a966eb3f 100644 --- a/src/core/thread/topology.cpp +++ b/src/core/thread/topology.cpp @@ -33,6 +33,12 @@ #define WPP_NAME "topology.tmh" +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/utils/jam_detector.hpp b/src/core/utils/jam_detector.hpp index 66e39bf1c..71d080047 100644 --- a/src/core/utils/jam_detector.hpp +++ b/src/core/utils/jam_detector.hpp @@ -40,10 +40,9 @@ #include #endif -#include +#include "utils/wrap_stdint.h" #include - namespace Thread { class ThreadNetif; diff --git a/src/missing/strlcat/strlcat.c b/src/core/utils/missing_strlcat.c similarity index 94% rename from src/missing/strlcat/strlcat.c rename to src/core/utils/missing_strlcat.c index 44029c66d..c28997d5c 100644 --- a/src/missing/strlcat/strlcat.c +++ b/src/core/utils/missing_strlcat.c @@ -25,10 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "strlcat.h" -#include "../strlcpy/strlcpy.h" +#include "utils/wrap_string.h" -size_t strlcat(char *dest, const char *src, size_t size) +size_t missing_strlcat(char *dest, const char *src, size_t size) { size_t len = strlen(dest); @@ -39,4 +38,3 @@ size_t strlcat(char *dest, const char *src, size_t size) return len + strlen(src); } - diff --git a/src/missing/strlcpy/strlcpy.c b/src/core/utils/missing_strlcpy.c similarity index 95% rename from src/missing/strlcpy/strlcpy.c rename to src/core/utils/missing_strlcpy.c index aaac96eb0..a0a2373e8 100644 --- a/src/missing/strlcpy/strlcpy.c +++ b/src/core/utils/missing_strlcpy.c @@ -25,9 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "strlcpy.h" +#include "utils/wrap_string.h" -size_t strlcpy(char *dest, const char *src, size_t size) +size_t missing_strlcpy(char *dest, const char *src, size_t size) { const size_t slen = strlen(src); @@ -50,4 +50,3 @@ size_t strlcpy(char *dest, const char *src, size_t size) return slen; } - diff --git a/src/missing/strlcat/strlcat.h b/src/core/utils/missing_strnlen.c similarity index 82% rename from src/missing/strlcat/strlcat.h rename to src/core/utils/missing_strnlen.c index d549c37e2..7245e14c5 100644 --- a/src/missing/strlcat/strlcat.h +++ b/src/core/utils/missing_strnlen.c @@ -25,25 +25,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef MISSING_STRLCAT_HEADER_INCLUDED -#define MISSING_STRLCAT_HEADER_INCLUDED 1 +#include "utils/wrap_string.h" -#include +size_t missing_strnlen(const char *s, size_t maxlen) +{ + size_t ret; -#ifdef strlcat -#undef strlcat -#endif + for (ret = 0; (ret < maxlen) && (s[ret] != 0); ret++) + { + // Empty loop. + } -#define strlcat ___missing_strlcat - -#ifdef __cplusplus -extern "C" { -#endif - -size_t strlcat(char *dest, const char *src, size_t size); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // MISSING_STRLCPY_HEADER_INCLUDED + return ret; +} diff --git a/src/core/utils/slaac_address.cpp b/src/core/utils/slaac_address.cpp index 96e521d81..aac408d44 100644 --- a/src/core/utils/slaac_address.cpp +++ b/src/core/utils/slaac_address.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include "utils/wrap_string.h" namespace Thread { namespace Utils { diff --git a/src/core/utils/wrap_stdbool.h b/src/core/utils/wrap_stdbool.h new file mode 100644 index 000000000..644582827 --- /dev/null +++ b/src/core/utils/wrap_stdbool.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2017, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file is a wrapper for the standard "string.h" file + * The purpose is add any missing function prototypes not + * provided by a specific compiler. + */ + +#if !defined(WRAP_STDBOOL_H) +#define WRAP_STDBOOL_H + +#if HAVE_STDBOOL_H +#include +#else + +/* Supply our own */ +#if __cplusplus +/* c++ has a built in bool */ +#else + +#if defined(_MSC_VER) +#define bool _Bool +#else +typedef _Bool bool; +#endif // visual studio has a bool + +#if !defined(__bool_true_false_are_defined) +#define __bool_true_false_are_defined 1 +#define false 0 +#define true 1 +#endif // bool defined + +#endif // __cplusplus + +#endif // HAVE_STDBOOL_H + + +#endif // WRAP_STDBOOL_H diff --git a/src/missing/strlcpy/strlcpy.h b/src/core/utils/wrap_stdint.h similarity index 73% rename from src/missing/strlcpy/strlcpy.h rename to src/core/utils/wrap_stdint.h index 1b56d55f9..5eb58a61a 100644 --- a/src/missing/strlcpy/strlcpy.h +++ b/src/core/utils/wrap_stdint.h @@ -24,26 +24,28 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if !defined(WRAP_STDINT_H) +#define WRAP_STDINT_H -#ifndef MISSING_STRLCPY_HEADER_INCLUDED -#define MISSING_STRLCPY_HEADER_INCLUDED 1 +/* generally all compilers support this */ +/* Visual Studio only after VS2015 (aka: 19.00) */ -#include +#if defined(_MSC_VER) && (_MSC_VER < 1900) +/* types from this page: https://msdn.microsoft.com/en-us/library/29dh1w7z.aspx */ -#ifdef strlcpy -#undef strlcpy +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; + +#else +/* use the compiler supplied solution */ +#include #endif -#define strlcpy ___missing_strlcpy - -#ifdef __cplusplus -extern "C" { -#endif - -extern size_t strlcpy(char *dest, const char *src, size_t size); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // MISSING_STRLCPY_HEADER_INCLUDED +#endif // WRAP_STDINT_H diff --git a/src/core/utils/wrap_string.h b/src/core/utils/wrap_string.h new file mode 100644 index 000000000..f86a541c8 --- /dev/null +++ b/src/core/utils/wrap_string.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file is a wrapper for the standard "string.h" file + * Some platforms provide all required functions, some do not. + * This solves the missing functions in #include + */ + +#if !defined(WRAP_STRING_H) +#define WRAP_STRING_H + +/* system provided string.h */ +#include + + +/* These are C functions */ +#if defined(__cplusplus) +#define WRAP_EXTERN_C extern "C" +#else +#define WRAP_EXTERN_C extern +#endif + +/* Prototypes for our missing function replacements */ + +/* See: https://www.freebsd.org/cgi/man.cgi?query=strlcpy */ +WRAP_EXTERN_C size_t missing_strlcpy(char *dst, const char *src, size_t dstsize); +/* See: https://www.freebsd.org/cgi/man.cgi?query=strlcat */ +WRAP_EXTERN_C size_t missing_strlcat(char *dst, const char *src, size_t dstsize); +/* See: https://www.freebsd.org/cgi/man.cgi?query=strnlen */ +WRAP_EXTERN_C size_t missing_strnlen(const char *s, size_t maxlen); + +#undef WRAP_EXTERN_C + + + +#if (!HAVE_STRNLEN) +#define strnlen( S, N ) missing_strnlen( S, N ) +#endif + +#if (!HAVE_STRLCPY) +#define strlcpy( D, S, N ) missing_strlcpy( D, S, N ) +#endif + +#if (!HAVE_STRLCAT) +#define strlcat( D, S, N ) missing_strlcat( D, S, N ) +#endif + +#endif // WRAP_STRING_H diff --git a/src/diag/Makefile.am b/src/diag/Makefile.am index 79d401747..78717e80d 100644 --- a/src/diag/Makefile.am +++ b/src/diag/Makefile.am @@ -35,7 +35,6 @@ libopenthread_diag_a_CPPFLAGS = \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/core \ $(OPENTHREAD_TARGET_DEFINES) \ - $(MISSING_CPPFLAGS) \ $(NULL) libopenthread_diag_a_SOURCES = \ diff --git a/src/diag/diag_process.cpp b/src/diag/diag_process.cpp index 8d13957b2..b97930d81 100644 --- a/src/diag/diag_process.cpp +++ b/src/diag/diag_process.cpp @@ -31,9 +31,15 @@ * This file implements the diagnostics module. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include -#include +#include "utils/wrap_string.h" #include #include "diag_process.hpp" diff --git a/src/diag/openthread-diag.cpp b/src/diag/openthread-diag.cpp index d7b71889d..34ff50e78 100644 --- a/src/diag/openthread-diag.cpp +++ b/src/diag/openthread-diag.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include "utils/wrap_string.h" #include "openthread/diag.h" #include diff --git a/src/missing/Makefile.am b/src/missing/Makefile.am deleted file mode 100644 index 1c821e281..000000000 --- a/src/missing/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (c) 2016, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -include $(abs_top_nlbuild_autotools_dir)/automake/pre.am - -# Always package (e.g. for 'make dist') these subdirectories. - -DIST_SUBDIRS = \ - stdbool \ - stdint \ - strlcpy \ - strlcat \ - $(NULL) - -# Always build (e.g. for 'make all') these subdirectories. - -SUBDIRS = \ - strlcpy \ - strlcat \ - $(NULL) - -# Always pretty (e.g. for 'make pretty') these subdirectories. - -PRETTY_SUBDIRS = \ - stdbool \ - stdint \ - strlcpy \ - strlcat \ - $(NULL) - -include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/src/missing/stdbool/Makefile.am b/src/missing/stdbool/Makefile.am deleted file mode 100644 index 2527c7d97..000000000 --- a/src/missing/stdbool/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (c) 2016, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -include $(abs_top_nlbuild_autotools_dir)/automake/pre.am - -EXTRA_DIST = \ - stdbool.h \ - $(NULL) - -include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/src/missing/stdint/Makefile.am b/src/missing/stdint/Makefile.am deleted file mode 100644 index 639466700..000000000 --- a/src/missing/stdint/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (c) 2016, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -include $(abs_top_nlbuild_autotools_dir)/automake/pre.am - -EXTRA_DIST = \ - stdint.h \ - $(NULL) - -include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/src/missing/strlcat/Makefile.am b/src/missing/strlcat/Makefile.am deleted file mode 100644 index 146f54195..000000000 --- a/src/missing/strlcat/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (c) 2016, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -include $(abs_top_nlbuild_autotools_dir)/automake/pre.am - -check_PROGRAMS = strlcat_test -strlcat_test_SOURCES = strlcat_test.c -strlcat_test_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(MISSING_CPPFLAGS) \ - $(NULL) -strlcat_test_LDADD = $(NULL) - -TESTS = strlcat_test - -if MISSING_STRLCAT -noinst_LTLIBRARIES = libstrlcat.la -libstrlcat_la_SOURCES = \ - strlcat.c \ - strlcat.h \ - $(NULL) -libstrlcat_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(MISSING_CPPFLAGS) \ - $(NULL) -strlcat_test_LDADD += libstrlcat.la -endif - -if MISSING_STRLCAT -strlcat_test_LDADD += ../strlcpy/libstrlcpy.la -endif - -include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/src/missing/strlcpy/Makefile.am b/src/missing/strlcpy/Makefile.am deleted file mode 100644 index 5f951e36f..000000000 --- a/src/missing/strlcpy/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (c) 2016, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -include $(abs_top_nlbuild_autotools_dir)/automake/pre.am - -check_PROGRAMS = strlcpy_test -strlcpy_test_SOURCES = strlcpy_test.c -strlcpy_test_CPPFLAGS = $(MISSING_CPPFLAGS) - -TESTS = strlcpy_test - -if MISSING_STRLCPY -noinst_LTLIBRARIES = libstrlcpy.la -libstrlcpy_la_SOURCES = \ - strlcpy.c \ - strlcpy.h \ - $(NULL) -strlcpy_test_LDADD = libstrlcpy.la -endif - -include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/src/ncp/Makefile.am b/src/ncp/Makefile.am index c3350de9f..f26339370 100644 --- a/src/ncp/Makefile.am +++ b/src/ncp/Makefile.am @@ -47,7 +47,6 @@ COMMON_CPPFLAGS = \ -I$(top_srcdir)/third_party \ -D_GNU_SOURCE \ $(OPENTHREAD_TARGET_DEFINES) \ - $(MISSING_CPPFLAGS) \ $(NULL) @@ -57,7 +56,6 @@ COMMON_CXXFLAGS = \ -I$(top_srcdir)/src/core \ -I$(top_srcdir)/third_party \ -D_GNU_SOURCE \ - $(MISSING_CPPFLAGS) \ $(OPENTHREAD_TARGET_DEFINES) \ $(NULL) @@ -101,7 +99,7 @@ if OPENTHREAD_BUILD_TESTS noinst_PROGRAMS = spinel-test spinel_test_SOURCES = spinel.c -spinel_test_CFLAGS = -DSPINEL_SELF_TEST=1 -D_GNU_SOURCE +spinel_test_CFLAGS = -DSPINEL_SELF_TEST=1 -D_GNU_SOURCE -I$(top_srcdir)/src/core TESTS = spinel-test diff --git a/src/ncp/ncp_buffer.cpp b/src/ncp/ncp_buffer.cpp index 8269eb983..08b57b8c5 100644 --- a/src/ncp/ncp_buffer.cpp +++ b/src/ncp/ncp_buffer.cpp @@ -36,7 +36,7 @@ #include #endif -#include +#include "utils/wrap_string.h" #include #include diff --git a/src/ncp/ncp_spi.cpp b/src/ncp/ncp_spi.cpp index e2719b769..65d403c80 100644 --- a/src/ncp/ncp_spi.cpp +++ b/src/ncp/ncp_spi.cpp @@ -30,6 +30,12 @@ * This file implements a SPI interface to the OpenThread stack. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "openthread/ncp.h" #include "openthread/platform/spi-slave.h" diff --git a/src/ncp/spinel.c b/src/ncp/spinel.c index d80fdacc1..93276ba66 100644 --- a/src/ncp/spinel.c +++ b/src/ncp/spinel.c @@ -43,14 +43,20 @@ // MARK: - // MARK: Headers +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "spinel.h" #include #include #include -#include +#include "utils/wrap_string.h" #include - +#include "utils/wrap_stdbool.h" // ---------------------------------------------------------------------------- // MARK: - @@ -96,19 +102,6 @@ static int spinel_errno_workaround_; #endif // else SPINEL_PLATFORM_DOESNT_IMPLEMENT_FPRINTF #endif -#if !HAVE_STRNLEN -// Provide a working strnlen if the platform doesn't have one. -static size_t spinel_strnlen_(const char *s, size_t maxlen) -{ - size_t ret; - for (ret = 0; (ret < maxlen) && (s[ret] != 0); ret++) - { - // Empty loop. - } - return ret; -} -#define strnlen spinel_strnlen_ -#endif #ifndef require_action #if SPINEL_PLATFORM_SHOULD_LOG_ASSERTS @@ -1484,7 +1477,7 @@ const char *spinel_status_to_cstr(spinel_status_t status) #if SPINEL_SELF_TEST #include -#include +#include "utils/wrap_string.h" int diff --git a/src/ncp/spinel.h b/src/ncp/spinel.h index dc146c3c9..ee415b9ca 100644 --- a/src/ncp/spinel.h +++ b/src/ncp/spinel.h @@ -29,8 +29,8 @@ #define SPINEL_HEADER_INCLUDED 1 #include -#include -#include +#include "utils/wrap_stdbool.h" +#include "utils/wrap_stdint.h" // ---------------------------------------------------------------------------- diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index d6f948b56..76300aeab 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -95,6 +95,9 @@ check_PROGRAMS = \ test-message \ test-message-queue \ test-priority-queue \ + test-strlcat \ + test-strlcpy \ + test-strnlen \ test-timer \ test-toolchain \ $(NULL) @@ -166,6 +169,15 @@ test_ncp_buffer_SOURCES = test_platform.cpp test_ncp_buffer.cpp test_priority_queue_LDADD = $(COMMON_LDADD) test_priority_queue_SOURCES = test_platform.cpp test_priority_queue.cpp +test_strlcat_LDADD = $(COMMON_LDADD) +test_strlcat_SOURCES = test_strlcat.c + +test_strlcpy_LDADD = $(COMMON_LDADD) +test_strlcpy_SOURCES = test_strlcpy.c + +test_strnlen_LDADD = $(COMMON_LDADD) +test_strnlen_SOURCES = test_strnlen.c + test_timer_LDADD = $(COMMON_LDADD) test_timer_SOURCES = test_platform.cpp test_timer.cpp diff --git a/tests/unit/test_aes.cpp b/tests/unit/test_aes.cpp index d56002047..86c384955 100644 --- a/tests/unit/test_aes.cpp +++ b/tests/unit/test_aes.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include "utils/wrap_string.h" #ifndef OPENTHREAD_MULTIPLE_INSTANCE static Thread::Crypto::MbedTls mbedtls; diff --git a/tests/unit/test_diag.cpp b/tests/unit/test_diag.cpp index 6d35d1d9e..01b1f1e21 100644 --- a/tests/unit/test_diag.cpp +++ b/tests/unit/test_diag.cpp @@ -27,7 +27,7 @@ */ #include "test_util.h" -#include +#include "utils/wrap_string.h" #include "openthread/diag.h" #include "openthread/platform/platform.h" diff --git a/tests/unit/test_hmac_sha256.cpp b/tests/unit/test_hmac_sha256.cpp index 24fa5e06c..cb994a930 100644 --- a/tests/unit/test_hmac_sha256.cpp +++ b/tests/unit/test_hmac_sha256.cpp @@ -29,7 +29,7 @@ #include "test_util.h" #include "openthread/openthread.h" #include -#include +#include "utils/wrap_string.h" #include #include diff --git a/tests/unit/test_link_quality.cpp b/tests/unit/test_link_quality.cpp index 656dc3f2e..fc521732a 100644 --- a/tests/unit/test_link_quality.cpp +++ b/tests/unit/test_link_quality.cpp @@ -30,7 +30,7 @@ #include "openthread/openthread.h" #include -#include +#include "utils/wrap_string.h" namespace Thread { diff --git a/tests/unit/test_lowpan.hpp b/tests/unit/test_lowpan.hpp index 61008ae34..3f5890f68 100644 --- a/tests/unit/test_lowpan.hpp +++ b/tests/unit/test_lowpan.hpp @@ -29,7 +29,7 @@ #ifndef TEST_LOWPAN_HPP #define TEST_LOWPAN_HPP -#include +#include "utils/wrap_stdint.h" #include "openthread/openthread.h" diff --git a/tests/unit/test_mac_frame.cpp b/tests/unit/test_mac_frame.cpp index 07a450c2d..f07717202 100644 --- a/tests/unit/test_mac_frame.cpp +++ b/tests/unit/test_mac_frame.cpp @@ -30,7 +30,7 @@ #include "openthread/openthread.h" #include #include -#include +#include "utils/wrap_string.h" namespace Thread { diff --git a/tests/unit/test_message.cpp b/tests/unit/test_message.cpp index 33710e13d..75afbfb8b 100644 --- a/tests/unit/test_message.cpp +++ b/tests/unit/test_message.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include "utils/wrap_string.h" void TestMessage(void) { diff --git a/tests/unit/test_message_queue.cpp b/tests/unit/test_message_queue.cpp index e0b8987b5..1b04684db 100644 --- a/tests/unit/test_message_queue.cpp +++ b/tests/unit/test_message_queue.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include "utils/wrap_string.h" #include #define kNumTestMessages 5 diff --git a/tests/unit/test_priority_queue.cpp b/tests/unit/test_priority_queue.cpp index 0836d248a..e63f9242d 100644 --- a/tests/unit/test_priority_queue.cpp +++ b/tests/unit/test_priority_queue.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include "utils/wrap_string.h" #include #define kNumTestMessages 3 diff --git a/src/missing/strlcat/strlcat_test.c b/tests/unit/test_strlcat.c similarity index 90% rename from src/missing/strlcat/strlcat_test.c rename to tests/unit/test_strlcat.c index e72cb239c..a6cb9ac20 100644 --- a/src/missing/strlcat/strlcat_test.c +++ b/tests/unit/test_strlcat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The OpenThread Authors. + * Copyright (c) 2016-2017, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,16 +27,19 @@ #include #include -#include "string.h" +#include "utils/wrap_string.h" -int main(void) +int main(int argc, char **argv) { char string_a[8] = "foo"; char string_b[8] = "barbar"; size_t ret = 0; int errors = 0; - ret = strlcat(string_a, string_b, sizeof(string_a)); + (void)argc; + (void)argv; + + ret = missing_strlcat(string_a, string_b, sizeof(string_a)); if (0 != strcmp(string_a, "foobarb")) { diff --git a/src/missing/strlcpy/strlcpy_test.c b/tests/unit/test_strlcpy.c similarity index 93% rename from src/missing/strlcpy/strlcpy_test.c rename to tests/unit/test_strlcpy.c index 41e5b1790..8a7e7c3a7 100644 --- a/src/missing/strlcpy/strlcpy_test.c +++ b/tests/unit/test_strlcpy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The OpenThread Authors. + * Copyright (c) 2016-2017, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,15 +27,17 @@ #include #include -#include "string.h" +#include "utils/wrap_string.h" -int main(void) +int main(int argc, char **argv) { char string_a[8] = "foo"; char string_b[] = "barbarbar"; size_t ret = 0; int errors = 0; + (void)argc; + (void)argv; ret = strlcpy(string_a, string_b, sizeof(string_a)); if (0 != strcmp(string_a, "barbarb")) diff --git a/tests/unit/test_strnlen.c b/tests/unit/test_strnlen.c new file mode 100644 index 000000000..df2490d98 --- /dev/null +++ b/tests/unit/test_strnlen.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2016-2017, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "utils/wrap_string.h" + +static void fail(const char *msg) +{ + fprintf(stderr, "%s\n", msg); + exit(EXIT_FAILURE); +} + +int main(int argc, char **argv) +{ + char string_a[5] = "\0foo"; + char string_b[8] = "foo\0bar"; + + (void)argc; + (void)argv; + + if (0 != missing_strnlen(string_a, 0)) + { + fail("0len 0 fails"); + } + + if (0 != missing_strnlen(string_a, 1)) + { + fail("0len 1 fails"); + } + + if (0 != missing_strnlen(string_a, 2)) + { + fail("0len 2 fails"); + } + + if (0 != missing_strnlen(string_b, 0)) + { + fail("3len 0 fails"); + } + + if (1 != missing_strnlen(string_b, 1)) + { + fail("3len 1 fails"); + } + + if (2 != missing_strnlen(string_b, 2)) + { + fail("3len 2 fails"); + } + + if (3 != missing_strnlen(string_b, 3)) + { + fail("3len 3 fails"); + } + + if (3 != missing_strnlen(string_b, 4)) + { + fail("3len 4 fails"); + } + + if (3 != missing_strnlen(string_b, 5)) + { + fail("3len 5 fails"); + } + + if (3 != missing_strnlen(string_b, 6)) + { + fail("3len 6 fails"); + } + + printf("OK\n"); + return EXIT_SUCCESS; +} diff --git a/tests/unit/test_toolchain.cpp b/tests/unit/test_toolchain.cpp index af3c5cf56..ab8c319cf 100644 --- a/tests/unit/test_toolchain.cpp +++ b/tests/unit/test_toolchain.cpp @@ -27,7 +27,7 @@ */ #include -#include +#include "utils/wrap_stdint.h" #include "openthread/platform/toolchain.h"