1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-13 09:39:10 +00:00

Codechange: Add filename and line number to errors/warnings of the squirrel-exporters. (#14031)

This commit is contained in:
frosch
2025-04-18 19:43:32 +02:00
committed by GitHub
parent 50252cb5df
commit af14809697
2 changed files with 6 additions and 6 deletions
cmake/scripts
src/script/api

@@ -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}")

@@ -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