Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] verification of enum safety


  • Subject: [Frama-c-discuss] verification of enum safety
  • From: dmentre at linux-france.org (David MENTRE)
  • Date: Thu, 13 Feb 2014 11:40:28 +0100
  • In-reply-to: <B517F47C2F6D914AA8121201F9EBEE6701C7BB59DEA9@Mail1.FCMD.local>
  • References: <B517F47C2F6D914AA8121201F9EBEE6701C7660449BC@Mail1.FCMD.local>, <52F9EE09.2060600@cea.fr> <B517F47C2F6D914AA8121201F9EBEE6701C7BB59DEA9@Mail1.FCMD.local>

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.