Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Nov 2024 13:19:50 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        FreeBSD Standards <freebsd-standards@freebsd.org>
Subject:   Re: /usr/share/mk/sys.mk for main [so: 15]: .if defined(%POSIX) and CC ?= c89 and CFLAGS ?= -O [still appropriate?]
Message-ID:  <473382FD-89BA-4389-BF89-7A37FB719EF0@yahoo.com>
In-Reply-To: <CANCZdfpFoCt8rKRk4377JhCyEYtrZM3DHzBDegqCcLOf-SXtQw@mail.gmail.com>
References:  <E0700929-6C81-484D-B351-3CC8888BA66C.ref@yahoo.com> <E0700929-6C81-484D-B351-3CC8888BA66C@yahoo.com> <CANCZdfpFoCt8rKRk4377JhCyEYtrZM3DHzBDegqCcLOf-SXtQw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Nov 28, 2024, at 13:05, Warner Losh <imp@bsdimp.com> wrote:

>> On Thu, Nov 28, 2024, 1:58=E2=80=AFPM Mark Millard =
<marklmi@yahoo.com> wrote:
>> With the recent POSIX 2024 activity I'm wondering if sys.mk having:
>>=20
>> .if defined(%POSIX)
>> CC              ?=3D      c89
>> CFLAGS          ?=3D      -O
>> .else
>>=20
>> may be outdated for main [so: 15 as stands] and may have
>> been so for some time.
>>=20
>>=20
>> https://pubs.opengroup.org/onlinepubs/9799919799/ (Issue 8)
>> reports a base document set including:
>>=20
>> ISO/IEC 9899:2018, Programming Languages =E2=80=94 C (C17)
>>=20
>> Also: c17 =E2=80=94 compile standard C programs
>> (FreeBSD does not have c17 as a command yet.)
>>=20
>>=20
>> https://pubs.opengroup.org/onlinepubs/9699919799.orig/ (Issue 7)
>> reports a base document set including:
>>=20
>> ISO/IEC 9899:1999, Programming Languages - C
>> ISO/IEC 9899:1999/Cor.1:2001(E)
>> ISO/IEC 9899:1999/Cor.2:2004(E)
>> ISO/IEC 9899:1999/Cor.3
>>=20
>> also: c99 - compile standard C programs
>>=20
>> (FreeBSD has c99 .)
>=20
> What does the section on make specify? I suspect that issue 7 says c99 =
here. We are no where close to adding all or even most of the issue 8 =
features, though.

Issue 7 reports for make:

MACROS

MAKE=3Dmake
AR=3Dar
ARFLAGS=3D-rv
YACC=3Dyacc
YFLAGS=3D
LEX=3Dlex
LFLAGS=3D
LDFLAGS=3D
CC=3Dc99
CFLAGS=3D-O 1
FC=3Dfort77
FFLAGS=3D-O 1
[XSI]
GET=3Dget
GFLAGS=3D
SCCSFLAGS=3D
SCCSGETFLAGS=3D-s

and:

The default rules are based on System V. The default CC=3D value is c99 =
instead of cc because this volume of POSIX.1-2017 does not standardize =
the utility named cc. Thus, every conforming application would be =
required to define CC=3D c99 to expect to run. There is no advantage =
conferred by the hope that the makefile might hit the "preferred" =
compiler because this cannot be guaranteed to work. Also, since the =
portable makescript can only use the c99 options, no advantage is =
conferred in terms of what the script can do. It is a =
quality-of-implementation issue as to whether c99 is as valuable as cc.

(I've omitted examples that just use c99 text explicitly.)

Analogously, Issue 8 for make:

MACROS

AR=3Dar
ARFLAGS=3D-rv
YACC=3Dyacc
YFLAGS=3D
LEX=3Dlex
LFLAGS=3D
LDFLAGS=3D
CC=3Dc17
CFLAGS=3D-O 1
[XSI]
GET=3Dget
GFLAGS=3D
SCCSFLAGS=3D
SCCSGETFLAGS=3D-s

and:

The default rules are based on System V. The default CC=3D value is c17 =
instead of cc because this volume of POSIX.1-2024 does not standardize =
the utility named cc. Thus, every conforming application would be =
required to define CC=3Dc17 to expect to run. There is no advantage =
conferred by the hope that the makefile might hit the "preferred" =
compiler because this cannot be guaranteed to work. Also, since the =
portable makescript can only use the c17 options, no advantage is =
conferred in terms of what the script can do. It is a =
quality-of-implementation issue as to whether c17 is as valuable as cc.

(I've omitted examples that just use c17 text explicitly.)


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?473382FD-89BA-4389-BF89-7A37FB719EF0>