]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/generate-gperfs.py
util: introduce memcmp_safe()
[thirdparty/systemd.git] / src / basic / generate-gperfs.py
CommitLineData
3e67e5c9 1#!/usr/bin/env python3
5c23128d
ZJS
2
3"""Generate %-from-name.gperf from %-list.txt
4"""
5
6import sys
7
8name, prefix, input = sys.argv[1:]
9
4831981d
SL
10print("""\
11%{
12#if __GNUC__ >= 7
13_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
14#endif
15%}""")
5c23128d
ZJS
16print("""\
17struct {}_name {{ const char* name; int id; }};
18%null-strings
19%%""".format(name))
20
21for line in open(input):
22 print("{0}, {1}{0}".format(line.rstrip(), prefix))