--- layout: fc_discuss_archives title: Message 27 from Frama-C-discuss on February 2014 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] verification of enum safety



Hello,

Le 12/02/2014 20:31, Dharmalingam Ganesan a ?crit :
> I wonder whether there is way for RTE and WP to automatically annotate and check such invalid usages.

You can check it using a recent version of Clang compiler.

"""
$ clang -Wall enum.c
enum.c:8:11: warning: implicit conversion from enumeration type 'DAYS' to
       different enumeration type 'COLOR' [-Wenum-conversion]
   color = TUE; /* This is invalid - COLOR should be RED or BLUE*/
         ~ ^~~
1 warning generated.

$ clang -v
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
"""

Best regards,
david

PS: As far as I know, there is no such -Wenum-conversion option in gcc.