pkgsrc-Users archive

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

dealing with inevitable warnings from new compilers on old code (was: Resources for getting started.)



I'm going to try moving this to tech-pkg for further discussion

At Fri, 14 Jun 2024 17:16:29 -0400, Greg Troxel <gdt%lexort.com@localhost> wrote:
Subject: Re: Resources for getting started.
>
> "Greg A. Woods" <woods%planix.ca@localhost> writes:
>
> > At Fri, 14 Jun 2024 17:04:22 +1200, Mark Davies <mark%ecs.vuw.ac.nz@localhost> wrote:
> > Subject: Re: Resources for getting started.
> >>
> >> But ignore the
> >> "-Wno-implicit-function-declaration", I
> >> had to add that to deal with gcc14 in the
> >> latest Arch.
> >
> > This is a case where I think, if I'm not mistaken, the better option is
> > to set FORCE_C_STD= (and maybe also FORCE_CXX_STD=) to whatever
> > standard(s) the package's code is actually currently written to conform
> > to.
>
> This is all messy.

Indeed.  These are the trials of evolving language standards and
updating compilers vs. legacy code.  We got through it with K&R -> ANSI,
and now we'll have to plod through it again!

> If a program is written to a certain standard (as it should be) then
> that will be clear from the README.  It should probe the compiler for
> accepting --std=c++NN and then add that to CXXFLAGS.

I don't think that ideal view of the world exists.

Most authors and maintainers of C code won't have given this a second
thought, unless perhaps they've read about some new feature in a more
recent C Standard and they're desperate to try it out in their code.

They might soon think about it, once people start feeding back changes
to fix new warnings from new compilers, and they might even think about
what C Standard they were working towards originally, but that'll take
more time than we'd like, I think.

> So yes, if the upstream is deficient this is needed, but it's not really
> an approach for warnings.

It's more about forced "-Werror" in many cases, but anyway...

Adding compiler-specific "-Wno-*" hacks doesn't seem to be a viable
approach to getting something to build, so something better seems needed
and should be worthwhile.

Now that USE_LANGUAGES is officially(?) deprecated FORCE_C_STD seems the
only viable choice, especially since USE_CC_FEATURES is orthogonal or
even opposite in purpose to this particular issue.

--
					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: pgpz5Rr4fxPwv.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index