Commit 63abcdc0 authored by Vitja Makarov's avatar Vitja Makarov

Add command line flag --warning-errors and gcc compat alias -Werror

parent e8cc17ab
...@@ -38,6 +38,7 @@ Options: ...@@ -38,6 +38,7 @@ Options:
-2 Compile based on Python-2 syntax and code semantics. -2 Compile based on Python-2 syntax and code semantics.
-3 Compile based on Python-3 syntax and code semantics. -3 Compile based on Python-3 syntax and code semantics.
--fast-fail Abort the compilation on the first error --fast-fail Abort the compilation on the first error
--warning-error, -Werror Make all warnings into errors
-X, --directive <name>=<value>[,<name=value,...] Overrides a compiler directive -X, --directive <name>=<value>[,<name=value,...] Overrides a compiler directive
""" """
...@@ -131,6 +132,8 @@ def parse_command_line(args): ...@@ -131,6 +132,8 @@ def parse_command_line(args):
options.language_level = 3 options.language_level = 3
elif option == "--fast-fail": elif option == "--fast-fail":
Options.fast_fail = True Options.fast_fail = True
elif option in ('-Werror', '--warning-errors'):
Options.warning_errors = True
elif option == "--disable-function-redefinition": elif option == "--disable-function-redefinition":
Options.disable_function_redefinition = True Options.disable_function_redefinition = True
elif option in ("-X", "--directive"): elif option in ("-X", "--directive"):
......
...@@ -176,6 +176,8 @@ def message(position, message, level=1): ...@@ -176,6 +176,8 @@ def message(position, message, level=1):
def warning(position, message, level=0): def warning(position, message, level=0):
if level < LEVEL: if level < LEVEL:
return return
if Options.warning_errors:
return error(position, message)
warn = CompileWarning(position, message) warn = CompileWarning(position, message)
line = "warning: %s\n" % warn line = "warning: %s\n" % warn
if listing_file: if listing_file:
......
...@@ -22,6 +22,9 @@ annotate = False ...@@ -22,6 +22,9 @@ annotate = False
# to keep going and printing further error messages. # to keep going and printing further error messages.
fast_fail = False fast_fail = False
# Make all warnings into errors.
warning_errors = False
# This will convert statements of the form "for i in range(...)" # This will convert statements of the form "for i in range(...)"
# to "for i from ..." when i is a cdef'd integer type, and the direction # to "for i from ..." when i is a cdef'd integer type, and the direction
# (i.e. sign of step) can be determined. # (i.e. sign of step) can be determined.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment