aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Diagnostics.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2018-06-03 11:48:37 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2018-06-04 16:32:12 +0200
commitada3c2411aab46eb26753c428a0ca56c9adfc428 (patch)
treed0e3e7ec9b79be427e4b03e03d20335a483cac05 /cparser/Diagnostics.ml
parent130990b8c24db1ccc44dc1b85907904433351e8d (diff)
downloadcompcert-kvx-ada3c2411aab46eb26753c428a0ca56c9adfc428.tar.gz
compcert-kvx-ada3c2411aab46eb26753c428a0ca56c9adfc428.zip
Warn for defs and uses of static variables in nonstatic inline functions
Nonstatic inline functions can be expanded in several compilation units. The static variables in question may differ between different expansions. This is a manual merge and adaptation of pull request #P95 by @bschommer.
Diffstat (limited to 'cparser/Diagnostics.ml')
-rw-r--r--cparser/Diagnostics.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml
index 0ab2c1e4..d0e35b72 100644
--- a/cparser/Diagnostics.ml
+++ b/cparser/Diagnostics.ml
@@ -94,6 +94,7 @@ type warning_type =
| Unused_ais_parameter
| Ignored_attributes
| Extern_after_definition
+ | Static_in_inline
(* List of active warnings *)
let active_warnings: warning_type list ref = ref [
@@ -117,6 +118,7 @@ let active_warnings: warning_type list ref = ref [
Unused_ais_parameter;
Ignored_attributes;
Extern_after_definition;
+ Static_in_inline;
]
(* List of errors treated as warning *)
@@ -150,6 +152,7 @@ let string_of_warning = function
| Unused_ais_parameter -> "unused-ais-parameter"
| Ignored_attributes -> "ignored-attributes"
| Extern_after_definition -> "extern-after-definition"
+ | Static_in_inline -> "static-in-inline"
(* Activate the given warning *)
let activate_warning w () =
@@ -199,6 +202,7 @@ let wall () =
Wrong_ais_parameter;
Ignored_attributes;
Extern_after_definition;
+ Static_in_inline;
]
let wnothing () =
@@ -232,6 +236,7 @@ let werror () =
Unused_ais_parameter;
Ignored_attributes;
Extern_after_definition;
+ Static_in_inline;
]
(* Generate the warning key for the message *)
@@ -412,6 +417,7 @@ let warning_options =
error_option Unused_ais_parameter @
error_option Ignored_attributes @
error_option Extern_after_definition @
+ error_option Static_in_inline @
[Exact ("-Wfatal-errors"), Set error_fatal;
Exact ("-fdiagnostics-color"), Ignore; (* Either output supports it or no color *)
Exact ("-fno-diagnostics-color"), Unset color_diagnostics;