Skip to content
Snippets Groups Projects
Commit 095c403b authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[kernel] Clearer error messages related to FAMs

parent c5b28669
No related branches found
No related tags found
No related merge requests found
...@@ -5441,11 +5441,15 @@ and makeCompType ghost (isstruct: bool) ...@@ -5441,11 +5441,15 @@ and makeCompType ghost (isstruct: bool)
Kernel.error ~source Kernel.error ~source
"field `%s' declared as a function" n "field `%s' declared as a function" n
else if Cil.has_flexible_array_member ftype && isstruct then begin else if Cil.has_flexible_array_member ftype && isstruct then begin
if not (last_group && last_field && (Cil.gccMode() || Cil.msvcMode ())) if not (last_group && last_field) then
then Kernel.error ~source
"non-final field `%s' declared with a type containing a flexible \
array member."
n
else if not (Cil.gccMode() || Cil.msvcMode ()) then
Kernel.error ~source Kernel.error ~source
"field `%s' declared with a type containing a flexible array \ "field `%s' declared with a type containing a flexible array \
member." member only allowed in GCC/MSVC mode."
n n
end end
else if not (Cil.isCompleteType ~allowZeroSizeArrays ftype) else if not (Cil.isCompleteType ~allowZeroSizeArrays ftype)
......
[kernel] Parsing tests/syntax/flexible_array_member_invalid5.i (no preprocessing) [kernel] Parsing tests/syntax/flexible_array_member_invalid5.i (no preprocessing)
[kernel] tests/syntax/flexible_array_member_invalid5.i:15: User Error: [kernel] tests/syntax/flexible_array_member_invalid5.i:15: User Error:
field `f' declared with a type containing a flexible array member. field `f' declared with a type containing a flexible array member only allowed in GCC/MSVC mode.
[kernel] User Error: stopping on file "tests/syntax/flexible_array_member_invalid5.i" that has [kernel] User Error: stopping on file "tests/syntax/flexible_array_member_invalid5.i" that has
errors. errors.
[kernel] Frama-C aborted: invalid user input. [kernel] Frama-C aborted: invalid user input.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
[kernel] tests/value/empty_base.c:67: Warning: [kernel] tests/value/empty_base.c:67: Warning:
Too many initializers for structure Too many initializers for structure
[kernel] tests/value/empty_base.c:81: User Error: [kernel] tests/value/empty_base.c:81: User Error:
field `f1' declared with a type containing a flexible array member. non-final field `f1' declared with a type containing a flexible array member.
[kernel] User Error: stopping on file "tests/value/empty_base.c" that has errors. Add [kernel] User Error: stopping on file "tests/value/empty_base.c" that has errors. Add
'-kernel-msg-key pp' for preprocessing command. '-kernel-msg-key pp' for preprocessing command.
[kernel] Frama-C aborted: invalid user input. [kernel] Frama-C aborted: invalid user input.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment