Bug 218657

Summary: Usage of I (_Complex_I) from complex.h results in unexpected warnings with clang -pedantic
Product: Base System Reporter: Andrey Alexeyev <akari>
Component: standardsAssignee: freebsd-standards (Nobody) <standards>
Status: New ---    
Severity: Affects Some People CC: akari, lwhsu
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
the test program none

Description Andrey Alexeyev 2017-04-14 15:48:41 UTC
Created attachment 181784 [details]
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.