Changeset - r28399:078042dc9182
[Not reviewed]
master
0 1 0
glx22 - 4 months ago 2024-01-05 16:52:13
glx@openttd.org
Change: [Script] detection of not properly closed DOXYGEN_API blocks
1 file changed with 15 insertions and 3 deletions:
0 comments (0 inline, 0 general)
cmake/scripts/SquirrelExport.cmake
Show inline comments
 
@@ -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})
0 comments (0 inline, 0 general)