Intuition and INLINE kludges

7 posts / 0 new
Last post
kas1e
kas1e's picture
Offline
Last seen: 2 days 19 hours ago
Joined: 2010-11-30 15:30
Intuition and INLINE kludges
In one heavy project i working on, there is such kind of code present:
  1. enum EDisplay {
  2. INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT,
  3. NONE
  4. };
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:
  1. // any of includes give same errors
  2. #include <proto/intuition.h>
  3. //#include <intuition/classusr.h>
  4.  
  5. enum EDisplay {
  6. INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT,
  7. NONE
  8. };
  9.  
  10.  
  11. main()
  12. {
  13.  
  14. }
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).
salass00
salass00's picture
Offline
Last seen: 9 months 2 weeks ago
Joined: 2011-02-03 11:27
Add -DINLINE=INLINE to the
Add -DINLINE=INLINE to the compiler options. This will disable the INLINE define in <amiga_compiler.h>.
kas1e
kas1e's picture
Offline
Last seen: 2 days 19 hours ago
Joined: 2010-11-30 15:30
Re: Intuition and INLINE kludges

@Frederik
Today meet with another one:

ValueMappings.h:311:16: error: expected primary-expression before ‘:’ token
case DOUBLE:
^
ValueMappings.h:283:12: warning: enumeration value ‘DOUBLE’ not handled in switch [-Wswitch]
switch (e) {
^

and code looks like this:

  1. template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
  2. : CSSValue(PrimitiveClass)
  3. {
  4. m_primitiveUnitType = CSS_VALUE_ID;
  5. switch (e) {
  6. case BNONE:
  7. m_value.valueID = CSSValueNone;
  8. break;
  9. case BHIDDEN:
  10. m_value.valueID = CSSValueHidden;
  11. break;
  12. case INSET:
  13. m_value.valueID = CSSValueInset;
  14. break;
  15. case GROOVE:
  16. m_value.valueID = CSSValueGroove;
  17. break;
  18. case RIDGE:
  19. m_value.valueID = CSSValueRidge;
  20. break;
  21. case OUTSET:
  22. m_value.valueID = CSSValueOutset;
  23. break;
  24. case DOTTED:
  25. m_value.valueID = CSSValueDotted;
  26. break;
  27. case DASHED:
  28. m_value.valueID = CSSValueDashed;
  29. break;
  30. case SOLID:
  31. m_value.valueID = CSSValueSolid;
  32. break;
  33. case DOUBLE:
  34. m_value.valueID = CSSValueDouble;
  35. break;
  36. }
  37. }

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 ?

OldFart
OldFart's picture
Offline
Last seen: 4 days 19 hours ago
Joined: 2010-11-30 14:09
Re: Intuition and INLINE kludges

@Kas1e:

  1. enum EDisplay {
  2. INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT,
  3. NONE
  4. };

You could also modify this enumeration, like:

  1. enum EDisplay {
  2. ED_INLINE,ED_BLOCK, ED_LIST_ITEM, ED_RUN_IN, ED_COMPACT,
  3. ED_NONE
  4. };

,

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

kas1e
kas1e's picture
Offline
Last seen: 2 days 19 hours ago
Joined: 2010-11-30 15:30
Re: Intuition and INLINE kludges

@oldFart
Modify is of no go, because that is how I already deal with it. I want "clean" solution without touching bunch of code :)

jabirulo
jabirulo's picture
Offline
Last seen: 1 day 14 hours ago
Joined: 2013-05-30 00:53
Re: Intuition and INLINE kludges

Dunnot if it will work, but what about:

#ifdef DOUBLE
#undef DOUBLE
#endif

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
kas1e
kas1e's picture
Offline
Last seen: 2 days 19 hours ago
Joined: 2010-11-30 15:30
Re: Intuition and INLINE kludges

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.

Log in or register to post comments