This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


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

[patch] (preliminary) g++/cshadow added to cpp search path


Hi,

  well here goes. I'd appreciate if any of you could comment on the
way I went about adding this support. The attached patch has not been
tested to bootstrap since making some minor changes, but it should
patch cleanly onto a fresh gcc cvs tree and build a compiler that
searches the new cshadow directory for includes.

(note: I recently looked back over an email where Benjamin suggested
 installing the shadow directory on the same level as the g++-v3 
 directory, so I expect the shadow location this patch uses is very 
 likely to change)

  What it does:
    adds ${prefix}/include/g++-v3/cshadow
    
  How it does it:
    1) in ${gcc}/config.if the name of the shadow directory is defined
       when libstdc++-v3 is configured
    2) in ${gcc}/gcc/(configure.in|Makefile.in), 
       -DGPLUSPLUS_SHADOW_INCLUDE_DIR=${shadow_include_directory}
       is added to the compile command for building cpp.
    3) in protoize.c and cppdefault.c, if the new -D... is not
       empty, it uses its value as the path to add before any other
       include search paths.
  
  What it doesn't:
    1) touch the libstdc++-v3 build/install yet.
    2) cause any nasty side-effects as long as the new g++-v3/cshadow
       is not present, or has no requested headers.

  What is yet to be done:
    1) make sure the new cshadow directory is _not_ installed by making 
       install from libstdc++-v3.
    2) set up a 'staged' include directory:
         ${builddir}/include/g++-v3 - standard libstdc++-v3 header files
         ${builddir}/include/g++-v3/cshadow - shadow header files
       where the cshadow directory contains the files currently in the 
       shadow and cshadow directories from the current libstdc++-v3 build 
         ${srcdir}/shadow and ${builddir}/cshadow.
       (maybe ${builddir}/include/ won't work, but I hope you get the idea)
    3) fix the cshadow headers :)
    4) configure to use 'staged' cshadow directory at build/test time.
    5) install 'staged' include directory.
    6) get some rest :-)

. . . so if anyone out there has a little processor time and disk space
to spare, I'd appreciate it if you'd test this patch and let me know
how it works for you -- and if the approach is even one that the gcc
build maintainer (aoliva@redhat.com) would accept.

modified files:
  RCS file: /cvs/gcc/egcs/Makefile.in
  RCS file: /cvs/gcc/egcs/config.if
  RCS file: /cvs/gcc/egcs/configure
  RCS file: /cvs/gcc/egcs/configure.in
  RCS file: /cvs/gcc/egcs/gcc/Makefile.in
  RCS file: /cvs/gcc/egcs/gcc/configure.in
  RCS file: /cvs/gcc/egcs/gcc/cppdefault.c
  RCS file: /cvs/gcc/egcs/gcc/protoize.c

(note: you'll have to regenerate gcc/configure, since my auto(conf|make) 
 tools are _hosed_. btw, anybody feel like helping me out here by telling
 me the secret combination of versions/patches/blackmagic to get the
 auto* system working again? )

Thanks,
  brent

-- 
Damon Brent Verner                        o      _     _         _
Cracker JackŪ Surprise Certified  _o     /\_   _ \\o  (_)\__/o  (_)
brent@rcfile.org                _< \_   _>(_) (_)/<_    \_| \   _|/' \/
brent@linux1.org               (_)>(_) (_)        (_)   (_)    (_)'  _\o_
? cpp.cshadow.diff
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/Makefile.in,v
retrieving revision 1.53
diff -c -p -3 -r1.53 Makefile.in
*** Makefile.in	2000/08/13 20:44:50	1.53
--- Makefile.in	2000/08/24 05:35:41
*************** oldincludedir=/usr/include
*** 36,41 ****
--- 36,42 ----
  infodir=${prefix}/info
  mandir=${prefix}/man
  gxx_include_dir=${includedir}/g++
+ gxx_shadow_dir_name = set_in_top_level_config.if
  
  tooldir = $(exec_prefix)/$(target_alias)
  build_tooldir = $(exec_prefix)/$(target_alias)
*************** BASE_FLAGS_TO_PASS = \
*** 375,380 ****
--- 376,382 ----
  	"tooldir=$(tooldir)" \
  	"build_tooldir=$(build_tooldir)" \
  	"gxx_include_dir=$(gxx_include_dir)" \
+   "gxx_shadow_dir_name=$(gxx_shadow_dir_name)" \
  	"gcc_version=$(gcc_version)" \
  	"gcc_version_trigger=$(gcc_version_trigger)" \
  	"target_alias=$(target_alias)" \
Index: config.if
===================================================================
RCS file: /cvs/gcc/egcs/config.if,v
retrieving revision 1.4
diff -c -p -3 -r1.4 config.if
*** config.if	2000/05/02 00:51:59	1.4
--- config.if	2000/08/24 05:35:41
*************** fi
*** 29,37 ****
  
  if [ -f ${libstdcxx_srcdir}/Makefile.in ]; then
  # We check libstdc++ for libstdcxx_interface.
