WIP: clang-tidy

This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-29 16:03:08 +02:00
parent aac42ab355
commit 6ca7359d0b
5 changed files with 37 additions and 4 deletions

View File

@@ -73,3 +73,5 @@ xephyr_man = configure_file(
configuration: manpage_config,
)
install_man(xephyr_man)
tidy_candidates += xephyr_server

View File

@@ -28,3 +28,5 @@ install_man(configure_file(
output: 'Xvfb.1',
configuration: manpage_config,
))
tidy_candidates += xvfb_server

View File

@@ -120,6 +120,8 @@ e = executable(
implib: true,
)
tidy_candidates += e
# subdirs for modules loadable by Xorg
subdir('dixmods')
subdir('exa')
@@ -147,7 +149,7 @@ meson.add_install_script(
join_paths(get_option('prefix'), get_option('bindir'), 'X')))
if get_option('suid_wrapper')
executable('Xorg.wrap',
tidy_candidates += executable('Xorg.wrap',
'xorg-wrapper.c',
include_directories: [inc, xorg_inc],
dependencies: xorg_deps,
@@ -173,7 +175,7 @@ if get_option('suid_wrapper')
)
endif
executable('gtf',
tidy_candidates += executable('gtf',
'utils/gtf/gtf.c',
include_directories: [inc, xorg_inc],
dependencies: xorg_deps,
@@ -181,6 +183,7 @@ executable('gtf',
install: true,
)
# For symbol presence testing only
xorgserver_lib = shared_library(
'xorgserver',
@@ -193,6 +196,8 @@ xorgserver_lib = shared_library(
install: false,
)
tidy_candidates += xorgserver_lib
xorgserver_dep = declare_dependency(link_with: xorgserver_lib)
install_man(configure_file(

View File

@@ -27,7 +27,7 @@ xcb_shape_dep = dependency('xcb-shape', required: true)
xcb_icccm_dep = dependency('xcb-icccm', required: true)
xcb_xkb_dep = dependency('xcb-xkb', required: true)
executable(
tidy_candidates += executable(
'Xnest',
srcs,
include_directories: inc,

View File

@@ -19,7 +19,6 @@ add_project_link_arguments('-fvisibility=hidden', language : 'c')
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
test_wflags = [
'-pedantic',
'-Wall',
'-Wpointer-arith',
'-Wmissing-declarations',
@@ -656,6 +655,8 @@ if serverconfigdir == ''
serverconfigdir = join_paths(get_option('prefix'), get_option('libdir'), 'xorg')
endif
tidy_candidates = []
subdir('man')
require_docs = get_option('docs') == 'true'
@@ -870,3 +871,26 @@ configure_file(output : 'xorg-server.h',
configuration : conf_data,
install: build_xorg,
install_dir: xorgsdkdir)
clangtidy = find_program('clang-tidy', required : false)
if clangtidy.found()
tidy_opts = [
'--checks=-*,clang-analyzer-core.uninitialized.*',
'--',
'-std=c11'
]
tidy_targets = []
foreach s : tidy_candidates
tidy_targets += custom_target(
'tidy-' + s.name(),
input: s.sources(),
output: 'tidy-' + s.name() + '.log',
command: [clangtidy, '@INPUT@'] + tidy_opts,
capture: true
)
endforeach
run_target('clang-tidy-all', command: ['true'], depends: tidy_targets)
endif