Re: Info.plist preprocessor macro expansion, space between tokens
Re: Info.plist preprocessor macro expansion, space between tokens
- Subject: Re: Info.plist preprocessor macro expansion, space between tokens
- From: Greg Guerin <email@hidden>
- Date: Mon, 1 May 2006 15:24:35 -0700
Alex Sheh wrote:
>Thanks, Greg. I did try some token concatenation experimentation. If I
>use ## in the Info.plist itself, it ignores the concatenation and
>instead outputs the '##'s themselves.
>
><string>MAJOR##.##MINOR##.##MICRO</string> results in 1##.##2##.##.3
When I run 'cpp' directly at the command-line, I get similar results. I
checked a reference man and it turns out both elements have to be legal
tokens, and "." isn't one.
However, the following simple macro replacement works with cpp, and doesn't
inject any unwanted white-space:
#define MAJOR 1
#define MINOR 2
echo MAJOR.MINOR
which expands to:
echo 1.2
along with some lines that start with "#". Maybe you should check that
your #define's don't have extra white-space in them.
Also, it seems cpp doesn't stringize tokens like it should (#token ends up
being output as literal #token, rather than being double-quoted). The
example macro-defn of COMMAND(NAME) given at the following URL simply does
not work as documented.
<http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/cpp/Concatena
tion.html>
Nor does this example from another source:
#define TEMP(i) temp ## i
TEMP(1) = TEMP(2)
which is expanded to:
temp ## 1 = temp ## 2
It almost looks like cpp is relying on a subsequent C compiler pass to
finish doing its token pasting.
I suspect cpp may be slightly broken, or there is some subtle context I'm
missing. You might want to look at the detailed build info to find out
exactly what command and args are being used to perform the preprocessing
pass on the plist.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden