mirror of git://gcc.gnu.org/git/gcc.git
cppmain.c (check_multiline_token): New function.
* cppmain.c (check_multiline_token): New function.
(scan_buffer): Use it.
(cb_change_file): Restructure to avoid warning.
* cpperror.c (print_location): Initialize col.
From-SVN: r38332
This commit is contained in:
parent
04650349da
commit
dfbf62ec3d
|
|
@ -1,3 +1,10 @@
|
||||||
|
2000-12-17 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* cppmain.c (check_multiline_token): New function.
|
||||||
|
(scan_buffer): Use it.
|
||||||
|
(cb_change_file): Restructure to avoid warning.
|
||||||
|
* cpperror.c (print_location): Initialize col.
|
||||||
|
|
||||||
2000-12-14 Philipp Thomas <pthomas@suse.de>
|
2000-12-14 Philipp Thomas <pthomas@suse.de>
|
||||||
* protoize.c (main): Correctly set locale categories.
|
* protoize.c (main): Correctly set locale categories.
|
||||||
* gcc.c (main): Likewise.
|
* gcc.c (main): Likewise.
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ print_location (pfile, filename, pos)
|
||||||
fprintf (stderr, "%s: ", progname);
|
fprintf (stderr, "%s: ", progname);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int line, col;
|
unsigned int line, col = 0;
|
||||||
enum cpp_buffer_type type = buffer->type;
|
enum cpp_buffer_type type = buffer->type;
|
||||||
|
|
||||||
/* For _Pragma buffers, we want to print the location as
|
/* For _Pragma buffers, we want to print the location as
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ static void setup_callbacks PARAMS ((void));
|
||||||
|
|
||||||
/* General output routines. */
|
/* General output routines. */
|
||||||
static void scan_buffer PARAMS ((cpp_reader *));
|
static void scan_buffer PARAMS ((cpp_reader *));
|
||||||
|
static void check_multiline_token PARAMS ((cpp_string *));
|
||||||
static int printer_init PARAMS ((cpp_reader *));
|
static int printer_init PARAMS ((cpp_reader *));
|
||||||
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
|
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
|
||||||
|
|
||||||
|
|
@ -218,11 +219,26 @@ scan_buffer (pfile)
|
||||||
|
|
||||||
cpp_output_token (token, print.outf);
|
cpp_output_token (token, print.outf);
|
||||||
print.printed = 1;
|
print.printed = 1;
|
||||||
|
if (token->type == CPP_STRING || token->type == CPP_WSTRING
|
||||||
|
|| token->type == CPP_COMMENT)
|
||||||
|
check_multiline_token (&token->val.str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (cpp_pop_buffer (pfile) != 0);
|
while (cpp_pop_buffer (pfile) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Adjust print.lineno for newlines embedded in tokens. */
|
||||||
|
static void
|
||||||
|
check_multiline_token (str)
|
||||||
|
cpp_string *str;
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < str->len; i++)
|
||||||
|
if (str->text[i] == '\n')
|
||||||
|
print.lineno++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize a cpp_printer structure. As a side effect, open the
|
/* Initialize a cpp_printer structure. As a side effect, open the
|
||||||
output file. */
|
output file. */
|
||||||
static int
|
static int
|
||||||
|
|
@ -362,8 +378,6 @@ cb_change_file (pfile, fc)
|
||||||
cpp_reader *pfile ATTRIBUTE_UNUSED;
|
cpp_reader *pfile ATTRIBUTE_UNUSED;
|
||||||
const cpp_file_change *fc;
|
const cpp_file_change *fc;
|
||||||
{
|
{
|
||||||
const char *flags;
|
|
||||||
|
|
||||||
/* Bring current file to correct line (except first file). */
|
/* Bring current file to correct line (except first file). */
|
||||||
if (fc->reason == FC_ENTER && fc->from.filename)
|
if (fc->reason == FC_ENTER && fc->from.filename)
|
||||||
maybe_print_line (fc->from.lineno);
|
maybe_print_line (fc->from.lineno);
|
||||||
|
|
@ -378,14 +392,13 @@ cb_change_file (pfile, fc)
|
||||||
|
|
||||||
if (print.lineno)
|
if (print.lineno)
|
||||||
{
|
{
|
||||||
print.lineno = fc->to.lineno;
|
const char *flags = "";
|
||||||
switch (fc->reason)
|
|
||||||
{
|
|
||||||
case FC_ENTER : flags = " 1"; break;
|
|
||||||
case FC_LEAVE : flags = " 2"; break;
|
|
||||||
case FC_RENAME: flags = ""; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
print.lineno = fc->to.lineno;
|
||||||
|
if (fc->reason == FC_ENTER)
|
||||||
|
flags = " 1";
|
||||||
|
else if (fc->reason == FC_LEAVE)
|
||||||
|
flags = " 2";
|
||||||
print_line (flags);
|
print_line (flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue