]> git.ipfire.org Git - thirdparty/systemd.git/blob - tools/generate-gperfs.py
sd-bus: if we receive an invalid dbus message, ignore and proceeed
[thirdparty/systemd.git] / tools / generate-gperfs.py
1 #!/usr/bin/env python3
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 """
5 Generate %-from-name.gperf from %-list.txt
6 """
7
8 import sys
9
10 name, prefix, input = sys.argv[1:]
11
12 print("""\
13 %{
14 #if __GNUC__ >= 7
15 _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
16 #endif
17 %}""")
18 print("""\
19 struct {}_name {{ const char* name; int id; }};
20 %null-strings
21 %%""".format(name))
22
23 for line in open(input):
24 print("{0}, {1}{0}".format(line.rstrip(), prefix))