Commit 1946537b by Jason Merrill Committed by Jason Merrill

input.c (feed_input): Add file, line parms.

	* input.c (feed_input): Add file, line parms.
	* lex.c (begin_definition_of_inclass_inline, feed_defarg): Adjust.
	(real_yylex): Check linemode before input_redirected().

	* typeck.c (c_expand_return): Downgrade pedwarn about returning NULL
	from op new to warning.

From-SVN: r28276
parent e7f9deae
1999-07-26 Jason Merrill <jason@yorick.cygnus.com>
* input.c (feed_input): Add file, line parms.
* lex.c (begin_definition_of_inclass_inline, feed_defarg): Adjust.
(real_yylex): Check linemode before input_redirected().
* typeck.c (c_expand_return): Downgrade pedwarn about returning NULL
from op new to warning.
1999-07-26 Mark Mitchell <mark@codesourcery.com> 1999-07-26 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (ncp_convert): Rename to perform_implicit_conversion. * cp-tree.h (ncp_convert): Rename to perform_implicit_conversion.
......
...@@ -69,7 +69,7 @@ extern unsigned char *yy_cur, *yy_lim; ...@@ -69,7 +69,7 @@ extern unsigned char *yy_cur, *yy_lim;
extern int yy_get_token (); extern int yy_get_token ();
#endif #endif
extern void feed_input PROTO((char *, int)); extern void feed_input PROTO((char *, int, char *, int));
extern void put_input PROTO((int)); extern void put_input PROTO((int));
extern void put_back PROTO((int)); extern void put_back PROTO((int));
extern int getch PROTO((void)); extern int getch PROTO((void));
...@@ -110,9 +110,11 @@ free_input (inp) ...@@ -110,9 +110,11 @@ free_input (inp)
inline inline
void void
feed_input (str, len) feed_input (str, len, file, line)
char *str; char *str;
int len; int len;
char *file;
int line;
{ {
struct input_source *inp = allocate_input (); struct input_source *inp = allocate_input ();
...@@ -126,6 +128,9 @@ feed_input (str, len) ...@@ -126,6 +128,9 @@ feed_input (str, len)
my_friendly_abort (990710); my_friendly_abort (990710);
cpp_push_buffer (&parse_in, str, len); cpp_push_buffer (&parse_in, str, len);
CPP_BUFFER (&parse_in)->manual_pop = 1; CPP_BUFFER (&parse_in)->manual_pop = 1;
CPP_BUFFER (&parse_in)->nominal_fname
= CPP_BUFFER (&parse_in)->fname = file;
CPP_BUFFER (&parse_in)->lineno = line;
#else #else
inp->str = str; inp->str = str;
inp->length = len; inp->length = len;
...@@ -134,6 +139,8 @@ feed_input (str, len) ...@@ -134,6 +139,8 @@ feed_input (str, len)
putback.buffer = NULL; putback.buffer = NULL;
putback.buffer_size = 0; putback.buffer_size = 0;
putback.index = -1; putback.index = -1;
lineno = line;
input_filename = file;
#endif #endif
inp->next = input; inp->next = input;
inp->filename = input_filename; inp->filename = input_filename;
......
...@@ -1266,9 +1266,7 @@ begin_definition_of_inclass_inline (pi) ...@@ -1266,9 +1266,7 @@ begin_definition_of_inclass_inline (pi)
if (context) if (context)
push_cp_function_context (context); push_cp_function_context (context);
feed_input (pi->buf, pi->len); feed_input (pi->buf, pi->len, pi->filename, pi->lineno);
lineno = pi->lineno;
input_filename = pi->filename;
yychar = PRE_PARSED_FUNCTION_DECL; yychar = PRE_PARSED_FUNCTION_DECL;
yylval.ttype = build_tree_list ((tree) pi, pi->fndecl); yylval.ttype = build_tree_list ((tree) pi, pi->fndecl);
/* Pass back a handle to the rest of the inline functions, so that they /* Pass back a handle to the rest of the inline functions, so that they
...@@ -1878,12 +1876,20 @@ feed_defarg (f, p) ...@@ -1878,12 +1876,20 @@ feed_defarg (f, p)
tree f, p; tree f, p;
{ {
tree d = TREE_PURPOSE (p); tree d = TREE_PURPOSE (p);
feed_input (DEFARG_POINTER (d), DEFARG_LENGTH (d)); char *file;
int line;
if (TREE_CODE (f) == FUNCTION_DECL) if (TREE_CODE (f) == FUNCTION_DECL)
{ {
lineno = DECL_SOURCE_LINE (f); line = DECL_SOURCE_LINE (f);
input_filename = DECL_SOURCE_FILE (f); file = DECL_SOURCE_FILE (f);
} }
else
{
line = lineno;
file = input_filename;
}
feed_input (DEFARG_POINTER (d), DEFARG_LENGTH (d), file, line);
yychar = DEFARG_MARKER; yychar = DEFARG_MARKER;
yylval.ttype = p; yylval.ttype = p;
} }
...@@ -3557,10 +3563,10 @@ real_yylex () ...@@ -3557,10 +3563,10 @@ real_yylex ()
case EOF: case EOF:
end_of_file = 1; end_of_file = 1;
token_buffer[0] = 0; token_buffer[0] = 0;
if (input_redirected ()) if (linemode)
value = END_OF_SAVED_INPUT;
else if (linemode)
value = END_OF_LINE; value = END_OF_LINE;
else if (input_redirected ())
value = END_OF_SAVED_INPUT;
else else
value = ENDFILE; value = ENDFILE;
break; break;
......
...@@ -6757,7 +6757,7 @@ c_expand_return (retval) ...@@ -6757,7 +6757,7 @@ c_expand_return (retval)
|| DECL_NAME (current_function_decl) == ansi_opname[(int) VEC_NEW_EXPR]) || DECL_NAME (current_function_decl) == ansi_opname[(int) VEC_NEW_EXPR])
&& !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl)) && !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
&& null_ptr_cst_p (retval)) && null_ptr_cst_p (retval))
cp_pedwarn ("operator new should throw an exception, not return NULL"); cp_warning ("operator new should throw an exception, not return NULL");
if (retval == NULL_TREE) if (retval == NULL_TREE)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment