tech-pkg archive

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

Re: clang pickiness, bsd.sys.mk -Werror, and macros (blows up with pkgin)



On Sat, Sep 26, 2015 at 08:23:40AM -0400, Greg Troxel wrote:
> 
> in pkgtools/libnbcompat/files/nbcompat/queue.h, there appears:
> 
> #define        SLIST_EMPTY(head)       ((head)->slh_first == NULL)
> 
> which leads to
> 
> clang -O2 -I/usr/pkg/include   -DHAVE_NBCOMPAT_H=1 -I/usr/pkgsrc/pkgtools/pkgin/work/libnbcompat -I/usr/pkg/include -DPKGIN_VERSION=\""0.9.3 for Darwin-13.4.0 x86_64"\" -DHAVE_NBCOMPAT_H=1 -I/usr/pkgsrc/pkgtools/pkgin/work/libnbcompat -I/usr/pkg/include -g -DLOCALBASE=\"/usr/pkg\" 			 -DPKG_SYSCONFDIR=\"/usr/pkg/etc\"		 -DPKG_DBDIR="\"/var/db/pkg\""			 -DDEF_LOG_DIR="\"/var/db/pkg\""		 -DPKGIN_DB=\"/var/db/pkgin\"			 -DPKGTOOLS=\"/usr/pkg/sbin\" -DHAVE_CONFIG_H -D_LARGEFILE_SOURCE -D_LARGE_FILES -DCHECK_MACHINE_ARCH=\"x86_64\" -Iexternal -I. -I/usr/pkg/include -c depends.c
> depends.c:124:33: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
>  if (((&r_plisthead)->slh_first == ((void*)0))) {
>       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
> 
> On one hand, the parentheses-equality warning is reasonable, but with
> parens around a macro expansion to ensure that what looks like a
> function behaves like a function, it isn't reasonable.

The warning is nonrmally explicitly disabled for macro expansions. You
should only ever see it when using -save-temps or explicit
preprocessing. That output above suggests that something like that
happens too, otherwise you would get the original source line reported.

Joerg


Home | Main Index | Thread Index | Old Index