aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Diagnostics.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2018-08-20 10:42:22 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2018-08-20 10:42:21 +0200
commite9b5632617b1477603883aab543994e2a1c464ce (patch)
treed2f67322c1ff09ed2a6c6c3aa64e8b40421ade33 /cparser/Diagnostics.ml
parent6fc89e5c8c4a8f98ef0a4a03c00994bbfb146431 (diff)
downloadcompcert-kvx-e9b5632617b1477603883aab543994e2a1c464ce.tar.gz
compcert-kvx-e9b5632617b1477603883aab543994e2a1c464ce.zip
Additional checks for flex arrays in structs (#93)
* Error for structs with only flex array member Flexible array members are only allowed if another member exists. Bug 23324 * Added checks for nesting of structs with flex array members Warn if a struct with a flex array member is used as array element or member of another struct. Such usage is dubious. Bug 23324 Don't warn if the struct-with-flex-array is a member of an union.
Diffstat (limited to 'cparser/Diagnostics.ml')
-rw-r--r--cparser/Diagnostics.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml
index d0e35b72..52e5e456 100644
--- a/cparser/Diagnostics.ml
+++ b/cparser/Diagnostics.ml
@@ -95,6 +95,7 @@ type warning_type =
| Ignored_attributes
| Extern_after_definition
| Static_in_inline
+ | Flexible_array_extensions
(* List of active warnings *)
let active_warnings: warning_type list ref = ref [
@@ -153,6 +154,7 @@ let string_of_warning = function
| Ignored_attributes -> "ignored-attributes"
| Extern_after_definition -> "extern-after-definition"
| Static_in_inline -> "static-in-inline"
+ | Flexible_array_extensions -> "flexible-array-extensions"
(* Activate the given warning *)
let activate_warning w () =
@@ -203,6 +205,7 @@ let wall () =
Ignored_attributes;
Extern_after_definition;
Static_in_inline;
+ Flexible_array_extensions;
]
let wnothing () =
@@ -237,6 +240,7 @@ let werror () =
Ignored_attributes;
Extern_after_definition;
Static_in_inline;
+ Flexible_array_extensions;
]
(* Generate the warning key for the message *)
@@ -418,6 +422,7 @@ let warning_options =
error_option Ignored_attributes @
error_option Extern_after_definition @
error_option Static_in_inline @
+ error_option Flexible_array_extensions @
[Exact ("-Wfatal-errors"), Set error_fatal;
Exact ("-fdiagnostics-color"), Ignore; (* Either output supports it or no color *)
Exact ("-fno-diagnostics-color"), Unset color_diagnostics;