Bug 218657 - Usage of I (_Complex_I) from complex.h results in unexpected warnings with clang -pedantic
Summary: Usage of I (_Complex_I) from complex.h results in unexpected warnings with cl...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-standards (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-14 15:48 UTC by Andrey Alexeyev
Modified: 2019-04-15 08:03 UTC (History)
2 users (show)

See Also:


Attachments
the test program (161 bytes, text/plain)
2017-04-14 15:48 UTC, Andrey Alexeyev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.