ci(static-checks): correct include order for *.S macro headers
As of commit 59b872e3f890 ("ci(static-checks): improve checks for
thirdparty headers") the include order check often expects the wrong
input order when an assembly macro header (e.g. asm_macro.S) is part
of the includes.
For example, consider the following (made up) example. The proper order
according to the code style documentation would be:
/* system headers */
#include <stddef.h>
/* third-party headers */
#include <mbedtls/version.h>
/* project headers */
#include <arch.h>
#include <asm_macros.S> // <---- correct position
/* platform headers */
#include <platform_def.h>
However, the current implementation insists on making asm_macros.S part
of the third-party header group:
/* third-party headers */
#include <asm_macros.S> // <---- incorrect position
#include <mbedtls/version.h>
/* project headers */
#include <arch.h>
This happens because the *_macros.S in the various include paths are
currently not considered at all when generating the include group sets.
Only *.h files are collected.
Fix this by also adding the *.S assembly macro header files to the
generated include group sets.
This fixes about 130 include ordering warnings in the existing
TF-A code base.
Change-Id: I271b9b655b76178d50eba19d8754c9fd423e3a28
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
diff --git a/script/static-checks/check-include-order.py b/script/static-checks/check-include-order.py
index 4961c05..ffda008 100755
--- a/script/static-checks/check-include-order.py
+++ b/script/static-checks/check-include-order.py
@@ -60,7 +60,7 @@
dir_includes = set()
for (root, _dirs, files) in os.walk(directory):
for fname in files:
- if fname.endswith(".h"):
+ if fname.endswith(".h") or fname.endswith(".S"):
names = os.path.join(root, fname).split(os.sep)
for i in range(len(names)):
suffix_path = "/".join(names[i:])