[cfe-dev] Feature proposal: Compile Configuration Disclosure
James Widman
widman at gimpel.com
Fri Mar 5 16:23:08 PST 2010
On Mar 5, 2010, at 7:09 PM, James Widman wrote:
>
> On Mar 3, 2010, at 7:05 PM, Douglas Gregor wrote:
>
>> On Mar 3, 2010, at 2:44 PM, James Widman wrote:
>>
>>> List of Needs:
>>> --------------
>>>
>>> - The complete set of predefined macro definitions;
>>>
>>> - The ordered sequence of directory pathnames used for header-searching in #include "" and #include <>;
>>>
>>> - The ordered sequence of implicit #include directives;
>>
>> The ordering between predefined macro defs and implicit includes (e.g., based on -include on the command line) can matter.
>
> So bullet points 1 & 3 boil down to something simpler (or at least more general):
>
> - The sequence of preprocessing directives implicitly processed (in effect) at the outset of each translation unit
Incidentally, GCC does not seem to care about the order of -D and -include options; e.g. for a.h with:
#ifdef Bar
#error Bar defined!
#endif
... and the invocation:
g++ -DFoo -include a.h -DBar empty.cpp
... GCC hits the #error. (Ditto for clang.)
However, the updated (merged) bullet point still makes more sense: if anyone decides to start caring about the order of these things, the updated bullet point would cover it. And it's just clearer that way. So if/when GCC implements this, their disclosure file should contain:
#define Foo 1
#define Bar 1
#include "./a.h"
James Widman
--
Gimpel Software
http://gimpel.com
More information about the cfe-dev
mailing list