This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to represent column numbers using source_location
Kazu Hirata wrote:
Unfortunately, this patch breaks h8300-elf. scan-decls.c:185 still
has a use of member "line" of cpp_token, which you have removed.
Would you mind taking a look at this?
From what I can tell of the code, the previous version was wrong,
in that it was passing a source_location cookie to a function that
expects an actual line number.
I.e. I suspect this code hasn't worked correctly for years, or
whenever token were changes to source line-map cookies.
Could you try this patch?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
Index: scan-decls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/scan-decls.c,v
retrieving revision 1.33
diff -u -p -r1.33 scan-decls.c
--- scan-decls.c 8 Oct 2003 12:29:27 -0000 1.33
+++ scan-decls.c 11 Feb 2004 23:34:36 -0000
@@ -23,6 +23,8 @@ Foundation, 59 Temple Place - Suite 330,
#include "coretypes.h"
#include "tm.h"
#include "cpplib.h"
+#include "cpphash.h"
+#include "line-map.h"
#include "scan.h"
static void skip_to_closing_brace (cpp_reader *);
@@ -165,6 +167,8 @@ scan_decls (cpp_reader *pfile, int argc
{
int nesting = 1;
int have_arg_list = 0;
+ const struct line_map *map;
+ unsigned int line;
for (;;)
{
token = get_a_token (pfile);
@@ -182,7 +186,9 @@ scan_decls (cpp_reader *pfile, int argc
|| token->type == CPP_ELLIPSIS)
have_arg_list = 1;
}
- recognized_function (&prev_id, token->line,
+ map = linemap_lookup (pfile->line_table, token->src_loc);
+ line = SOURCE_LINE (map, token->src_loc);
+ recognized_function (&prev_id, line,
(saw_inline ? 'I'
: in_extern_C_brace || current_extern_C
? 'F' : 'f'), have_arg_list);