Re: heads up RE autoconf C23 vs legacy code
Greg Troxel <[email protected]> Fri, 03 Jul 2026 07:35:31 -0400
| Newsgroups | gmane.os.netbsd.devel.packages |
|---|---|
| Message-ID | <[email protected]> |
Edgar Fu=C3=9F <[email protected]> writes: >> a program should document what dialect it is written in > I think you can't blame people having written a C program close to half=20 > a century ago for not having forseen that people would be changing the=20 > language in incompatible ways. I'm not blaming them. Just saying that as soon as there was a new C std that rejected programs that were valid under a previous std, it becomes a bug not to document what langauge the program is in. >> and probe for a[nd] set --std for it. > Unfortunately, there's no #pragma language-level. In Perl, I simply write > use 5.42; > (and use feature 'foobar';) > in the source to document which Perl exactly I write in. Yes, but most invocations of a C compiler in practice support --std=3Dcnn, and build systems should try that and add it if it works. >> Another option would be to have the wrappers error out on --std=3Dc23, if >> c23 is not in USE_CC_FEATURES. That should fix all of those >> look-for-c23 enable it bugs in autoconf, in programs that are written in >> some earlier dialect. That actually could be a good fix. > That sounds like an *excellent* idea to me. Generally error out on --std= =3Dcnn=20 > if pkgsrc's logic chose a different language level, at least for=20 > PKG_DEVELOPER=3DYES? This may create an enormous amount of fall-out initi= ally,=20 > but then all these hard-to-find build failures would be gone. I don't see this as being about PKG_DEVELOPER. If the package doesn't declare that it needs a particular C std, then trying to use it is a bug. For example, taking c++ out of USE_LANGUAGES and using c++ fails, always. This is really the same thing. I suspect this will mostly catch the autoconf bug, but that's me guessing.