Bug 212138

Summary: devel/cdecl: Needs to be compiled in ANSI C (C89) mode
Product: Ports & Packages Reporter: Robert Clausecker <fuz>
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed Not A Bug    
Severity: Affects Some People CC: koobs, w.schwarzenfeld
Priority: --- Keywords: needs-qa
Version: LatestFlags: koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
build log of devel/cdecl none

Description Robert Clausecker freebsd_committer freebsd_triage 2016-08-25 11:46:36 UTC
The port devel/cdecl uses the identifier register as a variable name. This identifier is reserved in C99 or later. To make this port compile, the compiler must be explicitly instructed to compile in ANSI C (C89) mode, e.g. by providing the flag -ansi or by invoking the compiler as c89. Previous versions of cc have defaulted to ANSI C mode, but this no longer seems to be the case.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2016-08-25 12:00:55 UTC
Thanks for your report Robert. 

The port appears to use USE_CSTD=c89 which I have confirmed adds -std=c89 to CFLAGS

What are the observed symptoms?

Can you provide a build output log (as an attachment) and the systems full FreeBSD uname -a output as well please
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2016-08-25 22:09:07 UTC
Here is the output of uname -a:

    FreeBSD miso 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

Here is the content of /etc/make.conf, without this configuration the port runs compiles just fine. It is likely that the configuration is somehow incorrect.

    CFLAGS=-O3
    CPUTYPE=corei7-avx
    OVERRIDE_LINUX_BASE_PORT=c6_64
    OVERRIDE_LINUX_NONBASE_PORTS=c6_64

A buildlog has been attached.
Comment 3 Robert Clausecker freebsd_committer freebsd_triage 2016-08-25 22:10:36 UTC
Created attachment 174079 [details]
build log of devel/cdecl
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2016-08-26 00:54:59 UTC
@Robert Can you test using CPUTYPE?= (not =) in /etc/make.conf and see whether -std=c89 appears in /usr/ports/devel/cdecl && make -V CFLAGS` output please
Comment 5 Walter Schwarzenfeld 2016-08-26 07:22:06 UTC
I can reproduce the error with CFLAGS=-O3. This causes it, without it works fine.
Comment 6 Walter Schwarzenfeld 2016-08-26 07:28:05 UTC
BtW;
cdecl.c:428:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
  while (command = commands[index]) {

this seems not very good.
Comment 7 Dmitry Marakasov freebsd_committer freebsd_triage 2016-08-29 12:03:15 UTC
> It is likely that the configuration is somehow incorrect.

Rather it is unsupported. It works correctly on ports level:

% make -V CFLAGS
-O3 -march=nocona  -fstack-protector -fno-strict-aliasing -std=c89

however upstream Makefile sucks in /etc/make.conf again, and whole CFLAGS are replaced with just -O3, and -std=c89 is lost. You could try something like:

.if ${.CURDIR:H:H} == "/usr/ports"
CFLAGS=         -O3
.endif

instead.

> this seems not very good.

There's no problem in this code.