LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 28901 - -Wexpansion-to-defined enabled without -pedantic
Summary: -Wexpansion-to-defined enabled without -pedantic
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-08 04:12 PDT by Paolo Bonzini
Modified: 2016-08-08 04:12 PDT (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Bonzini 2016-08-08 04:12:41 PDT
Macros that expand to "defined" are undefined behavior according to the C standard, but clang, as a language extension, is implementing it by always treating "defined" as the preprocessor operator.

While it is a good idea to add a separate warning flag for -Wexpansion-to-defined, it should only be enabled by default if -pedantic or perhaps -Wextra (and of course -Weverything) is provided.  It should not be enabled by -Wall.