! libstdcxx_interface=`grep "^INTERFACE" ${libstdcxx_srcdir}/Makefile.in | sed 's/INTERFACE[ 	]*=[ 	]*\(.*\)/\1/'`
  else
! libstdcxx_interface=
  fi
  
  if [ -f ${if_topsrcdir}/gcc/cp/Makefile.in ]; then
--- 29,42 ----
  
  if [ -f ${libstdcxx_srcdir}/Makefile.in ]; then
  # We check libstdc++ for libstdcxx_interface.
!   libstdcxx_interface=`grep "^INTERFACE" ${libstdcxx_srcdir}/Makefile.in | sed 's/INTERFACE[ 	]*=[ 	]*\(.*\)/\1/'`
!   if [ "${libstdcxx_interface}" = "v3" ]; then
!     gxx_shadow_dir_name=cshadow
!   else
!     gxx_shadow_dir_name=
!   fi
  else
!   libstdcxx_interface=
  fi
  
  if [ -f ${if_topsrcdir}/gcc/cp/Makefile.in ]; then
Index: configure
===================================================================
RCS file: /cvs/gcc/egcs/configure,v
retrieving revision 1.28
diff -c -p -3 -r1.28 configure
*** configure	2000/08/14 18:08:42	1.28
--- configure	2000/08/24 05:35:43
*************** includedir='${prefix}/include'
*** 102,107 ****
--- 102,108 ----
  oldincludedir='/usr/include'
  infodir='${prefix}/info'
  mandir='${prefix}/man'
+ gxx_shadow_dir_name=
  
  ### we might need to use some other shell than /bin/sh for running subshells
  
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/configure.in,v
retrieving revision 1.67
diff -c -p -3 -r1.67 configure.in
*** configure.in	2000/08/16 18:34:04	1.67
--- configure.in	2000/08/24 05:35:45
*************** fi
*** 49,60 ****
  
  # Set up configure/Makefile variables if libstdc++-v3 is to be built.
  if [ "${enable_libstdcxx_v3}" = "yes" ] && test -d $srcdir/libstdc++-v3; then
!         libstdcxx_version="target-libstdc++-v3"
  	# Don't use libstdc++-v3's flags to configure/build itself.
  	libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src/.libs'
  else
!         libstdcxx_version="target-libio target-libstdc++"
!         libstdcxx_flags='-isystem $$s/libstdc++ -isystem $$s/libstdc++/std -isystem $$s/libstdc++/stl -isystem $$s/libio -L$$r/$(TARGET_SUBDIR)/libstdc++'
  fi
  
  # these tools are built for the host environment
--- 49,60 ----
  
  # Set up configure/Makefile variables if libstdc++-v3 is to be built.
  if [ "${enable_libstdcxx_v3}" = "yes" ] && test -d $srcdir/libstdc++-v3; then
!   libstdcxx_version="target-libstdc++-v3"
  	# Don't use libstdc++-v3's flags to configure/build itself.
  	libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src/.libs'
  else
!   libstdcxx_version="target-libio target-libstdc++"
!   libstdcxx_flags='-isystem $$s/libstdc++ -isystem $$s/libstdc++/std -isystem $$s/libstdc++/stl -isystem $$s/libio -L$$r/$(TARGET_SUBDIR)/libstdc++'
  fi
  
  # these tools are built for the host environment
*************** sed -e "s:^TARGET_CONFIGDIRS[ 	]*=.*$:TA
*** 1324,1329 ****
--- 1324,1330 ----
      -e "s%^CXX_FOR_TARGET[ 	]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%" \
      -e "s%^TARGET_SUBDIR[ 	]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
      -e "s%^gxx_include_dir[ 	]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
+     -e "s%^gxx_shadow_dir_name[ 	]*=.*$%gxx_shadow_dir_name=${gxx_shadow_dir_name}%" \
         Makefile > Makefile.tem
  rm -f Makefile
  mv -f Makefile.tem Makefile
Index: gcc/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Makefile.in,v
retrieving revision 1.497
diff -c -p -3 -r1.497 Makefile.in
*** Makefile.in	2000/08/23 22:35:13	1.497
--- Makefile.in	2000/08/24 05:35:50
*************** gcc_tooldir = @gcc_tooldir@
*** 285,290 ****
--- 285,296 ----
  build_tooldir = $(exec_prefix)/$(target_alias)
  # Directory in which the compiler finds g++ includes.
  gcc_gxx_include_dir= @gcc_gxx_include_dir@
+ # Directory where g++ (libstc++ >= v3) searches for 14882 compliant
+ # c shadow/wrapper includes.  gxx_shadow_dir_name will be passed down 
+ # from the top level configure when libstdc++-v3 is used -- defined in 
+ # top level config.if
+ gcc_gxx_shadow_dir_name=@gcc_gxx_shadow_dir_name@
+ gcc_gxx_shadow_include_dir= @gcc_gxx_shadow_include_dir@
  # Directory to search for site-specific includes.
  includedir = $(local_prefix)/include
  # assertdir is overridden in cross-make.
