]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Use .inc for generated code meant to be included in other files
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 08:32:32 +0000 (10:32 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 22 May 2025 09:25:29 +0000 (11:25 +0200)
These files use the .h extension but are not standalone so let's not
make it appear like they are proper headers and instead use the .inc
extension.

18 files changed:
src/basic/af-list.c
src/basic/arphrd-util.c
src/basic/cap-list.c
src/basic/errno-list.c
src/basic/filesystems.c
src/basic/meson.build
src/libsystemd/sd-journal/audit-type.c
src/libsystemd/sd-journal/meson.build
src/resolve/dns-type.c
src/resolve/meson.build
src/shared/ethtool-util.c
src/shared/ip-protocol-list.c
src/shared/meson.build
src/shared/seccomp-util.c
src/test/test-af-list.c
src/test/test-errno-list.c
src/udev/meson.build
src/udev/udev-builtin-keyboard.c

index 60da592e3f8346eda2e9399f7370be075d808127..421a16d73f3863b0752830992c65fe1384c9aa87 100644 (file)
@@ -10,8 +10,8 @@
 
 static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
 
-#include "af-from-name.h"
-#include "af-to-name.h"
+#include "af-from-name.inc"
+#include "af-to-name.inc"
 
 const char* af_to_name(int id) {
 
index 2aa48182fcce6f11aa72d7c4e133175ba71b3008..063aede5e721f4ebc960bf1861c403e85443b1b2 100644 (file)
@@ -12,8 +12,8 @@
 
 static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
 
-#include "arphrd-from-name.h"
-#include "arphrd-to-name.h"
+#include "arphrd-from-name.inc"
+#include "arphrd-to-name.inc"
 
 int arphrd_from_name(const char *name) {
         const struct arphrd_name *sc;
index c2b374c8fcff892045c6965a8fb2a9302724607e..9ae679330acbfedbf6da511194873933c5867826 100644 (file)
@@ -17,8 +17,8 @@
 
 static const struct capability_name* lookup_capability(register const char *str, register GPERF_LEN_TYPE len);
 
-#include "cap-from-name.h"
-#include "cap-to-name.h"
+#include "cap-from-name.inc"
+#include "cap-to-name.inc"
 
 const char* capability_to_name(int id) {
         if (id < 0)
index 677b906cc549e59bd288c9f984eb28783e66a8b2..396879c8f2c6db32fb3838d3c4d9222d10c79525 100644 (file)
 static const struct errno_name* lookup_errno(register const char *str,
                                              register GPERF_LEN_TYPE len);
 
-#include "errno-from-name.h"
+#include "errno-from-name.inc"
 
 #if !HAVE_STRERRORNAME_NP
-#include "errno-to-name.h"
+#include "errno-to-name.inc"
 
 const char* errno_to_name(int id) {
 
index 05ff75cd5d4e319d2adb431283e8ce9c6954a79e..45f56fdf5aab98199136cce93a569d86bcfd74cc 100644 (file)
@@ -6,7 +6,7 @@
 const char* fs_type_to_string(statfs_f_type_t magic) {
 
         switch (magic) {
-#include "filesystem-switch-case.h"
+#include "filesystem-switch-case.inc"
         }
 
         return NULL;
@@ -158,7 +158,7 @@ const FilesystemSet filesystem_sets[_FILESYSTEM_SET_MAX] = {
                 .name = "@known",
                 .help = "All known filesystems declared in the kernel",
                 .value =
-#include "filesystem-list.h"
+#include "filesystem-list.inc"
         },
 };
 
index df363f6048e2867b1fe9d9d452a2e59a3f2d21a1..2de53df93565ddea609811063057769ef0fb0eef 100644 (file)
@@ -168,7 +168,7 @@ foreach item : [['af',     af_list_txt,     'af',         ''],
                 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
                 capture : true)
 
-        fname = '@0@-from-name.h'.format(item[0])
+        fname = '@0@-from-name.inc'.format(item[0])
         target1 = custom_target(
                 fname,
                 input : gperf_file,
@@ -181,7 +181,7 @@ foreach item : [['af',     af_list_txt,     'af',         ''],
                            '@INPUT@'],
                 capture : true)
 
-        fname = '@0@-to-name.h'.format(item[0])
+        fname = '@0@-to-name.inc'.format(item[0])
         awkscript = '@0@-to-name.awk'.format(item[0])
         target2 = custom_target(
                 fname,
@@ -266,8 +266,8 @@ filesystems_gperf_h = custom_target(
         command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
 
 generate_filesystem_list = find_program('generate-filesystem-list.py')
-fname = 'filesystem-list.h'
-filesystem_list_h = custom_target(
+fname = 'filesystem-list.inc'
+filesystem_list_inc = custom_target(
         fname,
         input : 'filesystems-gperf.gperf',
         output : fname,
@@ -275,18 +275,18 @@ filesystem_list_h = custom_target(
                    '@INPUT@'],
         capture : true)
 
-generate_filesystem_switch_case_h = find_program('generate-filesystem-switch-case.py')
-fname = 'filesystem-switch-case.h'
-filesystem_switch_case_h = custom_target(
+generate_filesystem_switch_case_inc = find_program('generate-filesystem-switch-case.py')
+fname = 'filesystem-switch-case.inc'
+filesystem_switch_case_inc = custom_target(
         fname,
         input : 'filesystems-gperf.gperf',
-        output : 'filesystem-switch-case.h',
-        command : [generate_filesystem_switch_case_h,
+        output : fname,
+        command : [generate_filesystem_switch_case_inc,
                    '@INPUT@'],
         capture : true)
 
-generated_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
-basic_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
+generated_sources += [filesystem_list_inc, filesystem_switch_case_inc, filesystems_gperf_h]
+basic_sources += [filesystem_list_inc, filesystem_switch_case_inc, filesystems_gperf_h]
 
 libbasic_static = static_library(
         'basic',
index 122cdf5d3f6bf9523811bfeba15e7b754522cd49..1995e3fa180ced69cd9aa8e042480859012a16bc 100644 (file)
@@ -3,4 +3,4 @@
 #include "audit-type.h"
 #include "missing_audit.h"
 
-#include "audit_type-to-name.h"
+#include "audit_type-to-name.inc"
index 5b8b582f27db457bbf37685ca6238e001b8255da..f49b59a7c125bc768d86d8571cf412165a9d134e 100644 (file)
@@ -27,8 +27,8 @@ audit_type_list_txt = custom_target(
         capture : true)
 
 audit_type_to_name = custom_target(
-        'audit_type-to-name.h',
+        'audit_type-to-name.inc',
         input : ['audit_type-to-name.awk', audit_type_list_txt],
-        output : 'audit_type-to-name.h',
+        output : 'audit_type-to-name.inc',
         command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
         capture : true)
index 57fd915c691f0b1c11282ac74c37a3899a824e73..0cf5926f81e66cc84ce59bcce1a787808cbd4fb2 100644 (file)
@@ -14,8 +14,8 @@ typedef const struct {
 static const struct dns_type_name *
 lookup_dns_type (register const char *str, register GPERF_LEN_TYPE len);
 
-#include "dns_type-from-name.h"
-#include "dns_type-to-name.h"
+#include "dns_type-from-name.inc"
+#include "dns_type-to-name.inc"
 
 int dns_type_from_string(const char *s) {
         const struct dns_type_name *sc;
index b47dfd272498ec5896ab1facc9530ea990ab9e0d..5312eaece96e6594298b78bdc8ece9bb14a468d9 100644 (file)
@@ -61,10 +61,10 @@ gperf_file = custom_target(
         command : [generate_dns_type_gperf, 'dns_type', 'DNS_TYPE_', '@INPUT@'],
         capture : true)
 
-dns_type_from_name_h = custom_target(
-        'dns_type-from-name.h',
+dns_type_from_name_inc = custom_target(
+        'dns_type-from-name.inc',
         input : gperf_file,
-        output : 'dns_type-from-name.h',
+        output : 'dns_type-from-name.inc',
         command : [gperf,
                    '-L', 'ANSI-C', '-t', '--ignore-case',
                    '-N', 'lookup_dns_type',
@@ -73,10 +73,10 @@ dns_type_from_name_h = custom_target(
                    '@INPUT@'],
         capture : true)
 
-dns_type_to_name_h = custom_target(
-        'dns_type-to-name.h',
+dns_type_to_name_inc = custom_target(
+        'dns_type-to-name.inc',
         input : ['dns_type-to-name.awk', dns_type_list_txt],
-        output : 'dns_type-to-name.h',
+        output : 'dns_type-to-name.inc',
         command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
         capture : true)
 
@@ -98,8 +98,8 @@ resolved_dns_delegate_gperf_c = custom_target(
         output : 'resolved-dns-delegate-gperf.c',
         command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
 
-generated_sources += [dns_type_from_name_h, dns_type_to_name_h, resolved_gperf_c, resolved_dnssd_gperf_c, resolved_dns_delegate_gperf_c]
-systemd_resolved_extract_sources += [dns_type_from_name_h, dns_type_to_name_h, resolved_gperf_c, resolved_dnssd_gperf_c, resolved_dns_delegate_gperf_c]
+generated_sources += [dns_type_from_name_inc, dns_type_to_name_inc, resolved_gperf_c, resolved_dnssd_gperf_c, resolved_dns_delegate_gperf_c]
+systemd_resolved_extract_sources += [dns_type_from_name_inc, dns_type_to_name_inc, resolved_gperf_c, resolved_dnssd_gperf_c, resolved_dns_delegate_gperf_c]
 
 if conf.get('ENABLE_DNS_OVER_TLS') == 1
         systemd_resolved_extract_sources += files(
index c807aceefdc6b9bbfea995d74273950cb7c29c8a..85fd2a09734bf02a2cffd32cdfb99c199c62d300 100644 (file)
@@ -154,7 +154,7 @@ static const char* const netdev_feature_table[_NET_DEV_FEAT_MAX] = {
 };
 
 static const char* const ethtool_link_mode_bit_table[] = {
-#  include "ethtool-link-mode.h"
+#  include "ethtool-link-mode.inc"
 };
 /* Make sure the array is large enough to fit all bits */
 assert_cc((ELEMENTSOF(ethtool_link_mode_bit_table)-1) / 32 < N_ADVERTISE);
index 923d60abba20b8d5930fa8476022e52c5837b33c..606d2b2dbeeb4b55fb049e70dd8412eed26d1621 100644 (file)
@@ -11,8 +11,8 @@
 
 static const struct ip_protocol_name* lookup_ip_protocol(register const char *str, register GPERF_LEN_TYPE len);
 
-#include "ip-protocol-from-name.h"
-#include "ip-protocol-to-name.h"
+#include "ip-protocol-from-name.inc"
+#include "ip-protocol-to-name.inc"
 
 const char* ip_protocol_to_name(int id) {
 
index 3f70ddbfd52334277e06aba01e3db68d9acfa445..3039e5e29e4698f4f504a42f93395a33ebd36d6f 100644 (file)
@@ -227,8 +227,8 @@ if get_option('tests') != 'false'
 endif
 
 generate_syscall_list = find_program('generate-syscall-list.py')
-fname = 'syscall-list.h'
-syscall_list_h = custom_target(
+fname = 'syscall-list.inc'
+syscall_list_inc = custom_target(
         fname,
         input : syscall_list_txt,
         output : fname,
@@ -236,7 +236,7 @@ syscall_list_h = custom_target(
                    '@INPUT@'],
         capture : true)
 
-generated_sources += syscall_list_h
+generated_sources += syscall_list_inc
 
 if conf.get('ENABLE_UTMP') == 1
         shared_sources += files('utmp-wtmp.c')
@@ -244,7 +244,7 @@ endif
 
 if conf.get('HAVE_SECCOMP') == 1
         shared_sources += files('seccomp-util.c')
-        shared_sources += syscall_list_h
+        shared_sources += syscall_list_inc
 endif
 
 if conf.get('HAVE_LIBIPTC') == 1
@@ -282,7 +282,7 @@ gperf_file = custom_target(
         command : [generate_gperfs, 'ip_protocol', 'IPPROTO_', '@INPUT@', '<netinet/in.h>'],
         capture : true)
 
-fname = 'ip-protocol-from-name.h'
+fname = 'ip-protocol-from-name.inc'
 target1 = custom_target(
         fname,
         input : gperf_file,
@@ -295,7 +295,7 @@ target1 = custom_target(
                    '@INPUT@'],
         capture : true)
 
-fname = 'ip-protocol-to-name.h'
+fname = 'ip-protocol-to-name.inc'
 awkscript = 'ip-protocol-to-name.awk'
 target2 = custom_target(
         fname,
@@ -307,16 +307,16 @@ target2 = custom_target(
 generated_sources += [target1, target2]
 shared_sources += [target1, target2]
 
-fname = 'ethtool-link-mode.h'
-ethtool_link_mode_h = custom_target(
+fname = 'ethtool-link-mode.inc'
+ethtool_link_mode_inc = custom_target(
         fname,
         input : ['ethtool-link-mode.py', '../basic/include/linux/ethtool.h'],
         output : fname,
         command : [python, '@INPUT0@', '--header', cpp, '@INPUT1@'],
         capture : true)
 
-generated_sources += ethtool_link_mode_h
-shared_sources += ethtool_link_mode_h
+generated_sources += ethtool_link_mode_inc
+shared_sources += ethtool_link_mode_inc
 sources += shared_sources
 
 fname = 'ethtool-link-mode.xml'
index 416e6292070626f5696f45c7d390dd3785ef576c..07a59830545beb50011bca16de6d843f077bf3c3 100644 (file)
@@ -989,7 +989,7 @@ const SyscallFilterSet syscall_filter_sets[_SYSCALL_FILTER_SET_MAX] = {
                 .help = "All known syscalls declared in the kernel",
                 .value =
                 "@obsolete\0"
-#include "syscall-list.h"
+#include "syscall-list.inc"
         },
 };
 
index 2dbb3097d9ebde22ac7a6f2478efd41e1ec2aa23..59ee1758d168789041f51b45a57d578c6488a05f 100644 (file)
@@ -1,13 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "af-list.h"
 #include "tests.h"
 
 _unused_
 static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
 
-#include "af-from-name.h"
-#include "af-list.h"
-#include "af-to-name.h"
+#include "af-from-name.inc"
+#include "af-to-name.inc"
 
 TEST(af_list) {
         for (unsigned i = 0; i < ELEMENTSOF(af_names); i++) {
index fb9218027944bc85b112f3e24473532f3b890595..3bd9ee232ca83d746b95196ab3b2fec9b89f699b 100644 (file)
@@ -1,9 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "errno-list.h"
-#include "errno-to-name.h"
 #include "tests.h"
 
+#include "errno-to-name.inc"
+
 TEST(errno_list) {
         ASSERT_NULL(errno_names[0]);
         ASSERT_NULL(errno_to_name(0));
index ccf630919f5cb84ca55ded5338e6cd96f855202a..7d994ad5d0c75e550c062082791ddf937e403f23 100644 (file)
@@ -78,8 +78,8 @@ gperf_file = custom_target(
         command : [generate_keyboard_keys_gperf, '@INPUT@'],
         capture : true)
 
-fname = 'keyboard-keys-from-name.h'
-keyboard_keys_from_name_h = custom_target(
+fname = 'keyboard-keys-from-name.inc'
+keyboard_keys_from_name_inc = custom_target(
         fname,
         input : gperf_file,
         output : fname,
@@ -91,7 +91,7 @@ keyboard_keys_from_name_h = custom_target(
                    '@INPUT@'],
         capture : true)
 
-generated_sources += keyboard_keys_from_name_h
+generated_sources += keyboard_keys_from_name_inc
 
 ############################################################
 
@@ -151,7 +151,7 @@ udev_binaries_dict = [
                 'public' : true,
                 'sources' : udevadm_sources +
                             udevadm_extract_sources +
-                            keyboard_keys_from_name_h,
+                            keyboard_keys_from_name_inc,
                 'include_directories' : [
                         libexec_template['include_directories'],
                         include_directories('.', 'net'),
index a48a5500d14ec0eb366aed32c5ff1191de9aec4c..e30d3cd97638a78f32e14059523a0c79a8303ee1 100644 (file)
@@ -14,7 +14,7 @@
 #include "udev-builtin.h"
 
 static const struct key_name *keyboard_lookup_key(const char *str, GPERF_LEN_TYPE len);
-#include "keyboard-keys-from-name.h"
+#include "keyboard-keys-from-name.inc"
 
 static int install_force_release(sd_device *dev, const unsigned *release, unsigned release_count) {
         sd_device *atkbd;