In one heavy project i working on, there is such kind of code present:
enum EDisplay { INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, NONE };
Lately, those enums used there and there, so , that "INLINE" word better to stay here.
Then, i found just once i just add include of intution (proto/intuition.h, or just intuition/classusr.h), then i have some heavy inline related errors.
So, test code is:
// any of includes give same errors #include <proto/intuition.h> //#include <intuition/classusr.h> enum EDisplay { INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, NONE }; main() { }
And compile pure "g++ test.c" , or "g++ -D__USE_INLINE__ test.c" give me that kind of error on such simple test case:
# g++ -c test.cpp
test.cpp:7: error: expected identifier before 'inline'
test.cpp:7: error: expected '}' before 'inline'
test.cpp:7: error: expected unqualified-id before ',' token
test.cpp:7: error: 'BLOCK' declared as an 'inline' variable
test.cpp:7: error: 'LIST_ITEM' declared as an 'inline' variable
test.cpp:7: error: 'RUN_IN' declared as an 'inline' variable
test.cpp:7: error: 'COMPACT' declared as an 'inline' variable
test.cpp:9: error: expected initializer before '}' token
test.cpp:9: error: expected declaration before '}' token
When make file as pure .c and compile it via gcc (not g++), then still errors, just not so verbose.
Problem is: i need to have INLINE in that enum, and i need to include intuition/classusr.h to be able to use intuition's objects.
The only way i found to avoid errors, its just after including of intuition proto do #undef INLINE , but that of course wrong, as just broken all code related to, and in real project its .h which have such enum, and which includes everywhere, so its kind of hardcore imho.
Any ideas ? I think of course about just do search in all the sources on upper case INLINE, and replace them all on INLINE_A, but dunno, if that only way (and there is hundreds of files with).
Add -DINLINE=INLINE to the compiler options. This will disable the INLINE define in <amiga_compiler.h>.
@Frederik
Today meet with another one:
and code looks like this:
I tried simply do:
-DINLINE=DOUBLE no luc
then
-DDOUBLE=DOUBLE
no luc as well.
Have any hints maybe so to not touch the code?
Maybe -no-Wswitch ?
@Kas1e:
You could also modify this enumeration, like:
,
This means you have to go through ALL relevant file in order to modify all occurrences of any of these enumerated values.
Just an idea...
OldFart
@oldFart
Modify is of no go, because that is how I already deal with it. I want "clean" solution without touching bunch of code :)
Dunnot if it will work, but what about:
#ifdef DOUBLE
#undef DOUBLE
#endif
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
That one probably will be fine too , just was in hope it will be possible somehow to deal from command line on the compiling stage via flags/etc.