Simon Tatham via llvm-dev
2018-Jun-27 10:27 UTC
[llvm-dev] RFC: clang option to tolerate Windows-style #include paths?
Hello llvm-dev, I've written a draft patch to allow clang to tolerate "Windows-isms" - backslash path separators and inconsistent case in filenames - in the pathnames appearing in #include directives, even when its host platform is not Windows. For example, something like #include "subdir\HEADER.H" would be initially reinterpreted as "subdir/HEADER.H", and then, if the file didn't exist, clang would check each component of the pathname for a case-insensitive match, so that if the file turned out to be called, say, "Subdir/Header.h" then it would still find it. The idea is to make life easier for people compiling Windows-specific code bases on (say) Linux, either because they're cross-compiling them with clang-cl, or because they're developing a port of the code base. If the owner of the code base won't take patches to make the #includes more portable, then it can be useful to have the fallback option of making clang tolerate the nonportable versions. It's nowhere near finished yet, but before I put more effort into polishing it up, I thought I'd check to see if this is a feature anyone else thinks would be useful, and also make sure I'm not going about it in totally the wrong way. The draft is at https://reviews.llvm.org/D48626 , if anyone's interested. Cheers, Simon IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Tim Northover via llvm-dev
2018-Jun-27 10:59 UTC
[llvm-dev] RFC: clang option to tolerate Windows-style #include paths?
Hi Simon, This is probably more a cfe-dev question. I've added them to the circulation here, apologies for the inevitable quotation mess. Tim. On Wed, 27 Jun 2018 at 11:27, Simon Tatham via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I've written a draft patch to allow clang to tolerate "Windows-isms" - backslash path separators and inconsistent case in filenames - in the pathnames appearing in #include directives, even when its host platform is not Windows. > > For example, something like #include "subdir\HEADER.H" would be initially reinterpreted as "subdir/HEADER.H", and then, if the file didn't exist, clang would check each component of the pathname for a case-insensitive match, so that if the file turned out to be called, say, "Subdir/Header.h" then it would still find it. > > The idea is to make life easier for people compiling Windows-specific code bases on (say) Linux, either because they're cross-compiling them with clang-cl, or because they're developing a port of the code base. If the owner of the code base won't take patches to make the #includes more portable, then it can be useful to have the fallback option of making clang tolerate the nonportable versions. > > It's nowhere near finished yet, but before I put more effort into polishing it up, I thought I'd check to see if this is a feature anyone else thinks would be useful, and also make sure I'm not going about it in totally the wrong way. > > The draft is at https://reviews.llvm.org/D48626 , if anyone's interested. > > Cheers, > Simon > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev