This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
include file stack display too late
- To: egcs-bugs at cygnus dot com
- Subject: include file stack display too late
- From: Bruno Haible <haible at ilog dot fr>
- Date: Wed, 3 Feb 1999 22:29:54 +0100 (MET)
Hi,
When gcc displays an error message or warning, it also displays (for the
first such message occurring in an include file) the inclusion stack.
In some cases, however, this inclusion stack comes too late. In the
example below, `foo21' does not trigger it, but `foo11' and `foo22' do.
$ gcc -v
Reading specs from /packages/gnu/lib/gcc-lib/i486-pc-linux-gnulibc1/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
$ gcc -S -Wall foo.c
foo1.c: In function `foo11':
In file included from foo.c:1:
foo1.c:1: warning: label `x' defined but not used
foo1.c: In function `foo12':
foo1.c:2: warning: label `x' defined but not used
foo2.c: In function `foo21':
foo2.c:1: warning: label `x' defined but not used
foo2.c: In function `foo22':
In file included from foo.c:2:
foo2.c:13: warning: label `x' defined but not used
======================== foo.c ===========================
#include "foo1.c"
#include "foo2.c"
======================== foo1.c ==========================
void foo11 () { x: ; }
void foo12 () { x: ; }
======================== foo2.c ==========================
void foo21 () { x:
#if 0
this here is removed by the preprocessor
#endif
;
}
void foo22 () { x: ; }
===================== gcc -E foo.c =======================
# 1 "foo.c"
# 1 "foo1.c" 1
void foo11 () { x: ; }
void foo12 () { x: ; }
# 1 "foo.c" 2
# 1 "foo2.c" 1
void foo21 () { x:
# 10 "foo2.c"
;
}
void foo22 () { x: ; }
# 2 "foo.c" 2
==========================================================
I don't know whether it's a problem in the preprocessor or in toplev.c.
----------------------------------------------------------------------------
Bruno Haible email: <haible@ilog.fr>
ILOG S.A. tel: +33 1 4908 3585
9, rue de Verdun - BP 85 fax: +33 1 4908 3510
94253 Gentilly Cedex url: http://www.ilog.fr/
France running Sparc-Linux-BSD-GNU-X11-KDE