🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #413

Re: preventing -lang-c from being passed to cpp

#413
From: Andreas Stolcke
Date: Wed, 15 Apr 1992 07:34
69 lines
2527 bytes
In article <9204141529.AA27455@nutrimat.gnu.ai.mit.edu> friedman@gnu.ai.mit.edu writes:
>   I would like to install older versions of gcc (e.g. 1.40) in the same
>directory hierarchy that the 2.0+ programs are arranged in so that we can
>run them by doing "gcc -V 1.40 foo.c".  This seems to work just fine
>(provided I rename some of the binaries) except that older versions of cpp
>don't understand the -lang-c (and similar) arguments.  I tried writing a
>specs file to turn this off but I clearly don't understand what I'm doing
>or it doesn't work at all, because I haven't figured out a way to do this.

To achieve this we wrote a little wrapper script for cpp to massage
the options.  All other programs invoked by gcc seem to be compatible.
The problem with specs is that they don't allow you to modify the
arguments that are compiled into gcc (look at the string constants
containing all those % thingies in gcc.c ...).  But then maybe
I am missing something, too.

Anyway the cpp wrapper is included below.

--Andreas 

#!/bin/sh

# do some options massaging to let the gcc 2.0 driver call gcc 1.4

cpp=/usr/local/lib/gcc-cpp

newargs=
echo=

for arg
do
	case "$arg" in
	-v)	echo=true
		newargs="$newargs $arg"
		;;
	-g)		# ignore
		;;
	-lang-c)	# suppress
		;;
	-lang-objc)
		echo "No Objective-C support available for this version." >&2
		exit 1
		;;
	-lang-c++)	# use old c++ preprocessor flag
		newargs="$newargs -+"
		;;
	-D__GNUC__=2)
		newargs="$newargs -D__GNUC__"
		;;
	-D__GNUG__=2)
		newargs="$newargs -D__GNUG__"
		;;
	*)	# make sure funny args are preserved 
		newargs="$newargs '$arg'"
		;;
	esac
done

cmd="$cpp $newargs"

if [ "$echo" ]; then
	echo $cmd >&2
fi

eval "exec $cmd"
-- 
Andreas Stolcke					stolcke@icsi.berkeley.edu
International Computer Science Institute	stolcke@ucbicsi.bitnet
1947 Center St., Suite 600, Berkeley, CA 94704	(510) 642-4274 ext. 126
Technical Details
Message-ID: <sgm98INNmh4@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!icsi.berkeley.edu!stolcke
References: <9204141529.AA27455@nutrimat.gnu.ai.mit.edu>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!icsi.berkeley.edu!stolcke
From: stolcke@icsi.berkeley.edu (Andreas Stolcke)
Subject: Re: preventing -lang-c from being passed to cpp
Message-ID: <sgm98INNmh4@agate.berkeley.edu>
Sender: gnulists@ai.mit.edu
Reply-To: stolcke@icsi.berkeley.edu (Andreas Stolcke)
Organization: International Computer Science Institute, Berkeley, CA, U.S.A.
References: <9204141529.AA27455@nutrimat.gnu.ai.mit.edu>
Distribution: gnu
Date: Wed, 15 Apr 1992 07:34:00 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 70