diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-11-29 03:18:03 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 03:18:03 +0900 |
commit | 50ae773f85216875033ae47362bb906cf5f5b2d8 (patch) | |
tree | a3a6ccd3bc8df5411d55d3963e204507ec4d6a3d /tools | |
parent | fab57f7f1398d746a0d64fd1c9c04ef2ca1eb544 (diff) | |
parent | acf4d158931e4529e0e76748b6a1c9f11c61c3ff (diff) | |
download | systemd-50ae773f85216875033ae47362bb906cf5f5b2d8.tar.gz |
Merge pull request #10970 from yuwata/from-name-return-negative-errno
util: make *_from_name() returns negative errno on error
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/generate-gperfs.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/generate-gperfs.py b/tools/generate-gperfs.py new file mode 100755 index 0000000000..aca9ab1fe9 --- /dev/null +++ b/tools/generate-gperfs.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +"""Generate %-from-name.gperf from %-list.txt +""" + +import sys + +name, prefix, input = sys.argv[1:] + +print("""\ +%{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"") +#endif +%}""") +print("""\ +struct {}_name {{ const char* name; int id; }}; +%null-strings +%%""".format(name)) + +for line in open(input): + print("{0}, {1}{0}".format(line.rstrip(), prefix)) |