aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPer Bothner <pbothner@apple.com>2003-08-26 22:53:22 +0000
committerPer Bothner <bothner@gcc.gnu.org>2003-08-26 15:53:22 -0700
commitdc3786d833bc642b1d7e481eb947c1247eebf6d9 (patch)
tree4ae24f4c9ddb5a1cde65438aa13e8e99b3a74c7e /gcc
parenta85993787b6d4270ae5447eed498168a1c37642b (diff)
downloadgcc-dc3786d833bc642b1d7e481eb947c1247eebf6d9.zip
gcc-dc3786d833bc642b1d7e481eb947c1247eebf6d9.tar.gz
gcc-dc3786d833bc642b1d7e481eb947c1247eebf6d9.tar.bz2
Copy over from cs branch:
* cpplib.h (struct cpp_token): Change type of field line to fileline. (cpp_error_with_line): Use fileline for appropriate parameter. * cpphash.h (struct cpp_macro): Change type of field line to fileline. (struct cpp_reader): Likewise for fields line and directive_line. (_cpp_begin_message): Use fileline for appropriate parameter. * cpperror.c (print_location, _cpp_begin_message, cpp_error_with_line, cpp_error): Use fileline for appropriate parameters and variables. (print_location): New local lin, since it is not a fileline. From-SVN: r70826
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cpperror.c20
-rw-r--r--gcc/cpphash.h8
-rw-r--r--gcc/cpplib.h6
4 files changed, 29 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6830aee..cedfc01 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2003-08-26 Per Bothner <pbothner@apple.com>
+
+ * cpplib.h (struct cpp_token): Change type of field line to fileline.
+ (cpp_error_with_line): Use fileline for appropriate parameter.
+ * cpphash.h (struct cpp_macro): Change type of field line to fileline.
+ (struct cpp_reader): Likewise for fields line and directive_line.
+ (_cpp_begin_message): Use fileline for appropriate parameter.
+ * cpperror.c (print_location, _cpp_begin_message, cpp_error_with_line,
+ cpp_error): Use fileline for appropriate parameters and variables.
+ (print_location): New local lin, since it is not a fileline.
+
2003-08-26 Roger Sayle <roger@eyesopen.com>
PR middle-end/12002
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index 310631d..4eed951 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -29,34 +29,35 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpphash.h"
#include "intl.h"
-static void print_location (cpp_reader *, unsigned int, unsigned int);
+static void print_location (cpp_reader *, fileline, unsigned int);
/* Print the logical file location (LINE, COL) in preparation for a
diagnostic. Outputs the #include chain if it has changed. A line
of zero suppresses the include stack, and outputs the program name
instead. */
static void
-print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
+print_location (cpp_reader *pfile, fileline line, unsigned int col)
{
if (!pfile->buffer || line == 0)
fprintf (stderr, "%s: ", progname);
else
{
const struct line_map *map;
+ unsigned int lin;
map = linemap_lookup (&pfile->line_maps, line);
linemap_print_containing_files (&pfile->line_maps, map);
- line = SOURCE_LINE (map, line);
+ lin = SOURCE_LINE (map, line);
if (col == 0)
col = 1;
- if (line == 0)
+ if (lin == 0)
fprintf (stderr, "%s:", map->to_file);
else if (CPP_OPTION (pfile, show_column) == 0)
- fprintf (stderr, "%s:%u:", map->to_file, line);
+ fprintf (stderr, "%s:%u:", map->to_file, lin);
else
- fprintf (stderr, "%s:%u:%u:", map->to_file, line, col);
+ fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col);
fputc (' ', stderr);
}
@@ -68,7 +69,7 @@ print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
the correct place by default. Returns 0 if the error has been
suppressed. */
int
-_cpp_begin_message (cpp_reader *pfile, int code, unsigned int line,
+_cpp_begin_message (cpp_reader *pfile, int code, fileline line,
unsigned int column)
{
int level = DL_EXTRACT (code);
@@ -124,7 +125,8 @@ _cpp_begin_message (cpp_reader *pfile, int code, unsigned int line,
void
cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
{
- unsigned int line, column;
+ fileline line;
+ unsigned int column;
va_list ap;
va_start (ap, msgid);
@@ -157,7 +159,7 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
/* Print an error at a specific location. */
void
cpp_error_with_line (cpp_reader *pfile, int level,
- unsigned int line, unsigned int column,
+ fileline line, unsigned int column,
const char *msgid, ...)
{
va_list ap;
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 8b8f3d8..e6eadce 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -100,7 +100,7 @@ struct cpp_macro
} exp;
/* Definition line number. */
- unsigned int line;
+ fileline line;
/* Number of tokens in expansion, or bytes for traditional macros. */
unsigned int count;
@@ -337,10 +337,10 @@ struct cpp_reader
/* Source line tracking. */
struct line_maps line_maps;
const struct line_map *map;
- unsigned int line;
+ fileline line;
/* The line of the '#' of the current directive. */
- unsigned int directive_line;
+ fileline directive_line;
/* Memory buffers. */
_cpp_buff *a_buff; /* Aligned permanent storage. */
@@ -497,7 +497,7 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
#define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, warn_traditional)
/* In cpperror.c */
-extern int _cpp_begin_message (cpp_reader *, int, unsigned int, unsigned int);
+extern int _cpp_begin_message (cpp_reader *, int, fileline, unsigned int);
/* In cppmacro.c */
extern void _cpp_free_definition (cpp_hashnode *);
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index b63f363..fdd9a4e 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -174,7 +174,7 @@ struct cpp_string
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
struct cpp_token
{
- unsigned int line; /* Logical line of first char of token. */
+ fileline line; /* Logical line of first char of token. */
unsigned short col; /* Column of first char of token. */
ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
unsigned char flags; /* flags - see above */
@@ -680,8 +680,8 @@ extern void cpp_errno (cpp_reader *, int, const char *msgid);
/* Same as cpp_error, except additionally specifies a position as a
(translation unit) physical line and physical column. If the line is
zero, then no location is printed. */
-extern void cpp_error_with_line (cpp_reader *, int, unsigned, unsigned, const char *msgid, ...)
- ATTRIBUTE_PRINTF_5;
+extern void cpp_error_with_line (cpp_reader *, int, fileline, unsigned,
+ const char *msgid, ...) ATTRIBUTE_PRINTF_5;
/* In cpplex.c */
extern int cpp_ideq (const cpp_token *, const char *);