This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36674] New: #include location is offset by one row in errors from preprocessed files
- From: "antalk at chello dot hu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jun 2008 21:45:05 -0000
- Subject: [Bug c/36674] New: #include location is offset by one row in errors from preprocessed files
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Given
--- main.h ---
not_declared_yet();
--- main.c ---
#include "main.h"
--- Makefile ---
all:
gcc --version
gcc -Wall -E -I. main.c > huhu.ii
-gcc -Wall -I. huhu.ii
gcc -Wall -I. main.c
----
make produces:
-------------------
make
gcc --version
gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc -Wall -E -I. main.c > huhu.ii
gcc -Wall -I. huhu.ii
In file included from main.c:2:
main.h:1: error: expected constructor, destructor, or type conversion before
â??;â?? token
make: [all] Error 1 (ignored)
gcc -Wall -I. main.c
In file included from main.c:1:
main.h:1: warning: data definition has no type or storage class
main.h:1: warning: type defaults to â??intâ?? in declaration of
â??not_declared_yetâ??
...(truncated)
-------------------
That is 'In file included from main.c:2:' instead of main.cc:1: when
the file is preprocessed first.
---- huhu.ii contains ---
# 1 "main.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "main.c"
# 1 "main.h" 1
not_declared_yet();
# 1 "main.c" 2
-------------------------
--
Summary: #include location is offset by one row in errors from
preprocessed files
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: antalk at chello dot hu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36674