Header limit.h is nonsense
ID0000548: This issue was created automatically from Mantis Issue 548. Further discussion may take place here.
Id | Project | Category | View | Due Date | Updated |
---|---|---|---|---|---|
ID0000548 | Frama-C | Kernel | public | 2010-07-25 | 2014-02-12 |
Reporter | pascal | Assigned To | pascal | Resolution | fixed |
Priority | normal | Severity | minor | Reproducibility | always |
Platform | - | OS | - | OS Version | - |
Product Version | Frama-C Boron-20100401 | Target Version | - | Fixed in Version | Frama-C Carbon-20101201-beta1 |
Description :
Header limit.h contains macros that cannot be used for anything:
$ cat t.c #include <limits.h>
main(){ unsigned int x = UINT_MAX; return 0; } $ gcc -C -E -I/Users/pascal/ppc/share/libc/ -o t.i t.c $ cat t.i ..
2 "t.c" 2
main(){ unsigned int x = (((1 << (4*8))-1))U; return 0; }
The above is not syntactically an expression:
$ gcc -c t.i t.c: In function ‘main’: t.c:4: warning: left shift count >= width of type t.c:4: error: expected ‘,’ or ‘;’ before ‘U’
$ ~/ppc/bin/toplevel.opt t.i t.c:4:[kernel] user error: syntax error [kernel] user error: skipping file "t.i" that has errors. [kernel] Frama-C aborted because of invalid user input.
Gcc's other warning regarding width of type is also a valid point.
A low-tech solution would be to define these values as constants within #ifdef MACHDEP_X86, … and to let the user use "gcc -C -E -DMACHDEP_X86" for preprocessing.