# HG changeset patch # User glx22 # Date 2024-01-05 16:52:13 # Node ID 078042dc9182362392384963f5cef8ac8e24d297 # Parent 8d247466e28db4d6537324d0e5401af3bee2ee18 Change: [Script] detection of not properly closed DOXYGEN_API blocks diff --git a/cmake/scripts/SquirrelExport.cmake b/cmake/scripts/SquirrelExport.cmake --- a/cmake/scripts/SquirrelExport.cmake +++ b/cmake/scripts/SquirrelExport.cmake @@ -71,13 +71,23 @@ reset_reader() 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) + math(EXPR NUM_LINE "${NUM_LINE} + 1") # Ignore special doxygen blocks if("${LINE}" MATCHES "^#ifndef DOXYGEN_API") + doxygen_check() set(DOXYGEN_SKIP "next") continue() endif() if("${LINE}" MATCHES "^#ifdef DOXYGEN_API") + doxygen_check() set(DOXYGEN_SKIP "true") continue() endif() @@ -86,10 +96,10 @@ foreach(LINE IN LISTS SOURCE_LINES) continue() endif() if("${LINE}" MATCHES "^#else") - if("${DOXYGEN_SKIP}" STREQUAL "next") + if(DOXYGEN_SKIP STREQUAL "next") set(DOXYGEN_SKIP "true") - else() - unset(DOXYGEN_SKIP) + elseif(DOXYGEN_SKIP STREQUAL "true") + set(DOXYGEN_SKIP "false") endif() continue() endif() @@ -668,4 +678,6 @@ foreach(LINE IN LISTS SOURCE_LINES) endif() endforeach() +doxygen_check() + configure_file(${SCRIPT_API_SOURCE_FILE} ${SCRIPT_API_BINARY_FILE})