[Bug c/92826] New: Impossible to silence warning: non-standard suffix on floating constant [-Wpedantic]

kim.walisch at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 5 15:06:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92826

            Bug ID: 92826
           Summary: Impossible to silence warning: non-standard suffix on
                    floating constant [-Wpedantic]
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kim.walisch at gmail dot com
  Target Milestone: ---

Created attachment 47429
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47429&action=edit
Causes warning when compiled using -Wpedantic

Hi,

GCC warns when using the Q suffix for __float128 constants and compiling using
-Wpedantic:

int main()
{
    if (1.0Q > 0)
        return 0;
    else
        return 1;
}

$ gcc -Wpedantic test.c -o test
test.c: In function ‘main’:
test.c:3:2: warning: non-standard suffix on floating constant [-Wpedantic]
  if (1.0Q > 0)
  ^~

GCC even warns when using constants defined as macros from the <quadmath.h>
system header.

#include <quadmath.h>

int main()
{
    if (1.0 > FLT128_MIN)
        return 0;
    else
        return 1;
}

$ gcc -Wpedantic test.c -o test
test.c: In function ‘main’:
test.c:5:5: warning: non-standard suffix on floating constant [-Wpedantic]
     if (1.0 > FLT128_MIN)

GCC should definitely not warn when using constants from <quadmath.h>. GCC
should also provide an option to disable these warnings (e.g.
-Wno-non-standard-suffix). People are currently using disgusting hacks to avoid
these warnings so please add an option for that.


More information about the Gcc-bugs mailing list