aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlint/checkpatch/checkpatch_osmo.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/lint/checkpatch/checkpatch_osmo.sh b/lint/checkpatch/checkpatch_osmo.sh
index 91e9abe..f9cc74f 100755
--- a/lint/checkpatch/checkpatch_osmo.sh
+++ b/lint/checkpatch/checkpatch_osmo.sh
@@ -1,6 +1,7 @@
#!/bin/sh -e
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
-PROJECT="$(basename "$(git rev-parse --show-toplevel)")"
+PROJECT_DIR="$(git rev-parse --show-toplevel)"
+PROJECT="$(basename "$PROJECT_DIR")"
exclude_paths_common() {
# Stdout and stderr of regression tests
@@ -9,6 +10,21 @@ exclude_paths_common() {
echo '--exclude ^debian/changelog$'
}
+exclude_paths_common_asn1c() {
+ local pattern="^ \* Generated by asn1c-"
+ local files="$(find -name '*.c' -o -name '*.h' | cut -d / -f 2-)"
+ local i
+
+ if [ -z "$files" ]; then
+ return
+ fi
+
+ for i in $(grep -l "$pattern" $files); do
+ # Example: --exclude ^include/osmocom/sabp/SABP_Data-Coding-Scheme.h$
+ echo '--exclude ^'$i'$'
+ done
+}
+
exclude_paths_project() {
case "$PROJECT" in
libosmocore)
@@ -56,8 +72,11 @@ exclude_paths_project() {
# * UNNECESSARY_INT: not followed (see https://gerrit.osmocom.org/c/libosmocore/+/25345)
# * UNSPECIFIED_INT: not followed (doesn't seem useful for us)
+cd "$PROJECT_DIR"
+
$SCRIPT_DIR/checkpatch.pl \
$(exclude_paths_common) \
+ $(exclude_paths_common_asn1c) \
$(exclude_paths_project) \
--ignore ASSIGN_IN_IF \
--ignore AVOID_EXTERNS \