pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wip/squid4 compilation error





On 26/04/2019 08:34, Mayuresh wrote:
This is a snippet from squid4:

#if (SIZEOF_LONG == 8)
         error("%s| %s: ERROR: Inconsistence message length: %ld!=0\n", LogTime(), PROGRAM, buffer + len - p);
#else
         error((char *) "%s| %s: ERROR: Inconsistence message length: %d!=0\n", LogTime(), PROGRAM, buffer + len - p);
#endif

On evbarm the #else leg is applicable and that yields the error:

support.h:129:38: error: format '%d' expects argument of type 'int', but
argument 5 has type 'long int' [-Werror=format=]

I am not sure why one should use %d for long - no matter of size 4 or 8.

I'd agree that's just wrong. The %ld is correct for long int regardless of long size and should work on any ANSI compliant compiler. It should be harmless on NetBSD to ignore the warning as sizeof int is the same on 32bit platforms as sizeof long but it doesn't make the code any less ugly and incorrect. :(

Mike


Home | Main Index | Thread Index | Old Index