Bug 214638

Summary: devel/kore: fails to build on 12.0
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: ed, tobik
Priority: --- Keywords: needs-patch, regression
Version: LatestFlags: tobik: maintainer-feedback+
Hardware: Any   
OS: Any   
Attachments:
Description Flags
kore.diff tobik: maintainer-approval+

Description Jan Beich freebsd_committer freebsd_triage 2016-11-18 20:17:55 UTC
FreeBSD dropped `const` in base r303451 and made the argument mutable in base r308264. Vendor makefile contains -std=c99 which leads to the following error

src/cli.c:385:9: error: generic selections are a C11-specific feature [-Werror,-Wc11-extensions]
        appl = basename(pwd);
               ^
/usr/include/libgen.h:60:21: note: expanded from macro 'basename'
#define basename(x)     __generic(x, const char *, __old_basename, basename)(x)
                        ^
/usr/include/sys/cdefs.h:337:2: note: expanded from macro '__generic'
        _Generic(expr, t: yes, default: no)
        ^
Comment 1 Ed Schouten freebsd_committer freebsd_triage 2016-11-18 20:31:40 UTC
Be sure to change the vendor's Makefile to use -std=gnu99 instead. :-)
Comment 2 Jan Beich freebsd_committer freebsd_triage 2016-11-18 22:18:27 UTC
(In reply to Ed Schouten from comment #1)
> ... use -std=gnu99 instead

Not enough at least for Clang 3.9. However, -std=c11 works fine.
Comment 3 Tobias Kortkamp freebsd_committer freebsd_triage 2016-11-19 12:21:35 UTC
Created attachment 177182 [details]
kore.diff

I currently see three ways to fix this, but I'm unsure which one is the
correct one:

(1) Add #undef basename to src/cli.c, so that it always uses the new
    basename without having to use _Generic

(2) Add -Wno-error=c11-extensions to CFLAGS.  This breaks the build
    with gcc (since it doesn't know about -Wno-error) and on FreeBSD 9.3,
    but at least we don't just silence the warning.  Building on FreeBSD
    9.3 could be fixed by building with clang from ports, but I'm more
    inclined to just mark it broken.

(3) Use -std=c11 instead of -std=c99.  I'm unsure what -std=c11
    actually implies, probably more than just -Wno-c11-extensions.

I'm leaning towards (2) and the patch is for that approach.  It should also fix building with clang 3.9 (bug #214639).
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-11-20 20:58:59 UTC
A commit references this bug:

Author: jbeich
Date: Sun Nov 20 20:58:21 UTC 2016
New revision: 426629
URL: https://svnweb.freebsd.org/changeset/ports/426629

Log:
  devel/kore: unbreak build on 12.0

  src/cli.c:385:9: error: generic selections are a C11-specific feature [-Werror,-Wc11-extensions]
          appl = basename(pwd);
                 ^
  /usr/include/libgen.h:60:21: note: expanded from macro 'basename'
   #define basename(x)     __generic(x, const char *, __old_basename, basename)(x)
                          ^
  /usr/include/sys/cdefs.h:337:2: note: expanded from macro '__generic'
          _Generic(expr, t: yes, default: no)
          ^

  PR:		214638
  Reported by:	pkg-fallout
  Submitted by:	Tobias Kortkamp <t@tobik.me> (maintainer)

Changes:
  head/devel/kore/Makefile
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-02-05 18:59:21 UTC
A commit references this bug:

Author: jbeich
Date: Sun Feb  5 18:58:19 UTC 2017
New revision: 433446
URL: https://svnweb.freebsd.org/changeset/ports/433446

Log:
  devel/kore: unbreak with GCC after r426629

  cc1: error: -Werror=c11-extensions: no option -Wc11-extensions

  PR:		214638
  Reported by:	marino, pkg-fallout (mips, mips64)

Changes:
  head/devel/kore/Makefile