On Fri, 13 Jun 2025, Gábor Németh wrote:

> > > A new option is added to warn if floating point literals have non-standard
> > > suffices (currently Q and W) in pedantic mode. The option is ON by
> > > default.
> > 
> > I don't think we should turn this off when building GCC itself (as opposed
> > to target libraries).  Host floating-point should only be used for limited
> > purposes such as reporting timing statistics, not for anything that could
> > affect target code generation; I don't see any reason we should want to
> > use these extended floating types in GCC itself at all.
> 
> I turned it off because any gcc/*.cc that includes <limits> directly or
> through eg. <math.h> throws:
> 
> In file included from
> <BUILD>/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/bits/specfun.h:44,
>                  from
> <BUILD>/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:3913,  
>                  from
> <BUILD>/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/math.h:36,  
>                  from ../../gcc/gcc/genautomata.cc:116:
> <BUILD>/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/limits:2107:30: error:
> non-standard suffix on floating constant [-Werror=non-standard-suffix]
>  2107 |         return __extension__ 0x1.0p-16382Q;
>       |                              ^~~~~~~~~~~~~ 
> ...
> 
> Should I add the flag selectively to affected files' build flags only?

The libstdc++ headers need to work for user applications without producing 
warnings with any default warning options, or with any non-default 
warnings options except maybe for very specialized ones - applications 
must not need to add -Wno-* options to get clean builds when including the 
headers installed by GCC.  Host code in GCC is a user application for this 
purpose.

If normal user code that includes <limits> gets this warning (built with 
an installed compiler), that needs fixing in some way.  If not, what is 
different about how GCC uses its own libstdc++?  (For example, it's 
important to include system headers with -isystem not -I, does GCC get 
this right when building with the libstdc++ from a previous stage of 
bootstrap?)

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to