Skip to content

Problem when merging anonymous enum

ID0001063: This issue was created automatically from Mantis Issue 1063. Further discussion may take place here.


Id Project Category View Due Date Updated
ID0001063 Frama-C Kernel public 2012-01-16 2014-02-12
Reporter Anne Assigned To - Resolution fixed
Priority normal Severity feature Reproducibility always
Platform - OS - OS Version -
Product Version Frama-C Nitrogen-20111001 Target Version - Fixed in Version -

Description :

The anonymous enum are given numbers, but when having several source files, the same number can be used for different enum, so CIL tries to merge them, and of course, it fails.

Additional Information :

//=== toto.h #ifdef TOTO enum { A1, B1, C1 }; #endif enum { A2, B2, C2 }; //=== toto.c #define TOTO #include "toto.h" int f1 (int x) { return x == A1 ? 1 : 0; } //=== toto2.c #include "toto.h" int f2 (int x) { return x == A2 ? 1 : 0; } //===

$ frama-c toto.c toto2.c [kernel] preprocessing with "gcc -C -E -I. toto.c" [kernel] preprocessing with "gcc -C -E -I. toto2.c" toto.c:4:[kernel] warning: cannot merge definitions of enum __anonenum_1 (different names for enumeration items); items {A1=0, B1=1, C1=2} and {A2=0, B2=1, C2=2}

Attachments

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information