[DRBD-user] 0.7 & gcc-2.9x bug

Bernd Schubert bernd-schubert at web.de
Mon Jun 21 21:06:04 CEST 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Hello,

When I just tried to compile 0.7-pre8 on a debian woody system, it failed:

gcc-2.95 -c -Wall -I../drbd   -c -o drbdsetup.o drbdsetup.c
drbdsetup.c:1255: unterminated string or character constant
drbdsetup.c:193: possible real start of unterminated constant
make: *** [drbdsetup.o] Error 1

However on my sid system it compiled fine, so I decided to investigate 
further. Somehow the PERROR macro is misinterpreted by the preprocessor.

The appropriate line from 'gcc-3.3 -E  -Wall -I../drbd   drbdsetup.c' looks 
like this:

do { fprintf(stderr,"can not resolv the hostname" ": "); perror(0); } while 
(0);

Whereas the gcc-2.95 output has a missing quotation mark ("):

do { fprintf(stderr , "can not resolv the hostname"  ": ); perror(0); } while 
(0)


Since the PERROR macro looks fine, I really believe that its a compiler bug.

Here's an IMHO ugly workaround, but I have no other idea how to workaround it 
else:

bernd at bathl user>diff -u drbdsetup.c drbdsetup.c.new
--- drbdsetup.c 2004-06-18 14:47:37.000000000 +0200
+++ drbdsetup.c.new     2004-06-21 20:44:11.000000000 +0200
@@ -84,7 +84,7 @@
 #endif

 #define PERROR(fmt, args...) \
-do { fprintf(stderr,fmt ": ", ##args); perror(0); } while (0)
+do { fprintf(stderr,fmt ": " "", ##args); perror(0); } while (0)


Maybe one should also give a comment and explain that the additional quotation 
mark is due to a gcc-2.9x compiler bug?
Also, could someone on a non-debian system please proof this? Debian uses 
gcc-2.95.4pre and I really want to be sure that its not only a debian bug ;)


Cheers,
	Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20040621/f7751a1d/attachment.pgp>


More information about the drbd-user mailing list