Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
On Mon, Jun 21, 2004 at 09:06:04PM +0200, Bernd Schubert wrote:
> 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)
try this:
#define PERROR(fmt, args...) \
do { fprintf(stderr,fmt ": " , ##args); perror(0); } while (0)
( note the additional blank ^ here...
lge