On Tue, Nov 24, 2026 at 10:02:21PM +0100, Rainer Orth wrote:
> Hi Jakub,
>
> > The patch also shows (quite randomly) on the testsuite as well on 3
> > libstdc++ affected headers what users can do to deal with this (everything
> > is admittedly ugly). The options are conditionalize code on
> > the #if __cpp_0o_octals >= 202611L and duplicate small parts of code,
> > similarly but use something like the OCTAL macro above (not actually used
> > in the patch at all), rewrite 00 as 0, rewrite non-zero octal literals
> > as decimal/hexadecimal instead (and possibly make errors in that), use
> > pargmas to temporarily disable the warning around some code, use command
> > line option to disable it (or enable it if say coding style rules somewhere
> > require that) or just live with the warnings.
>
> this patch caused two testsuite failures on Solaris:
>
> FAIL: g++.dg/warn/Wstringop-overflow-6.C -std=gnu++29 (test for excess
> errors)
> FAIL: g++.dg/warn/Wuninitialized-pr107919-1.C -std=gnu++29 (test for excess
> errors)
>
> both with
>
> Excess errors:
> /usr/include/iso/stdio_iso.h:304:48: warning: octal literals without '0o' or
> '0O' prefix other than '0' are deprecated in C++29
> [-Wdeprecated-octal-literal]
> /usr/include/iso/stdio_iso.h:305:50: warning: octal literals without '0o' or
> '0O' prefix other than '0' are deprecated in C++29
> [-Wdeprecated-octal-literal]
>
> <iso/stdio_iso.h> has
>
> #define _IOEOF 0020 /* EOF reached on read */
> #define _IOERR 0040 /* I/O error from system */
>
> #if __cplusplus >= 199711L
> namespace std {
> inline int feof(FILE *_p) { return _p->_flag & _IOEOF; }
> inline int ferror(FILE *_p) { return _p->_flag & _IOERR; }
> }
>
> I wonder if the warning is appropriate for system headers since users
> can do nothing about those.
>From what I've tested the warning works properly with system headers,
both when a system header contains e.g. inline function with some octal
literals in it, or when defining a macro that is later on used in the
main source file.
But the above 2 tests are compiled with -Wsystem-headers.
Maybe we should just add -Wno-deprecated-octal-literal to their
dg-options?
Jakub