tech-pkg archive

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

Re: Fixing configure failures from newer gcc



At Sat, 18 Oct 2025 23:01:29 -0400, Andrew Cagney <andrew.cagney%gmail.com@localhost> wrote:
Subject: Re: Fixing configure failures from newer gcc
>
> Except programs, are not written to a language standard.  They are
> written to a combination of the available compilers, libraries, and
> coding standards.  And that is a constantly moving target that doesn't
> say in the --std=cNN box.

That's often quite true, but!  :-)

Yes, most legacy code is indeed written to work with a range of
compilers that might default to a range of different language standards.

These new compiler errors though show that lots of "C" code still hasn't
met a newer compiler like GCC since 14.x or Clang since about 15.x.

So that range actually has an implied maximum level that's now becoming
visible.  Indeed if one considers that new language levels will continue
to drop backward compatability even more then that maximum is always
going to be there and clearly it has always been there too -- we just
didn't know exactly where it was before.

So now we need to tell the compiler to back off by giving it the
appropriate "-std=" option, i.e. make the maximum language level
explicit.

Note too that unlike the attempts to use "-Wno-*" the use of "-std=" is
fully portable across all newer versions of any compilers that were
previously used to build such legacy code within the pkgsrc.

Perhaps more importantly "-std=" is also future proof -- it should still
work with the next unreleased version of these compilers too (at least
until the compiler vendors give up on whatever oldest level is needed
for the oldest code).

That should be a ways off though.  The safe global default for pkgsrc is
likely "-std=gnu99" since that's what the NetBSD compilers (and many
other system compilers) have offered by default for years now.  More
recently NetBSD's compiler has defaulted to gnu17 and so even that might
be a safe default.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpaBzc6N2NR1.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index