NetBSD Problem Report #51128
From www@NetBSD.org Mon May 9 21:23:00 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 572BB7A3D9
for <gnats-bugs@gnats.NetBSD.org>; Mon, 9 May 2016 21:23:00 +0000 (UTC)
Message-Id: <20160509212258.9296E7AA9F@mollari.NetBSD.org>
Date: Mon, 9 May 2016 21:22:58 +0000 (UTC)
From: azarens@uw.edu
Reply-To: azarens@uw.edu
To: gnats-bugs@NetBSD.org
Subject: Extraneous warnings when using ccache prevent some builds
X-Send-Pr-Version: www-1.0
>Number: 51128
>Category: pkg
>Synopsis: Extraneous warnings when using ccache prevent some builds
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 09 21:25:00 +0000 2016
>Originator: Aleksey Arens
>Release: pkgsrc-current 2016-05-09
>Organization:
University of Washington
>Environment:
NetBSD shell02.opennet.corp 7.99.29 NetBSD 7.99.29 (GENERIC.201605031000Z) amd64
>Description:
When building pkgtools/pkgin, the build was dying with errors like
depends.c:124:33: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
if (((&r_plisthead)->slh_first == ((void *)0))) {
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
depends.c:124:33: note: remove extraneous parentheses around the comparison to silence this warning
if (((&r_plisthead)->slh_first == ((void *)0))) {
~ ^ ~
depends.c:124:33: note: use '=' to turn this equality comparison into an assignment
if (((&r_plisthead)->slh_first == ((void *)0))) {
It turns out that the a two-step processing of a macro definition SLIST_EMPTY from the following fragment inside the depends.c file was causing an issue
if (SLIST_EMPTY(&r_plisthead)) {
printf("%s\n", MSG_EMPTY_AVAIL_PKGLIST);
return EXIT_FAILURE;
}
The macro got expanded into a doubly-parenthesized version by the pre-processor in one stage, and the file was fed as input to the compiler at a separate step, which naturally resulted in the error. A more detailed description of the mechanism is available at http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html.
>How-To-Repeat:
Attempt to build pkgtools/pkgin.
>Fix:
Set the CCACHE_CPP2 environment variable before invoking ccache. Suggested patch follows:
diff -c /usr/pkgsrc/mk/compiler/ccache.mk.orig /usr/pkgsrc/mk/compiler/ccache.mk
*** /usr/pkgsrc/mk/compiler/ccache.mk.orig 2016-05-09 14:01:55.120640576 -0700
--- /usr/pkgsrc/mk/compiler/ccache.mk 2016-05-09 14:00:31.912932624 -0700
***************
*** 140,145 ****
--- 140,146 ----
#
PKGSRC_MAKE_ENV+= CCACHE_COMPILERCHECK=echo\ ${CC_VERSION_STRING:Q}
PKGSRC_MAKE_ENV+= CCACHE_DIR=${CCACHE_DIR:Q}
+ PKGSRC_MAKE_ENV+= CCACHE_CPP2=yes
# Create symlinks for the compiler into ${WRKDIR}.
. for _var_ in ${_CCACHE_VARS}
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.