On Tue, Dec 28 2021, Jonathan Gray <j...@jsg.id.au> wrote:
> On Mon, Dec 27, 2021 at 09:50:04PM -0500, Kurt Mosiejczuk wrote:
>> I find myself adding the following to many ports files nowadays
>> 
>> .include <bsd.port.arch.mk>
>> .if !${PROPERTIES:Mclang}
>> CFLAGS +=    -std=gnu99
>> .endif
>> 
>> Rather than continue this, I'd like to propose adding BASE_C99 to bsd.port.mk
>> 
>> When BASE_C99= Yes, if on a non-base-clang arch, it will add the same to
>> CFLAGS, but without including bsd.port.arch.mk by hand.
>> 
>> Included are patches to add this to bsd.port.mk and a diff for bsd.port.mk(5)
>> to include it in the man page.
>> 
>> Once this is in, I'll sweep the tree for the boilerplate and replace it all
>> with this.
>> 
>> ok?
>
> Is it time to consider changing the gcc default to gnu99?

Definitely.  I have considered this since some time already and feel
a bit lame for not even proposing it.  I think changing such defaults in
a specific compiler version is not wrong per se, YMMV.

I think there are two big tests this proposal must pass:
- base must build and work on all affected architectures
- a full ports bulk build should be considered successful on sparc64
The former isn't undoable, it's just harder to get your hands on alpha
or hppa or sh...

Another approach that does not require changing base defaults:
defaulting base-gcc to -std=gnu99 using the ports infrastructure.  I'm
not sure where exactly this could be done, maybe in the compiler wrapper
scripts we put in ${WRKDIR}/bin?

> built and installed on sparc64 but otherwise untested.
>
> --- /tmp/defs.old     Sun Dec 19 15:25:52 2021
> +++ /tmp/defs.new     Sun Dec 19 16:34:59 2021
> @@ -70,6 +70,7 @@
>  #define __FLT_HAS_INFINITY__ 1
>  #define __DEC64_MAX__ 9.999999999999999E384DD
>  #define __DEC64_MANT_DIG__ 16
> +#define __STDC_VERSION__ 199901L
>  #define __DEC32_MAX_EXP__ 96
>  #define __DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL
>  #define __LDBL_MANT_DIG__ 113
>
> Index: gnu/gcc/gcc/c-opts.c
> ===================================================================
> RCS file: /cvs/src/gnu/gcc/gcc/c-opts.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 c-opts.c
> --- gnu/gcc/gcc/c-opts.c      15 Sep 2011 12:19:12 -0000      1.3
> +++ gnu/gcc/gcc/c-opts.c      28 Dec 2021 03:44:20 -0000
> @@ -236,6 +236,8 @@ c_common_init_options (unsigned int argc
>  
>    if (c_language == clk_c)
>      {
> +      set_std_c99 (false /* ISO */);
> +
>        /* If preprocessing assembly language, accept any of the C-family
>        front end options since the driver may pass them through.  */
>        for (i = 1; i < argc; i++)


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to