Boost C++ Libraries: Ticket #12053: boost include directives use double quotes incorrectly https://svn.boost.org/trac10/ticket/12053 <p> Extracted from issue <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/11516"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/11516</a>: </p> <p> Many Boost headers use double-quoted include directives with paths that are not relative to the current header file. For example, this is an excerpt from boost/aligned_storage.hpp: </p> <p> #include "boost/config.hpp" #include "boost/detail/workaround.hpp" </p> <p> This will cause the full search path to be searched for the given files, even the directories supposedly local to the application (set via -iquote option on GCC/Clang), which can make local files interfere with Boost, especially if there's some part in the local project that is also called "boost"... </p> <p> See a full list of offending directives via: </p> <p> find /usr/include/boost -type f -exec grep '<sup>#.*"boost/' {} + </sup></p> <p> As can be seen in boost/any.hpp, this might even be intentional for boost/config.hpp, but this is surely not intended for any other file. Handling of boost/config.hpp is not uniform, however; see for example boost/limits.h, which includes config.hpp via angle-quotes. </p> <p> This bug report does not address double-quoted include directives with header-relative paths, as used copiously by Boost Spirit, for example. These work fine on GCC/Clang and do not interact with local code (but see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3762" title="#3762: Patches: Thread can't be compiled with winscw (Codewarrior by Nokia) (closed: fixed)">#3762</a>). </p> <p> I suggest to change all include directives to a uniform style in order to eliminate interference of local files. The easiest and least-invasive solution would be to change double quotes to angle brackets, something along the lines of </p> <p> find /usr/include/boost -type f -exec sed -i~ -e 's/<sup>\(#.* \)"\(boost\/.*\)"/\1&lt;\2&gt;/' {} + </sup></p> <p> (warning: search-and-destroy capability; this also updates #defines that are used later in #include directives) </p> <p> After applying this command, my code still compiles and passes all unit tests, but strace confirms that project-local include directories are no longer searched, except for boost/mpl/aux_/preprocessed/gcc/*.hpp, which is due to some stringification macro magic in boost/mpl/aux_/include_preprocessed.hpp. That's probably obscure enough to not matter in practice. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12053 Trac 1.4.3 Antony Polukhin Wed, 04 Jan 2017 09:10:22 GMT owner, status changed https://svn.boost.org/trac10/ticket/12053#comment:1 https://svn.boost.org/trac10/ticket/12053#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">nasonov</span> to <span class="trac-author">Antony Polukhin</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Fixed in develop in commit <a class="ext-link" href="https://github.com/boostorg/any/commit/e6d8a49e95a145a3f761b92652464cd460567d71"><span class="icon">​</span>e6d8a49e</a>. Will be merged to master as soon as tests pass. </p> Ticket Antony Polukhin Wed, 18 Jan 2017 19:47:25 GMT milestone changed https://svn.boost.org/trac10/ticket/12053#comment:2 https://svn.boost.org/trac10/ticket/12053#comment:2 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.64.0</span> </li> </ul> Ticket Antony Polukhin Sat, 22 Apr 2017 06:00:42 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12053#comment:3 https://svn.boost.org/trac10/ticket/12053#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket