[Bug 218657] Usage of I (_Complex_I) from complex.h results in unexpected warnings with clang -pedantic

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Apr 14 15:48:41 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218657

            Bug ID: 218657
           Summary: Usage of I (_Complex_I) from complex.h results in
                    unexpected warnings with clang -pedantic
           Product: Base System
           Version: 9.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: freebsd-standards at FreeBSD.org
          Reporter: akari at alienslab.net

Created attachment 181784
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=181784&action=edit
the test program

Compile the attached test program with: clang -std=c11 -pedantic test.c -o test

This is expected to compile without warnings. However, it produces an
"imaginary constants is a GNU extension" warning on FreeBSD. This is because
_Complex_I is defined as ((float _Complex)1.0i) in /usr/include/complex.h.

The easiest workaround would be to use __extension__ to suppress the warning,
i.e. redefine _Complex_I as (__extension__ (float _Complex)1.0i). This is what
glibc does as well.

It's a minor issue, but it prevents a project I'm working on from building with
-Wall on FreeBSD.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-standards mailing list