*************** ORDINARY_FLAGS_TO_PASS = \
*** 654,659 ****
--- 660,667 ----
  	"prefix=$(prefix)" \
  	"local_prefix=$(local_prefix)" \
  	"gxx_include_dir=$(gcc_gxx_include_dir)" \
+   "gxx_shadow_dir_name=$(gcc_gxx_shadow_dir_name)" \
+   "gxx_shadow_include_dir=$(gcc_gxx_shadow_include_dir)" \
  	"tooldir=$(tooldir)" \
  	"gcc_tooldir=$(gcc_tooldir)" \
  	"bindir=$(bindir)" \
*************** intl.distdir-fixup:
*** 1789,1794 ****
--- 1797,1803 ----
  PREPROCESSOR_DEFINES = \
    -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
    -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
+   -DGPLUSPLUS_SHADOW_INCLUDE_DIR=\"$(gcc_gxx_shadow_include_dir)\" \
    -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
    -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
    -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.411
diff -c -p -3 -r1.411 configure.in
*** configure.in	2000/08/22 22:29:08	1.411
--- configure.in	2000/08/24 05:35:55
*************** if test x${gcc_gxx_include_dir} = x; the
*** 172,177 ****
--- 172,185 ----
      topsrcdir=${srcdir}/.. . ${srcdir}/../config.if
  changequote(<<, >>)dnl
      gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface}
+     # gxx_shadow_dir_name is defined in top level config.if. it is used to add the
+     # shadow include directory for 14882 compliant c headers to cpp's search path
+     gcc_gxx_shadow_dir_name=${gxx_shadow_dir_name}
+     if test x${gcc_gxx_shadow_dir_name} = x; then
+       gcc_gxx_shadow_include_dir=
+     else      
+       gcc_gxx_shadow_include_dir='${gcc_gxx_include_dir}/${gcc_gxx_shadow_dir_name}'
+     fi
  changequote([, ])dnl
    fi
  fi
*************** AC_SUBST(extra_passes)
*** 5038,5043 ****
--- 5046,5053 ----
  AC_SUBST(extra_programs)
  AC_SUBST(float_h_file)
  AC_SUBST(gcc_gxx_include_dir)
+ AC_SUBST(gcc_gxx_shadow_include_dir)
+ AC_SUBST(gcc_gxx_shadow_dir_name)
  AC_SUBST(gcc_version)
  AC_SUBST(gcc_version_trigger)
  AC_SUBST(host_exeext)
Index: gcc/cppdefault.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppdefault.c,v
retrieving revision 1.1
diff -c -p -3 -r1.1 cppdefault.c
*** cppdefault.c	2000/07/06 22:52:03	1.1
--- cppdefault.c	2000/08/24 05:35:55
*************** const struct default_include cpp_include
*** 31,36 ****
--- 31,40 ----
  = INCLUDE_DEFAULTS;
  #else
  = {
+ #ifdef GPLUSPLUS_SHADOW_INCLUDE_DIR
+     /* Pick up GNU C++ specific include files.  */
+     { GPLUSPLUS_SHADOW_INCLUDE_DIR, "G++", 1, 1 },
+ #endif
  #ifdef GPLUSPLUS_INCLUDE_DIR
      /* Pick up GNU C++ specific include files.  */
      { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },
Index: gcc/protoize.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/protoize.c,v
retrieving revision 1.54
diff -c -p -3 -r1.54 protoize.c
*** protoize.c	2000/08/22 07:44:51	1.54
--- protoize.c	2000/08/24 05:36:01
*************** struct default_include { const char *fna
*** 210,215 ****
--- 210,218 ----
  #else
    = {
      /* Pick up GNU C++ specific include files.  */
+ # ifdef GPLUSPLUS_SHADOW_INCLUDE_DIR
+     { GPLUSPLUS_SHADOW_INCLUDE_DIR, "G++", 1, 1 },
+ # endif
      { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },
  #ifdef CROSS_COMPILE
      /* This is the dir for fixincludes.  Put it just before
*************** struct default_include { const char *fna
*** 221,227 ****
      /* This is another place that the target system's headers might be.  */
      { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0 },
  #else /* not CROSS_COMPILE */
!     /* This should be /use/local/include and should come before
         the fixincludes-fixed header files.  */
      { LOCAL_INCLUDE_DIR, 0, 0, 1 },
      /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
--- 224,230 ----
      /* This is another place that the target system's headers might be.  */
      { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0 },
  #else /* not CROSS_COMPILE */
!     /* This should be /usr/local/include and should come before
         the fixincludes-fixed header files.  */
      { LOCAL_INCLUDE_DIR, 0, 0, 1 },
      /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.

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