From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27553 invoked by alias); 30 May 2007 18:14:59 -0000 Received: (qmail 27541 invoked by uid 22791); 30 May 2007 18:14:59 -0000 X-Spam-Check-By: sourceware.org Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 May 2007 18:14:56 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1HtSh3-0000Gm-00; Wed, 30 May 2007 20:14:45 +0200 Date: Wed, 30 May 2007 19:02:00 -0000 To: Jim Seymour Cc: ecos-discuss@ecos.sourceware.org Message-ID: <20070530181445.GE32489@lunn.ch> Mail-Followup-To: Jim Seymour , ecos-discuss@ecos.sourceware.org References: <465DBB45.3070802@cipher.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <465DBB45.3070802@cipher.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: Andrew Lunn X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] CDL define_proc: Unable to put "extern" in an include files X-SW-Source: 2007-05/txt/msg00187.txt.bz2 On Wed, May 30, 2007 at 10:58:29AM -0700, Jim Seymour wrote: > I have a desire to inject an "extern" statement into an include file > generated by one of our CDL files - so I added a "define_proc" block. > > Worked like a champ - until the build got to the rule to create > "heapgeninc.tcl" out of heapgen.cpp. > > This file is run through the preprocessor and the output is then fed to > Tcl. My "extern" statement is passed through the preprocessor intact, > so when it gets to Tcl, I get this error: > > invalid command name "extern" > > The same problem exists when the target.ld file is built. My "extern" > statement gets stuffed into that file, so ld fails with a "parse error". > > I fixed both problems with a horrible kludge: adding a #define to > heapgen.cpp and then bracketing my extern with a #ifndef. Could you turn this around. I think cpp is used to generate the linker file, heapgeninc.tcl and it is used when compiling C and C++ code. However each invocation is for different languages. Take a look at the output of: gcc -v -E -dD empty.c gcc -v -E -dD empty.cpp and see if there is something defined when compiling real code which is not defined when using CPP for building the .ld file etc. Then use #ifdef so that the extern is only present for real code generation compilation. Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss