Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 15:48:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-standards@FreeBSD.org
Subject:   [Bug 218657] Usage of I (_Complex_I) from complex.h results in unexpected warnings with clang -pedantic
Message-ID:  <bug-218657-15@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

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@FreeBSD.org
          Reporter: akari@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.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-218657-15>