Skip to content

Commit d3a5467

Browse files
committed
meson: move headers definition from 'contrib/coccinelle'
The Meson build for coccinelle static analysis lists all headers to analyse. Due to the way Meson exports variables between subdirs, this variable is also available in the root Meson build. An upcoming commit, will add a new check complimenting 'hdr-check' in the Makefile. This would require the list of headers. So move the 'coccinelle_headers' to the root Meson build and rename it to 'headers', remove the root path being appended to each header and retain that in the coccinelle Meson build since it is specific to the coccinelle build. Also move the 'third_party_sources' variable to the root Meson build since it is also a dependency for the 'headers' variable. This also makes it easier to understand as the variable is now propagated from the top level to the bottom. Signed-off-by: Karthik Nayak <[email protected]>
1 parent 415711e commit d3a5467

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

contrib/coccinelle/meson.build

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ if not spatch.found()
88
subdir_done()
99
endif
1010

11-
third_party_sources = [
12-
':!contrib',
13-
':!compat/inet_ntop.c',
14-
':!compat/inet_pton.c',
15-
':!compat/nedmalloc',
16-
':!compat/obstack.*',
17-
':!compat/poll',
18-
':!compat/regex',
19-
':!sha1collisiondetection',
20-
':!sha1dc',
21-
':!t/unit-tests/clar',
22-
':!t/unit-tests/clar',
23-
':!t/t[0-9][0-9][0-9][0-9]*',
24-
]
25-
2611
rules = [
2712
'array.cocci',
2813
'commit.cocci',
@@ -61,7 +46,7 @@ foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files',
6146
endforeach
6247

6348
coccinelle_headers = []
64-
foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
49+
foreach header : headers_to_check
6550
coccinelle_headers += meson.project_source_root() / header
6651
endforeach
6752

meson.build

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,28 @@ builtin_sources = [
633633
'builtin/write-tree.c',
634634
]
635635

636+
third_party_sources = [
637+
':!contrib',
638+
':!compat/inet_ntop.c',
639+
':!compat/inet_pton.c',
640+
':!compat/nedmalloc',
641+
':!compat/obstack.*',
642+
':!compat/poll',
643+
':!compat/regex',
644+
':!sha1collisiondetection',
645+
':!sha1dc',
646+
':!t/unit-tests/clar',
647+
':!t/unit-tests/clar',
648+
':!t/t[0-9][0-9][0-9][0-9]*',
649+
]
650+
651+
if git.found()
652+
headers_to_check = []
653+
foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
654+
headers_to_check += header
655+
endforeach
656+
endif
657+
636658
if not get_option('breaking_changes')
637659
builtin_sources += 'builtin/pack-redundant.c'
638660
endif

0 commit comments

Comments
 (0)