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)



Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes:

> 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.

It seems the problem is that ccache and clang interact badly, where the
warnings that should be disabled during preprocessing are active,
because of how ccache behaves.  Arguably this is ccache's fault:

http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
http://peter.eisentraut.org/blog/2014/12/01/ccache-and-clang-part-3/

With the following (not proposed to commit):

  --- clang.mk.~1.15.~	2015-03-08 20:24:21.000000000 -0400
  +++ clang.mk	2015-09-27 19:54:41.000000000 -0400
  @@ -67,10 +67,10 @@ PKGSRC_FORTRAN?=g95
   .  include "../../mk/compiler/${PKGSRC_FORTRAN}.mk"
   .endif

  -_WRAP_EXTRA_ARGS.CC+=	-Qunused-arguments
  -CWRAPPERS_APPEND.cc+=	-Qunused-arguments
  -_WRAP_EXTRA_ARGS.CXX+=	-Qunused-arguments
  -CWRAPPERS_APPEND.cxx+=	-Qunused-arguments
  +_WRAP_EXTRA_ARGS.CC+=	-Qunused-arguments -Wno-error=parentheses-equality
  +CWRAPPERS_APPEND.cc+=	-Qunused-arguments -Wno-error=parentheses-equality
  +_WRAP_EXTRA_ARGS.CXX+=	-Qunused-arguments -Wno-error=parentheses-equality
  +CWRAPPERS_APPEND.cxx+=	-Qunused-arguments -Wno-error=parentheses-equality

   CLANG_NO_VALUE_PROPAGATION_PASS=	-O0
 
pkgin builds even with ccache.  With

  CCACHE_CPP2=yes

and stock clank.mk, pkgin also builds fine.

So I am thinking that we should either export CACHE_CPP2 or patch ccache
to default to doing that, because ccache seems broken without it.   This
is apparently only an issue with clang, but only because gcc doesn't
have warnings only for non-preprocessed code.

I'll start another thread about that.


Attachment: pgpBOUdtsJpvg.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index