On Fri, 13 Apr 2001, Frank Heckenbach wrote:
Russ Whitaker wrote:
On Thu, 12 Apr 2001, Frank Heckenbach wrote:
Russ Whitaker wrote:
gpc-20010409 didn't work because #define won't make changes inside a quoted string.
Nope. The CPP macro is always used outside of the quoted strings (even where it doesn't appear so, e.g. in line 804, but note the opening quote in 803). (What results from preprocessor expansion is a sequence of strings like "%{E:" "cpp0" " -lang-c ..." which the C compiler concatenates to a string constant. In Pascal we'd write '%{E:' + CPP + ' -lang-c ...', but apart from syntax, it's the same.)
The reason it didn't work, as Andris pointed out, was because the #define was before the #includes, rather then after them. I'll fix this in my next change.
Not true.
My first approach was:
Since CPP is in use elsewhere,
Err, where?
CPP_SPEC (6 PLACES) CPP_PREDEFINES USE_CPPLIB
The only place I see it is in some shell scripts which are completely unrelated. (In fact, any use in a file not included by gpc.c would be unrelated.) Though, of course, renaming it to anything else (which doesn't conflict with anything) should work just as well.
renamed cpp to czz in the table. then added:
Do you mean CPP or "cpp" (besides C's case-sentivity, the real question is whether you renamed the CPP macro I introduced, or the cpp as part of the quoted strings)?
I maintain that gpc.c in 20010409 is messed up, so copied over a virgin copy of gpc.c from 20010317 and worked with that. Thus the renaming and the following snipet was a cautious approach that paid off when it did't work.
#ifdef GPC_2_95_3 #define czz cpp0 #else #define czz cpp #endif
Compiled ok, but the test suite bombed out with czz. Obviously, define should have replaced czz with either cpp0 or cpp but did neither.
Well, I don't know exactly what you did. It seems you renamed cpp in the quoted string. This will not work, since (as you said correctly) defines are not replaced in quoted strings.
But where I use the CPP macro is always outside of quoted strings (Really! I just checked it again!),
Of course! gpc.c in 20010409 is wrong!
so if you renamed the macro to czz, there's no way it can creep into the gpc executable (you can check with `strings' or `grep'), so gpc won't try to call czz. Maybe you did something wrong, or your files have become inconsistent with our sources due to your previous attempts to solve the problem.
gpc parses lines in the table to determine what sub-programs to call and what parameters to pass. Since czz did't get replaced and there was no czz in the bin directory ...
I suggest you get a fresh copy from CVS, move the define below the includes (if this change isn't in the CVS yet -- I'm not sure at the moment), then it should work without any renaming...
I think I'll wait for the smoke to clear.
Russ