pkgsrc-Bugs archive

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

pkg/51128: Extraneous warnings when using ccache prevent some builds



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



Home | Main Index | Thread Index | Old Index