meson: Use .inc for generated code meant to be included in other files

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.
This commit is contained in:
Daan De Meyer
2025-05-22 11:25:29 +02:00
parent c60a8c72d1
commit 5ea01af240
18 changed files with 58 additions and 57 deletions
+2 -2
View 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) {
+2 -2
View 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;
+2 -2
View 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)
+2 -2
View File
@@ -10,10 +10,10 @@
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) {
+2 -2
View 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"
},
};
+11 -11
View 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',