[omniORB] BUG: macro expansion problem

Alex Hornby alex@anvil.co.uk
Fri, 7 May 1999 15:34:55 +0100 (BST)


Gary,

Thanks, that is the problem... What we need is an autoconf build that
generates a $CPP. Until then I'll edit the platform config :)

Cheers,
Alex.

Gary D. Duzan writes:
 > 
 >    From looking at the platform file for Sun it see by default to use
 > /usr/ccs/lib/cpp as the preprocessor. Try running your IDL through that
 > and see if it doesn't come up with the same thing as "omniidl2 -E". If
 > so, try changing the definition of CPP in your platform file to "CC" or
 > "CC -E" and rebuilding omniidl2.
 > 
 > 					Gary Duzan
 > 					GTE Laboratories
 > 
 > 
 > 
 > In Message <14130.60337.115007.311012@prodigy.anvil.co.uk> ,
 >    Alex Hornby <alex@anvil.co.uk> wrote:
 > 
 > =>Colin Caughie writes:
 > => > > -----Original Message-----
 > => > > From: Alex Hornby [mailto:alex@anvil.co.uk]
 > => > > Sent: Friday, 7 May 1999 12:47
 > => > > To: omniorb-list@uk.research.att.com
 > => > > Subject: [omniORB] BUG: macro expansion problem
 > => > > 
 > => > > 
 > => > > Dear all,
 > => > > 
 > => > > Macro expansion is not being done properly, as the ## is left in.
 > => > > I know macros are nasty, but one of our developers is very 
 > => > > attached to 
 > => > > them.
 > => > > 
 > => > > ...
 > => > >
 > => > > #define EV_TAG(tag) \
 > => > > 	struct evtag_ ## tag { \
 > => > > 		tag value; \
 > => > > 		string errortext; \
 > => > > 	}
 > => > 
 > => > 
 > => > Have you tried removing the spaces on either side of the ##?
 > => > 
 > => > Just a thought,
 > => > 
 > => > Colin Caughie (A macro fan!)
 > =>
 > =>Yes, it makes little difference:
 > =>
 > =>Cheers,
 > =>Alex.
 > =>
 > =>-- Modified IDL
 > =>#pragma prefix "anvil.co.uk"
 > =>
 > =>#define EV_TAG(tag) \
 > =>	struct evtag_##tag { \
 > =>		tag value; \
 > =>		string errortext; \
 > =>	}
 > =>
 > =>module example {
 > =>    EV_TAG(short);
 > =>    EV_TAG(string);
 > =>    EV_TAG(long);
 > =>    EV_TAG(float);
 > =>    EV_TAG(double);
 > =>    EV_TAG(Date);
 > =>    EV_TAG(DateTime);
 > =>    EV_TAG(Currency);
 > =>    EV_TAG(Instrument);
 > =>    EV_TAG(Agency);
 > =>    EV_TAG(Counterparty);
 > =>    EV_TAG(Book);
 > =>};
 > =>
 > =>-- omniidl2 output
 > =># 1 "/tmp/idli_0gcSQZ.cc" 
 > =>#pragma prefix "anvil.co.uk"
 > =>
 > =>
 > =>
 > =>
 > =>
 > =>
 > =>
 > =>module example {
 > =>    struct evtag_##short { short value; string errortext; };
 > =>    struct evtag_##string { string value; string errortext; };
 > =>    struct evtag_##long { long value; string errortext; };
 > =>    struct evtag_##float { float value; string errortext; };
 > =>    struct evtag_##double { double value; string errortext; };
 > =>    struct evtag_##Date { Date value; string errortext; };
 > =>    struct evtag_##DateTime { DateTime value; string errortext; };
 > =>    struct evtag_##Currency { Currency value; string errortext; };
 > =>    struct evtag_##Instrument { Instrument value; string errortext; };
 > =>    struct evtag_##Agency { Agency value; string errortext; };
 > =>    struct evtag_##Counterparty { Counterparty value; string errortext; };
 > =>    struct evtag_##Book { Book value; string errortext; };
 > =>};
 > =>
 > =>-- output of cc -E
 > =>#pragma	prefix "anvil.co.uk"
 > =># 2 "macro_probem.idl"
 > =>
 > =># 8
 > =>
 > =>module example {
 > =>     struct evtag_short { short value ; string errortext ; };
 > =>     struct evtag_string { string value ; string errortext ; };
 > =>     struct evtag_long { long value ; string errortext ; };
 > =>     struct evtag_float { float value ; string errortext ; };
 > =>     struct evtag_double { double value ; string errortext ; };
 > =>     struct evtag_Date { Date value ; string errortext ; };
 > =>     struct evtag_DateTime { DateTime value ; string errortext ; };
 > =>     struct evtag_Currency { Currency value ; string errortext ; };
 > =>     struct evtag_Instrument { Instrument value ; string errortext ; };
 > =>     struct evtag_Agency { Agency value ; string errortext ; };
 > =>     struct evtag_Counterparty { Counterparty value ; string errortext ; };
 > =>     struct evtag_Book { Book value ; string errortext ; };
 > =>};
 > =>#ident "acomp: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
 > =>