missing include guards on {bits,tr1}/shared_ptr.h

Jonathan Wakely jwakely.gcc@gmail.com
Wed Mar 11 15:06:00 GMT 2009


While trying to work out why shared_ptr doesn't appear in the doxygen
docs, I realised that include/bits/shared_ptr.h and
include/tr1/shared_ptr.h don't have any include guards.  This is
because I split include/tr1_impl/boost_shared_ptr.h into two separate
files, and I'm an idiot.

The tr1_impl/boost_shared_ptr.h file in GCC 4.3 and earlier cannot
have include guards, because it must be possible to include it twice,
once as C++0x and once as TR1.  That is not the case with the separate
files, which should have include guards.

This causes the following to break in -std=c++0x mode:

#include <memory>
#include <bits/shared_ptr.h>

or this in all modes:

#include <tr1/memory>
#include <tr1/shared_ptr.h>

This is not technically a regression, because those headers didn't
exist in GCC 4.3 and are not meant to be included by users anyway.
Should a fix wait for 4.4.1, or can it go in now?

The attached patch was tested on GNU/Linux x86_64.

Jon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sp_guards.patch
Type: text/x-patch
Size: 1034 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090311/24b4bc0d/attachment.bin>


More information about the Libstdc++ mailing list