Skip to content

Commit 775696c

Browse files
pdgendtkartben
authored andcommitted
cmake: extensions: Add macro helper for functions to have no arguments
Add zephyr_check_no_arguments that macros and functions can call to check that no arguments are given. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent fae619a commit 775696c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cmake/modules/extensions.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5739,6 +5739,20 @@ macro(zephyr_check_flags_exclusive function prefix)
57395739
endif()
57405740
endmacro()
57415741

5742+
#
5743+
# Helper macro for verifying that no unexpected arguments are provided.
5744+
#
5745+
# A FATAL_ERROR will be raised if any unexpected argument is given.
5746+
#
5747+
# Usage:
5748+
# zephyr_check_no_arguments(<function_name> ${ARGN})
5749+
#
5750+
macro(zephyr_check_no_arguments function)
5751+
if(${ARGC} GREATER 1)
5752+
message(FATAL_ERROR "${function} called with unexpected argument(s): ${ARGN}")
5753+
endif()
5754+
endmacro()
5755+
57425756
########################################################
57435757
# 7. Linkable loadable extensions (llext)
57445758
########################################################

0 commit comments

Comments
 (0)