 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
dlanor
Joined: 28 Oct 2004 Posts: 269 Location: Stockholm, Sweden
|
Posted: Sun Jun 12, 2005 10:43 am Post subject: problem with string.h ??? |
|
|
Yesterday I compiled the latest ps2sdk, and discovered that with this some stuff now fails to compile that did so error-free before. One example is LaunchELF, which gave the following result at 'make all' from a clean state:
| Code: | ee-gcc -D_EE -O2 -G0 -Wall -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/p
s2dev/ps2sdk/common/include -I. -I/usr/local/ps2dev/libito/include -I/usr/local/
ps2dev/sbv-1.0-lite/include -I/usr/local/ps2dev/libcdvd/ee -c main.c -o main.o
In file included from launchelf.h:11,
from main.c:1:
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: parse error before '\x0'
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: conflicting types for `memset2'
/usr/local/ps2dev/libito/include/itomisc.h:25: previous declaration of `memset2'
/usr/local/ps2dev/ps2sdk/ee/include/string.h: In function `memset2':
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: `p' undeclared (first use in th
is function)
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: (Each undeclared identifier is
reported only once
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: for each function it appears in
.)
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: `n' undeclared (first use in th
is function)
make: *** [main.o] Error 1 |
Of that mess only 3 lines are significant, so I'll repeat these here for clarity:
| Code: | /usr/local/ps2dev/ps2sdk/ee/include/string.h:88: parse error before '\x0'
/usr/local/ps2dev/ps2sdk/ee/include/string.h:88: conflicting types for `memset2'
/usr/local/ps2dev/libito/include/itomisc.h:25: previous declaration of `memset2'
|
Now, it is true that a 'memset2' function is declared at line 25 in itomisc.h, but that should not cause any conflict, since it is NOT true that either 'memset2' or the '\x0' sequence mentioned even exist in line 88 of string.h, which contains nothing of that kind. Instead, and unlike older versions of this file that I've seen, the current string.h has the following at line 88.
| Code: | static __inline__ void bzero(void * p, size_t n) { memset(p, 0, n); }
|
This should not cause any conflict with itomisc.h, as the name used is 'memset', not 'memset2' like the error message claims, and even that is a reference, not a declaration. So it seems to me as if the __inline__ implementation is somehow bugged, or possibly being bugged by some bad macro. I haven't found the real cause myself, but it could have something to do with other headers that were read before string.h, so here is a list of those, in referenced order:
ito.h (#includes all ito headers except itoglobal.h), stdio.h, tamtypes.h, sifcmd.h, kernel.h, sifrpc.h, loadfile.h, followed by string.h which gave the error.
As you can see, apart from the ito stuff (of libito 0.2.1), only ps2sdk files are involved, so the problem doesn't seem specific to the LaunchELF project. It could strike anyone using the same headers...
I hope someone else can solve this, because I can't get any grip on this myself.
NB: though I discovered this yesterday, the problem may have existed much longer, as I've been using ps2sdk 1.2 until yesterday.
Best regards: dlanor |
|
| Back to top |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Sun Jun 12, 2005 7:16 pm Post subject: |
|
|
You most probably have a #define bcopy memset2 somewhere in libito. Bad, bad, baaaaad. _________________ pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department. |
|
| Back to top |
|
 |
dlanor
Joined: 28 Oct 2004 Posts: 269 Location: Stockholm, Sweden
|
Posted: Mon Jun 13, 2005 12:27 am Post subject: |
|
|
| pixel wrote: | You most probably have a #define bcopy memset2 somewhere in libito. Bad, bad, baaaaad.
| Thanks, but I assume you meant 'bzero' rather than 'bcopy', and there is such a macro in itomisc.h, which seems to be the culprit. I guess I was too tired to see it earlier...
| Code: | #ifndef bzero
#define bzero( _str, _n ) memset2( _str, '\0', _n )
#endif |
This would alter the definition of bzero in string.h into a definition of another memset2 function, and since it used other parameter names most of the error messages are explained, except one. I still don't understand where the "parse error before '\x0'" came from, as the '\x0' part simply doesn't exist, neither in string.h nor in itomisc.h...!?!
However, that hardly matters since the problem goes away when I edit launchelf.h so that ito.h is not #included until after string.h .
Best regards: dlanor |
|
| Back to top |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Mon Jun 13, 2005 12:42 am Post subject: |
|
|
Yeah, bzero, not bcopy. And the "\0" gets translated into "\x0" which is fundamentally the same thing. Now replace "bzero(x, y)" in string.h by "memset2(x, '\x0', y)", and you have the full error message explained. _________________ pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|