From d5da6a7ac36aa68fcbe717cb08c093ee3cb0039e Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 1 Nov 2019 13:52:52 +0100 Subject: [PATCH 1/2] examples: tests: make use of DEVELHELP consistent --- examples/cord_ep/Makefile | 2 +- examples/cord_epsim/Makefile | 2 +- examples/dtls-echo/Makefile | 2 +- examples/dtls-wolfssl/Makefile | 2 +- examples/ndn-ping/Makefile | 2 +- tests/driver_lc709203f/Makefile | 1 - tests/gnrc_gomach/Makefile | 5 ----- tests/socket_zep/Makefile | 2 -- 8 files changed, 5 insertions(+), 13 deletions(-) diff --git a/examples/cord_ep/Makefile b/examples/cord_ep/Makefile index b987bb240a..95ab5d09a2 100644 --- a/examples/cord_ep/Makefile +++ b/examples/cord_ep/Makefile @@ -22,7 +22,7 @@ USEMODULE += fmt # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +DEVELHELP ?= 1 # For debugging and demonstration purposes, we limit the lifetime to 60s CFLAGS += -DCORD_LT=60 diff --git a/examples/cord_epsim/Makefile b/examples/cord_epsim/Makefile index 5a7671ad37..199397134b 100644 --- a/examples/cord_epsim/Makefile +++ b/examples/cord_epsim/Makefile @@ -21,7 +21,7 @@ USEMODULE += xtimer # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +DEVELHELP ?= 1 # For debugging and demonstration purposes, we limit the lifetime to the minimal # allowed value of 60s (see draft-ietf-core-resource-directory-11, Table 2) diff --git a/examples/dtls-echo/Makefile b/examples/dtls-echo/Makefile index d8d4f0966b..042fbb4375 100644 --- a/examples/dtls-echo/Makefile +++ b/examples/dtls-echo/Makefile @@ -48,7 +48,7 @@ CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(3*THREAD_STACKSIZE_DEFAULT\) # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +DEVELHELP ?= 1 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/examples/dtls-wolfssl/Makefile b/examples/dtls-wolfssl/Makefile index 8bb4e7699f..ed68d71694 100644 --- a/examples/dtls-wolfssl/Makefile +++ b/examples/dtls-wolfssl/Makefile @@ -40,7 +40,7 @@ CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(3*THREAD_STACKSIZE_DEFAULT\) # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +DEVELHELP ?= 1 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/examples/ndn-ping/Makefile b/examples/ndn-ping/Makefile index 5ede2e0afc..3617c686b3 100644 --- a/examples/ndn-ping/Makefile +++ b/examples/ndn-ping/Makefile @@ -23,7 +23,7 @@ USEPKG += ndn-riot # Comment this out to disable code in RIOT that does safety checking # which is not needed in a production environment but helps in the # development process: -CFLAGS += -DDEVELHELP +DEVELHELP ?= 1 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/tests/driver_lc709203f/Makefile b/tests/driver_lc709203f/Makefile index fb32efbe6d..97fcfcc8c2 100644 --- a/tests/driver_lc709203f/Makefile +++ b/tests/driver_lc709203f/Makefile @@ -2,6 +2,5 @@ include ../Makefile.tests_common USEMODULE += lc709203f USEMODULE += xtimer -CFLAGS += -DDEVELHELP include $(RIOTBASE)/Makefile.include diff --git a/tests/gnrc_gomach/Makefile b/tests/gnrc_gomach/Makefile index c6dba1f96b..75685b6446 100644 --- a/tests/gnrc_gomach/Makefile +++ b/tests/gnrc_gomach/Makefile @@ -7,11 +7,6 @@ include ../Makefile.tests_common # be then accordingly extended. BOARD_WHITELIST := samr21-xpro iotlab-m3 -# Comment this out to disable code in RIOT that does safety checking -# which is not needed in a production environment but helps in the -# development process: -CFLAGS += -DDEVELHELP - # Modules to include: USEMODULE += shell USEMODULE += shell_commands diff --git a/tests/socket_zep/Makefile b/tests/socket_zep/Makefile index c5959295f8..b4143a45bf 100644 --- a/tests/socket_zep/Makefile +++ b/tests/socket_zep/Makefile @@ -11,8 +11,6 @@ DISABLE_MODULE += auto_init USEMODULE += od USEMODULE += socket_zep -CFLAGS += -DDEVELHELP - TERMFLAGS ?= -z [::1]:17754 include $(RIOTBASE)/Makefile.include From 86bd4d98a571fbc6874f4689ba7c568ab9ac7903 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 1 Nov 2019 13:54:32 +0100 Subject: [PATCH 2/2] tools/build_system_sanity_check: add check for DEVELHELP This variable should be set directly as it's hanbled after in Makefile.include, and not directly via CFLAGS --- dist/tools/buildsystem_sanity_check/check.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 7e5b4bedff..2369343ec6 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -201,6 +201,19 @@ checks_tests_application_not_defined_in_makefile() { | error_with_message "Don't define APPLICATION in test Makefile" } +# Develhelp should not be set via CFLAGS +checks_develhelp_not_defined_via_cflags() { + local patterns=() + local pathspec=() + + patterns+=(-e '^[[:space:]]*CFLAGS[[:space:]:+]+=[[:space:]:+]-DDEVELHELP') + + pathspec+=('**/Makefile') + + git -C "${RIOTBASE}" grep "${patterns[@]}" -- "${pathspec[@]}" \ + | error_with_message "Use DEVELHELP ?= 1 instead of using CFLAGS directly" +} + error_on_input() { ! grep '' } @@ -214,6 +227,7 @@ all_checks() { check_not_setting_board_equal check_board_insufficient_memory_not_in_makefile checks_tests_application_not_defined_in_makefile + checks_develhelp_not_defined_via_cflags } main() {