After a nightmarish evening with CWPro2, I've finally discovered two major
bugs in the compiler that are forcing me to revert back to CWPro1.
1. Now that the Universal Headers all support #pragma once, it has revealed
a major problem with CW's implementation of it, namely, that paths are not
resolved before deciding whether or not a file has been included already.
Thus, in the MacHeaders, we have
and in my code, I have
Each of these refers to a different file, yet because CWPro doesn't resolve
where these files live before discarding them, nothing I tried would allow
me to include the second file. I was able to work around it by adding this
to my precompiled header:
#define PRAGMA_ONCE 0
But IMHO, I shouldn't need to do this. <Types.h> and "Types.h" are *not*
the same, and #pragma once should know it!!
2. The "Store static data in TOC" option is not working at all anymore.
Whether I use the preferences panel or the #pragma, I get the annoying
PowerPC indirection which bloats my code and makes it run significantly
slower. In addition, I have a lot of PowerPC assembly routines that *rely*
on this option, which is preventing me from using CWPro2 at all for
development. As far as I can see, there is no workaround. Here is some
#pragma toc_data on
static int a;
static int b;
c = a + b;
And here is the resulting optimized assembly code:
00000000: 80820000 lwz r4,a(RTOC)
00000004: 80620000 lwz r3,b$974(RTOC)
00000008: 80840000 lwz r4,0(r4)
0000000C: 80030000 lwz r0,0(r3)
00000010: 7C640214 add r3,r4,r0
00000014: 4E800020 blr
I don't know what broke this, but I sincerely hope Metrowerks issues a fix
for this one ASAP!