From af14809697ef43b69e46e1805fa2f2f0ee9acbde Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 18 Apr 2025 19:43:32 +0200 Subject: [PATCH] Codechange: Add filename and line number to errors/warnings of the squirrel-exporters. (#14031) --- cmake/scripts/SquirrelExport.cmake | 6 +++--- src/script/api/doxygen_filter.awk | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/scripts/SquirrelExport.cmake b/cmake/scripts/SquirrelExport.cmake index 6549078844..4b63538d49 100644 --- a/cmake/scripts/SquirrelExport.cmake +++ b/cmake/scripts/SquirrelExport.cmake @@ -157,7 +157,7 @@ foreach(LINE IN LISTS SOURCE_LINES) if("${LINE}" MATCHES "^( *)class (.*) (: public|: protected|: private|:) ([^ ]*)") if(NOT CLS_LEVEL) if(NOT DEFINED API_SELECTED) - message(WARNING "Class '${CMAKE_MATCH_2}' has no @api. It won't be published to any API.") + message(WARNING "${SCRIPT_API_FILE}:${NUM_LINE}: Class '${CMAKE_MATCH_2}' has no @api. It won't be published to any API.") set(API_SELECTED FALSE) endif() unset(IS_PUBLIC) @@ -584,7 +584,7 @@ foreach(LINE IN LISTS SOURCE_LINES) endif() if("${LINE}" MATCHES "~") if(DEFINED API_SELECTED) - message(WARNING "Destructor for '${CLS}' has @api. Tag ignored.") + message(WARNING "${SCRIPT_API_FILE}:${NUM_LINE}: Destructor for '${CLS}' has @api. Tag ignored.") unset(API_SELECTED) endif() continue() @@ -609,7 +609,7 @@ foreach(LINE IN LISTS SOURCE_LINES) set(FUNCNAME "${CMAKE_MATCH_3}") if("${FUNCTYPE}" STREQUAL "${CLS}" AND NOT FUNCNAME) if(DEFINED API_SELECTED) - message(WARNING "Constructor for '${CLS}' has @api. Tag ignored.") + message(WARNING "${SCRIPT_API_FILE}:${NUM_LINE}: Constructor for '${CLS}' has @api. Tag ignored.") unset(API_SELECTED) endif() set(CLS_PARAM_0 "${PARAM_S}") diff --git a/src/script/api/doxygen_filter.awk b/src/script/api/doxygen_filter.awk index 086cecd864..6316efcf0d 100644 --- a/src/script/api/doxygen_filter.awk +++ b/src/script/api/doxygen_filter.awk @@ -80,7 +80,7 @@ BEGIN { /^( *)class/ { if (cls_level == 0) { if (api_selected == "") { - print "Class '"$2"' has no @api. It won't be published to any API." > "/dev/stderr" + printf "%s:%d: %s\n", FILENAME, NR, "Class '"$2"' has no @api. It won't be published to any API." > "/dev/stderr" api_selected = "false" } public = "false" @@ -105,7 +105,7 @@ BEGIN { } api_selected = "" } else { - print "Classes nested too deep" > "/dev/stderr" + printf "%s:%d: %s\n", FILENAME, NR, "Classes nested too deep" > "/dev/stderr" exit 1 } cls_level++ @@ -279,7 +279,7 @@ BEGIN { } if (match($0, "~")) { if (api_selected != "") { - print "Destructor for '"cls"' has @api. Tag ignored." > "/dev/stderr" + printf "%s:%d: %s\n", FILENAME, NR, "Destructor for '"cls"' has @api. Tag ignored." > "/dev/stderr" api_selected = "" } next