diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2018-08-29 16:17:41 +0200 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-08-29 16:17:41 +0200 |
commit | b4b1fa3d47c37829be30367ced9aa89abcd7f5c7 (patch) | |
tree | 578a69f40daa832377783a480a03066fd959f794 /cparser/Diagnostics.ml | |
parent | 4dd461d08fb4a9361d87938fa90c009f3b80b8bf (diff) | |
download | compcert-b4b1fa3d47c37829be30367ced9aa89abcd7f5c7.tar.gz compcert-b4b1fa3d47c37829be30367ced9aa89abcd7f5c7.zip |
New diagnostic for reduced alignment (#117)
The new diagnostic triggers if an `_Alignas` or an `aligned` attribute
or a `packed` attribute requests an alignment smaller than the natural alignment.
Bug 23389
Diffstat (limited to 'cparser/Diagnostics.ml')
-rw-r--r-- | cparser/Diagnostics.ml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml index 0987068e..172affab 100644 --- a/cparser/Diagnostics.ml +++ b/cparser/Diagnostics.ml @@ -97,6 +97,7 @@ type warning_type = | Static_in_inline | Flexible_array_extensions | Tentative_incomplete_static + | Reduced_alignment (* List of active warnings *) let active_warnings: warning_type list ref = ref [ @@ -157,6 +158,7 @@ let string_of_warning = function | Static_in_inline -> "static-in-inline" | Flexible_array_extensions -> "flexible-array-extensions" | Tentative_incomplete_static -> "tentative-incomplete-static" + | Reduced_alignment -> "reduced-alignment" (* Activate the given warning *) let activate_warning w () = @@ -209,6 +211,7 @@ let wall () = Static_in_inline; Flexible_array_extensions; Tentative_incomplete_static; + Reduced_alignment; ] let wnothing () = @@ -245,6 +248,7 @@ let werror () = Static_in_inline; Flexible_array_extensions; Tentative_incomplete_static; + Reduced_alignment; ] (* Generate the warning key for the message *) @@ -428,6 +432,7 @@ let warning_options = error_option Static_in_inline @ error_option Flexible_array_extensions @ error_option Tentative_incomplete_static @ + error_option Reduced_alignment @ [Exact ("-Wfatal-errors"), Set error_fatal; Exact ("-fdiagnostics-color"), Ignore; (* Either output supports it or no color *) Exact ("-fno-diagnostics-color"), Unset color_diagnostics; |