mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 22:58:21 +00:00
qapi: Turn generators' mandatory option -i into an argument
Mandatory option is silly, and the error handling is missing: the programs crash when -i isn't supplied. Make it an argument, and check it properly. Backports commit 16d80f61814745bd3f5bb9f47ae3b00edf9e1e45 from qemu
This commit is contained in:
parent
dd67bbeb3b
commit
d77e0dd040
2 changed files with 7 additions and 9 deletions
|
@ -148,12 +148,12 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json
|
||||||
qapi-types.c qapi-types.h :\
|
qapi-types.c qapi-types.h :\
|
||||||
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
|
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
|
||||||
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
|
||||||
$(gen-out-type) -o "." -b -i $<, \
|
$(gen-out-type) -o "." -b $<, \
|
||||||
" GEN $@")
|
" GEN $@")
|
||||||
qapi-visit.c qapi-visit.h :\
|
qapi-visit.c qapi-visit.h :\
|
||||||
$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
|
$(qapi-modules) $(SRC_PATH)/scripts/qapi-visit.py $(qapi-py)
|
||||||
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py \
|
||||||
$(gen-out-type) -o "." -b -i $<, \
|
$(gen-out-type) -o "." -b $<, \
|
||||||
" GEN $@")
|
" GEN $@")
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -983,10 +983,9 @@ def parse_command_line(extra_options = "", extra_long_options = []):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.gnu_getopt(sys.argv[1:],
|
opts, args = getopt.gnu_getopt(sys.argv[1:],
|
||||||
"chp:i:o:" + extra_options,
|
"chp:o:" + extra_options,
|
||||||
["source", "header", "prefix=",
|
["source", "header", "prefix=",
|
||||||
"input-file=", "output-dir="]
|
"output-dir="] + extra_long_options)
|
||||||
+ extra_long_options)
|
|
||||||
except getopt.GetoptError, err:
|
except getopt.GetoptError, err:
|
||||||
print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
|
print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -1001,8 +1000,6 @@ def parse_command_line(extra_options = "", extra_long_options = []):
|
||||||
o, a = oa
|
o, a = oa
|
||||||
if o in ("-p", "--prefix"):
|
if o in ("-p", "--prefix"):
|
||||||
prefix = a
|
prefix = a
|
||||||
elif o in ("-i", "--input-file"):
|
|
||||||
input_file = a
|
|
||||||
elif o in ("-o", "--output-dir"):
|
elif o in ("-o", "--output-dir"):
|
||||||
output_dir = a + "/"
|
output_dir = a + "/"
|
||||||
elif o in ("-c", "--source"):
|
elif o in ("-c", "--source"):
|
||||||
|
@ -1016,8 +1013,9 @@ def parse_command_line(extra_options = "", extra_long_options = []):
|
||||||
do_c = True
|
do_c = True
|
||||||
do_h = True
|
do_h = True
|
||||||
|
|
||||||
if len(args) != 0:
|
if len(args) != 1:
|
||||||
print >>sys.stderr, "%s: too many arguments" % sys.argv[0]
|
print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0]
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
input_file = args[0]
|
||||||
|
|
||||||
return (input_file, output_dir, do_c, do_h, prefix, extra_opts)
|
return (input_file, output_dir, do_c, do_h, prefix, extra_opts)
|
||||||
|
|
Loading…
Reference in a new issue