Change: [Script] detection of not properly closed DOXYGEN_API blocks

This commit is contained in:
glx22 2024-01-05 17:52:13 +01:00 committed by Loïc Guilloux
parent 623df6b94f
commit 4c1ddb1479
1 changed files with 15 additions and 3 deletions

View File

@ -71,13 +71,23 @@ reset_reader()
file(STRINGS "${SCRIPT_API_FILE}" SOURCE_LINES) file(STRINGS "${SCRIPT_API_FILE}" SOURCE_LINES)
set(NUM_LINE 0)
macro(doxygen_check)
if(NOT "${DOXYGEN_SKIP}" STREQUAL "")
message(FATAL_ERROR "${SCRIPT_API_FILE}:${NUM_LINE}: a DOXYGEN_API block was not properly closed")
endif()
endmacro()
foreach(LINE IN LISTS SOURCE_LINES) foreach(LINE IN LISTS SOURCE_LINES)
math(EXPR NUM_LINE "${NUM_LINE} + 1")
# Ignore special doxygen blocks # Ignore special doxygen blocks
if("${LINE}" MATCHES "^#ifndef DOXYGEN_API") if("${LINE}" MATCHES "^#ifndef DOXYGEN_API")
doxygen_check()
set(DOXYGEN_SKIP "next") set(DOXYGEN_SKIP "next")
continue() continue()
endif() endif()
if("${LINE}" MATCHES "^#ifdef DOXYGEN_API") if("${LINE}" MATCHES "^#ifdef DOXYGEN_API")
doxygen_check()
set(DOXYGEN_SKIP "true") set(DOXYGEN_SKIP "true")
continue() continue()
endif() endif()
@ -86,10 +96,10 @@ foreach(LINE IN LISTS SOURCE_LINES)
continue() continue()
endif() endif()
if("${LINE}" MATCHES "^#else") if("${LINE}" MATCHES "^#else")
if("${DOXYGEN_SKIP}" STREQUAL "next") if(DOXYGEN_SKIP STREQUAL "next")
set(DOXYGEN_SKIP "true") set(DOXYGEN_SKIP "true")
else() elseif(DOXYGEN_SKIP STREQUAL "true")
unset(DOXYGEN_SKIP) set(DOXYGEN_SKIP "false")
endif() endif()
continue() continue()
endif() endif()
@ -668,4 +678,6 @@ foreach(LINE IN LISTS SOURCE_LINES)
endif() endif()
endforeach() endforeach()
doxygen_check()
configure_file(${SCRIPT_API_SOURCE_FILE} ${SCRIPT_API_BINARY_FILE}) configure_file(${SCRIPT_API_SOURCE_FILE} ${SCRIPT_API_BINARY_FILE})