Commit ed195be9 authored by zack's avatar zack
Browse files

* cppexp.c (lex): Use %.*s to print non-NUL-terminated string.

	Make error message friendlier.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33829 138bc75d-0d04-0410-961f-82ee72b054a4
parent c82695ab
2000-05-10 Zack Weinberg <zack@wolery.cumb.org>
 
* cppexp.c (lex): Use %.*s to print non-NUL-terminated string.
Make error message friendlier.
* cpphash.h (struct hashnode): Use struct hack for name
member.
* cpphash.c (struct hashdummy): New.
......
......@@ -466,8 +466,8 @@ lex (pfile, skip_evaluation)
&& tok_start[1] == toktab->operator[1])
break;
if (toktab->token == ERROR)
cpp_error (pfile, "'%s' not allowed in operand of #if",
tok_start);
cpp_error (pfile, "'%.*s' is not allowed in #if expressions",
(int) (tok_end - tok_start), tok_start);
op.op = toktab->token;
return op;
}
......
/* Regression test for proper error message. The token name isn't
NUL terminated, so we would print garbage after it. */
/* { dg-do compile } */
#if 1 += 2 /* { dg-error "'\\+=' is not allowed" "+= in if" } */
syntax_error
#endif
int foo;
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