[PATCH] Implement MSVC header search algorithm in MicrosoftMode

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Mon Dec 16 19:10:05 PST 2013


On Mon, Dec 16, 2013 at 6:05 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Sat, Dec 14, 2013 at 5:44 AM, Will Wilson <will at indefiant.com> wrote:
>> Hi All,
>>
>> Here's a patch to implement the MSVC header search algorithm for quoted
>> #includes. MSVC doesn't just search the #includer's directory (the existing
>> clang/GCC behaviour) but also searches the directories of all parent
>> includers before falling back on the standard search paths. I implemented
>> this after being bitten a few times by clang including different files to
>> MSVC within existing MSVC targeted codebases.

Will, do you think it's worth adding a diagnostic (warning) for this
new behavior, in the case where the new/MSVC behavior differs from the
old/GCC behavior? Something like

    warning: in Microsoft mode this #include directive refers to
'a/b/foo.h', where
    normal header lookup would have found 'c/foo.h' instead [-Wmsvc-include]

Silently accepting the construct just encourages people to rely on it.
Giving a diagnostic would at least let the relevant developers know
that something bogus is going on and that maybe they should fix their
directory structure. (And if they really don't care, they can silence
the warning.)

my $.02,
–Arthur




More information about the cfe-commits mailing list