[patch] mkcshadow improvements

Nathan Myers ncm@cantrip.org
Sun May 14 01:54:00 GMT 2000


Attached below is an improvement to mkcshadow, so it creates 
cshadow/* in the build directory rather than the source directory.  
I don't think the way it discovers the build directory is quite 
kosher, yet, but it's a lot closer than it was.  It also creates 
the cshadow directory itself, if necessary, and is more chatty 
about what it's up to.

For those who don't know, cshadow, mkshadow, and inclosure are about 
making C Library headers for C++ that are standard-conforming, using
the underlying headers provided by the OS and/or C compiler as raw 
material.

Here is the command line I have used from within the build directory.
Presumably something based on it should go into the Makefile.

  ../../../gcc/libstdc++-v3/inclosure \
    -I ../../../v3/lib/gcc-lib/i686-pc-linux-gnu/2.96/include/ \
    -I /usr/include \
    -G machine/ansi.h \
   | ../../../gcc/libstdc++-v3/mkcshadow 

The appropriate "-I" arguments must be discovered by configure, and 
the -G argument(s) depend on the target build environment.  The above 
is appropriate for a Debian GNU/Linux "potato" system.  All this
should be turned on by something like a "--enable-shadow-headers"
configure option.

When compiling with a system meant to use these headers,
you need an extra "-I gcc/libstdc++-v3/shadow" and
"-I build/i686-pc-linux-gnu/libstdc++-v3/cshadow", 
using whatever paths are actually appropriate in your
environment.  ('-I' options something like those should be 
automatic when you configure to use shadow headers.)

There's lots of configure.in / Makefile.am work to get
the above building and installing shadow headers automatically.
Fortunately, it can go on in parallel with getting the blamed
things working right.

I haven't got a successful compile with the above, yet, but
I thought the improvements to mkcshadow were worth checking
in anyhow, and the additional notes about how the scripts are 
used might be helpful to someone. 

Nathan Myers
ncm at cantrip dot org

Index: mkcshadow
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/mkcshadow,v
retrieving revision 1.1
diff -u -r1.1 mkcshadow
--- mkcshadow	2000/04/21 20:33:28	1.1
+++ mkcshadow	2000/05/14 08:33:20
@@ -4,9 +4,17 @@
 #   from stdin, and creates shadow headers under cshadow/, except where
 #   a header of the same name is already in shadow/.
 
+SCRIPTDIR=${0%/*}
+
+if [ ! -d cshadow ]; then
+  echo "Creating cshadow."
+  mkdir cshadow
+fi
+
+echo "Creating..."
 while read header; do
 
-  if [ ! -f shadow/$header ]; then
+  if [ ! -f $SCRIPTDIR/shadow/$header ]; then
 
     # strip off directory names while making 
     #   any necessary directories
@@ -22,11 +30,12 @@
       ;;
     esac
  
+    echo "  cshadow/$header"
     UPNAME=`echo $header | tr 'a-z./-' 'A-Z___'`
     cat >"cshadow/$header" <<EOF
 // -*- C++ -*- header wrapper.
 
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -73,11 +82,7 @@
   
 # endif /* _IN_C_SWAMP_ */
 #endif /* _INCLUDED_CPP_${UPNAME}_ */
-    
 EOF
-
+    #################### end ####################
   fi
 done
-
-
-


More information about the Libstdc++ mailing list