the scripts/check_feature_macros.py does not seem to work as intended:
problem 1: it is not running
it does not invoke the main() function. I pushed a change with the following diff:
Author: Paul Dreik <[email protected]>
Date: Tue Dec 30 10:54:08 2025 +0100
make feature macro script runnable
diff --git a/scripts/check_feature_macros.py b/scripts/check_feature_macros.py
old mode 100644
new mode 100755
index 1462a6b7..5c8ba718
--- a/scripts/check_feature_macros.py
+++ b/scripts/check_feature_macros.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
import subprocess
import re
import os
@@ -123,4 +124,7 @@ def main():
sys.exit(1) # Exit with error code if errors are found
else:
print("All #if...#endif pairs for SIMDUTF feature macros are correctly matched with valid comments.")
- sys.exit(0) # Exit with success code
\ No newline at end of file
+ sys.exit(0) # Exit with success code
+
+if __name__ == "__main__":
+ main()
the ci job started failing for visual studio - this script is run by the check_feature_macro test, which now seems to start running. it must have been not running before (proof in the next point).
problem 2: it does not handle multiple lines
since a while back, the feature macros check sometimes end up on multiple lines. the script does not understand that.
the reported error is:
ERROR: include/simdutf/implementation.h:2974: #endif comment 'SIMDUTF_FEATURE_BASE64 || SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_BASE64 || SIMDUTF_FEATURE_UTF16 || \' at line 2969
ERROR: src/arm64/implementation.cpp:17: #endif comment 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING ||' does not match #if condition 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING || \' at line 11
ERROR: src/arm64/implementation.cpp:107: #endif comment 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_UTF32)' at line 30
ERROR: src/haswell/implementation.cpp:16: #endif comment 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING ||' does not match #if condition 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING || \' at line 11
ERROR: src/icelake/implementation.cpp:28: #endif comment 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_UTF8 && \' at line 24
ERROR: src/lasx/implementation.cpp:48: #endif comment 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING ||' does not match #if condition 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING || \' at line 43
ERROR: src/lasx/implementation.cpp:119: #endif comment 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_UTF32)' at line 61
ERROR: src/lsx/implementation.cpp:45: #endif comment 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING ||' does not match #if condition 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING || \' at line 40
ERROR: src/lsx/implementation.cpp:116: #endif comment 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_UTF32)' at line 58
ERROR: src/rvv/rvv_utf8_to.inl.cpp:269: #endif comment 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_UTF32)' at line 1
ERROR: src/simdutf.cpp:49: #endif comment 'SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING ||' does not match #if condition 'SIMDUTF_FEATURE_UTF16 || SIMDUTF_FEATURE_DETECT_ENCODING || \' at line 46
ERROR: src/simdutf.cpp:85: #endif comment 'SIMDUTF_FEATURE_UTF8 && (SIMDUTF_FEATURE_UTF16 ||' does not match #if condition 'SIMDUTF_FEATURE_UTF8 && \' at line 81
ERROR: src/westmere/implementation.cpp:16: #endif comment 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING ||' does not match #if condition 'SIMDUTF_FEATURE_ASCII || SIMDUTF_FEATURE_DETECT_ENCODING || \' at line 11
suggested fix
make it handle multiline. also, maybe run it as a separate ci job instead of as a unit test? it only needs to run once.
the scripts/check_feature_macros.py does not seem to work as intended:
problem 1: it is not running
it does not invoke the main() function. I pushed a change with the following diff:
the ci job started failing for visual studio - this script is run by the check_feature_macro test, which now seems to start running. it must have been not running before (proof in the next point).
problem 2: it does not handle multiple lines
since a while back, the feature macros check sometimes end up on multiple lines. the script does not understand that.
the reported error is:
suggested fix
make it handle multiline. also, maybe run it as a separate ci job instead of as a unit test? it only needs to run once.