public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Debugging Macros
@ 2008-01-24  8:29 Tom Browder
  2008-01-24  8:46 ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Browder @ 2008-01-24  8:29 UTC (permalink / raw)
  To: gcc-help

I'm trying to debug a gcc frontend (cobol for gcc) and get errors such as:

../../gcctrunk_with_cobol/gcc/cobol/cobcbei.c:462: error: invalid
application of 'sizeof' to incomplete type 'struct lang_identifier'
../../gcctrunk_with_cobol/gcc/cobol/cobcbei.c:462: error: 'getdecls'
undeclared here (not in a function)
../../gcctrunk_with_cobol/gcc/cobol/cobcbei.c:468: error: conflicting
types for 'tree_code_type'

which come from nested macros in gcc code.

Is there an easy way (such as defining an environment variable in the
build environment) to get the gcc build system to show the
preprocessed code to help backtrack the problem?

If not, any ideas to avoid laborious file-at-a-time handling?

Thanks.

-Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Debugging Macros
  2008-01-24  8:29 Debugging Macros Tom Browder
@ 2008-01-24  8:46 ` Andrew Haley
  2008-01-24 11:18   ` Tom Browder
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Haley @ 2008-01-24  8:46 UTC (permalink / raw)
  To: Tom Browder; +Cc: gcc-help

Tom Browder wrote:
> I'm trying to debug a gcc frontend (cobol for gcc) and get errors such as:
> 
> ../../gcctrunk_with_cobol/gcc/cobol/cobcbei.c:462: error: invalid
> application of 'sizeof' to incomplete type 'struct lang_identifier'
> ../../gcctrunk_with_cobol/gcc/cobol/cobcbei.c:462: error: 'getdecls'
> undeclared here (not in a function)
> ../../gcctrunk_with_cobol/gcc/cobol/cobcbei.c:468: error: conflicting
> types for 'tree_code_type'
> 
> which come from nested macros in gcc code.
> 
> Is there an easy way (such as defining an environment variable in the
> build environment) to get the gcc build system to show the
> preprocessed code to help backtrack the problem?

Set your CC when running make: "make CC='gcc -g -save-temps -Wp,-dD ...'

This will give you all macro definitions, expanded in .i files.

For extra credit, run the .i files through GNU indent.

Andrew.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Debugging Macros
  2008-01-24  8:46 ` Andrew Haley
@ 2008-01-24 11:18   ` Tom Browder
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Browder @ 2008-01-24 11:18 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-help

On Jan 23, 2008 6:13 AM, Andrew Haley <aph@redhat.com> wrote:
> Tom Browder wrote:
...
> > Is there an easy way (such as defining an environment variable in the
> > build environment) to get the gcc build system to show the
> > preprocessed code to help backtrack the problem?
...
> Set your CC when running make: "make CC='gcc -g -save-temps -Wp,-dD ...'
>
> This will give you all macro definitions, expanded in .i files.
>
> For extra credit, run the .i files through GNU indent.

Thanks, Andrew.

-Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-23 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-24  8:29 Debugging Macros Tom Browder
2008-01-24  8:46 ` Andrew Haley
2008-01-24 11:18   ` Tom Browder

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).