This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: libstdc++/3243


I've already manually added 'bits/' to the #include ""'s in gthr.h
(*after* installing that file ;) and have seen no problems since.
So, I'd say - this works.

Nevertheless I wonder why any system header file would use #include "",
it should be #include <> imho.

For example, the following breaks now:

#include "bits/gthr-posix.h"	// Will correctly use the user header file (assuming it exists in -Isome/include).
#include <iostream>		// Will include errornous include the user header file "bits/gthr-posix.h".

Where "bits/gthr-posix.h" would be a user headerfile and the user uses -I-.

About the question why -I- was introduced.  I can only say why I use it:
I am writing a library that is both, installed in the system headers path
and (a developers version) in the source tree that I am testing.
Because the header files end up, after installation, in the system headers
path, I can only use #include <>.  But during testing I want to be sure
that that uses the local developer header files, the search path to
which I have to provide with -I.  Therefore I compile with:

g++ -Ilocal_test_headers/include -I- -Iuninstalled_system_headers/include ...

On Wed, Jun 20, 2001 at 04:18:19AM -0500, Loren James Rittle wrote:
> Checked by rebuilding libstdc++-v3 in an already bootstrapped 3.0 tree
> and visually inspecting libstdc++-v3/include/bits/gthr.h as produced
> during the reconfiguration step.  Also, checked that, as installed, no
> additional failures were seen with -I- (done by hand editing
> testsuite_flags to add -I- before -I${SRC_DIR}/testsuite in the
> --install-includes case and running ``gmake check-script-install'').
> 
> OK for mainline?
> 
> Completely unrelated, pending patch for libstdc++/3195 was also in
> source tree.
> 
> 2001-06-20  Loren J. Rittle  <ljrittle@acm.org>
> 
> 	* acinclude.m4 (GLIBCPP_ENABLE_THREADS): Add relative path
> 	while staging so that -I- works with the installed gthr.h file.
> 	* aclocal.m4: Regenerate.
> 	* configure: Regenerate.
> 
> Index: acinclude.m4
> ===================================================================
> RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
> retrieving revision 1.129.2.21
> diff -c -r1.129.2.21 acinclude.m4
> *** acinclude.m4	2001/06/14 08:47:35	1.129.2.21
> --- acinclude.m4	2001/06/20 08:29:12
> ***************
> *** 1137,1143 ****
>   dnl and process to <file> with an output command.  The reason for a two-
>   dnl stage process here is to correctly handle $srcdir!=$objdir without
>   dnl having to write complex code (the sed commands to clean the macro
> ! dnl namespace are complex and fragile enough as it is).
>   dnl
>   AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
>     AC_MSG_CHECKING([for thread model used by GCC])
> --- 1137,1144 ----
>   dnl and process to <file> with an output command.  The reason for a two-
>   dnl stage process here is to correctly handle $srcdir!=$objdir without
>   dnl having to write complex code (the sed commands to clean the macro
> ! dnl namespace are complex and fragile enough as it is).  We must also
> ! dnl add a relative path so that -I- is supported properly.
>   dnl
>   AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
>     AC_MSG_CHECKING([for thread model used by GCC])
> ***************
> *** 1155,1161 ****
>     fi
>     AC_OUTPUT_COMMANDS([d=include/bits
>       rm -f $d/gthr.h $d/gthr-single.h $d/gthr-default.h
> !     sed '/^#/s/\([A-Z_][A-Z_]*\)/_GLIBCPP_\1/g' <$d/gthr.h-in >$d/gthr.h
>       sed 's/\(UNUSED\)/_GLIBCPP_\1/g' <$d/gthr-single.h-in \
>         | sed 's/\(GCC[A-Z_]*_H\)/_GLIBCPP_\1/g' >$d/gthr-single.h
>       sed 's/\(UNUSED\)/_GLIBCPP_\1/g' <$d/gthr-default.h-in \
> --- 1156,1163 ----
>     fi
>     AC_OUTPUT_COMMANDS([d=include/bits
>       rm -f $d/gthr.h $d/gthr-single.h $d/gthr-default.h
> !     sed '/^#/s/\([A-Z_][A-Z_]*\)/_GLIBCPP_\1/g' <$d/gthr.h-in \
> !       | sed 's,"gthr-,"bits/gthr-,' >$d/gthr.h
>       sed 's/\(UNUSED\)/_GLIBCPP_\1/g' <$d/gthr-single.h-in \
>         | sed 's/\(GCC[A-Z_]*_H\)/_GLIBCPP_\1/g' >$d/gthr-single.h
>       sed 's/\(UNUSED\)/_GLIBCPP_\1/g' <$d/gthr-default.h-in \

-- 
Carlo Wood <carlo@alinoe.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]