Bug 89142 - Allow poisoning identifier from the command line
Summary: Allow poisoning identifier from the command line
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-31 17:29 UTC by Simon Richter
Modified: 2019-01-31 17:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Richter 2019-01-31 17:29:04 UTC
I'm currently refactoring a program that uses a preprocessor symbol in various places, and I'd like to generate errors for all uses.

There is no common header file in which I could place a `#pragma gcc poison` directive, but I can modify the CPPFLAGS globally.

It would be nice to have a way to add poisoned preprocessor symbols from the command line.
Comment 1 Jakub Jelinek 2019-01-31 17:45:28 UTC
Just put it into a new header file and use
-include /whatever/header_with_gcc_poison.h
on the command line.
Comment 2 Florian Weimer 2019-01-31 17:56:11 UTC
And with bash, you don't even need a separate file, you can use something like this:

  -include <(echo '#pragma GCC poison IDENTIFIER')