1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

syntax-check: Improve sc_prohibit_config_h_in_headers check

In its current form, the check will not only catch the intended

  #include <config.h>

but also stuff like

  #include <wireshark/config.h>
  #include "qemu_interop_config.h"
  #include <meson-config.h>

The last one is problematic, because it's used in config.h itself.
Making the pattern more strict allows us to drop the exception.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2022-05-23 15:46:24 +02:00
parent 8aa6063ef9
commit 18cb263100

View File

@ -694,7 +694,7 @@ sc_prohibit_include_public_headers_brackets:
# <config.h> is only needed in .c files; .h files do not need it since
# .c files must include config.h before any other .h.
sc_prohibit_config_h_in_headers:
@prohibit='^# *include\>.*config\.h' \
@prohibit='^# *include *[<"]config\.h' \
in_vc_files='\.h$$' \
halt='headers should not include <config.h>' \
$(_sc_search_regexp)
@ -1707,6 +1707,3 @@ exclude_file_name_regexp--sc_prohibit_backslash_alignment = \
exclude_file_name_regexp--sc_prohibit_select = \
^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c|tests/meson\.build$$
exclude_file_name_regexp--sc_prohibit_config_h_in_headers = \
^config\.h$$