diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2018-03-07 16:51:59 +0100 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2018-03-07 16:51:59 +0100 |
commit | 8c3bf1f12474f8f3e81f1df8c14057c7cda88b6d (patch) | |
tree | 62ed83bf951c0911b47e57e72bf22401de13de0f /cparser | |
parent | 3f090e08594830885db88289c294e58cd506dff4 (diff) | |
download | compcert-kvx-8c3bf1f12474f8f3e81f1df8c14057c7cda88b6d.tar.gz compcert-kvx-8c3bf1f12474f8f3e81f1df8c14057c7cda88b6d.zip |
Improve error messages.
Include the format specifier in error message when available in
order to make it easier to spot the broken ais parameter.
Futhermore introduce a new warning for unused ais parameters.
Bug 22464
Diffstat (limited to 'cparser')
-rw-r--r-- | cparser/Diagnostics.ml | 5 | ||||
-rw-r--r-- | cparser/Diagnostics.mli | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml index e3258a38..f18d1b2d 100644 --- a/cparser/Diagnostics.ml +++ b/cparser/Diagnostics.ml @@ -91,6 +91,7 @@ type warning_type = | Unused_variable | Unused_parameter | Wrong_ais_parameter + | Unused_ais_parameter (* List of active warnings *) let active_warnings: warning_type list ref = ref [ @@ -112,6 +113,7 @@ let active_warnings: warning_type list ref = ref [ Literal_range; Inline_asm_sdump; Wrong_ais_parameter; + Unused_ais_parameter; ] (* List of errors treated as warning *) @@ -142,6 +144,7 @@ let string_of_warning = function | Unused_variable -> "unused-variable" | Unused_parameter -> "unused-parameter" | Wrong_ais_parameter -> "wrong-ais-parameter" + | Unused_ais_parameter -> "unused-ais-parameter" (* Activate the given warning *) let activate_warning w () = @@ -219,6 +222,7 @@ let werror () = Inline_asm_sdump; Unused_variable; Wrong_ais_parameter; + Unused_ais_parameter; ] (* Generate the warning key for the message *) @@ -396,6 +400,7 @@ let warning_options = error_option Unused_variable @ error_option Unused_parameter @ error_option Wrong_ais_parameter @ + error_option Unused_ais_parameter @ [Exact ("-Wfatal-errors"), Set error_fatal; Exact ("-fdiagnostics-color"), Ignore; (* Either output supports it or no color *) Exact ("-fno-diagnostics-color"), Unset color_diagnostics; diff --git a/cparser/Diagnostics.mli b/cparser/Diagnostics.mli index 648d537b..75865cb2 100644 --- a/cparser/Diagnostics.mli +++ b/cparser/Diagnostics.mli @@ -48,6 +48,7 @@ type warning_type = | Unused_variable (** unused local variables *) | Unused_parameter (** unused function parameter *) | Wrong_ais_parameter (** wrong parameter type for ais replacement *) + | Unused_ais_parameter (** unused builtin ais parameter *) val warning : (string * int) -> warning_type -> ('a, Format.formatter, unit, unit, unit, unit) format6 -> 'a (** [warning (f,c) w fmt arg1 ... argN] formats the arguments [arg1] to [argN] as warining according to |