public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jim Seymour <ecosjim@cipher.com>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] CDL define_proc: Unable to put "extern" in an include files
Date: Wed, 30 May 2007 19:02:00 -0000	[thread overview]
Message-ID: <20070530181445.GE32489@lunn.ch> (raw)
In-Reply-To: <465DBB45.3070802@cipher.com>

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

  reply	other threads:[~2007-05-30 18:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-30 18:04 Jim Seymour
2007-05-30 19:02 ` Andrew Lunn [this message]
2007-05-31 19:43   ` Jim Seymour
2007-05-31 21:44     ` Andrew Lunn
2007-05-31 22:20       ` Jim Seymour
2007-06-01  8:54 ` Nick Garnett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070530181445.GE32489@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=ecosjim@cipher.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).