1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-05 20:55:46 +03:00

Update header files parser to match mutli-line function declarations

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2020-12-17 16:55:30 +01:00
parent adfb2bcc75
commit 8ed50ea6ed

View File

@@ -50,15 +50,28 @@ file(READ ${HEADERS_LIST_FILE} HEADERS_LIST)
set(symbols) set(symbols)
foreach(header ${HEADERS_LIST}) foreach(header ${HEADERS_LIST})
file(READ ${header} header_content)
# Filter only lines containing the FILTER_PATTERN # Filter only lines containing the FILTER_PATTERN
file(STRINGS ${header} contain_filter # separated from the function name with one optional newline
REGEX "^.*${FILTER_PATTERN}.*[(]" string(REGEX MATCHALL
"${FILTER_PATTERN}[^(\n]*\n?[^(\n]*[(]"
contain_filter
"${header_content}"
)
# Remove the optional newline now
string(REGEX REPLACE
"(.+)\n?(.*)"
"\\1\\2"
oneline
"${contain_filter}"
) )
# Remove function-like macros # Remove function-like macros
foreach(line ${contain_filter}) # and anything with two underscores that sounds suspicious
if (NOT ${line} MATCHES ".*#[ ]*define") foreach(line ${oneline})
if (NOT ${line} MATCHES ".*(#[ ]*define|__)")
list(APPEND not_macro ${line}) list(APPEND not_macro ${line})
endif() endif()
endforeach() endforeach()