Commit c36ee164 by Neil Booth Committed by Neil Booth

tradcpp.c (special_symbol): Improve test for definedness, though it is still not perfect.

       * tradcpp.c (special_symbol): Improve test for definedness,
        though it is still not perfect.
        (do_define): Don't define illegal macro names.

From-SVN: r38230
parent 04fd40b9
2000-12-13 Neil Booth <neil@daikokuya.demon.co.uk>
* tradcpp.c (special_symbol): Improve test for definedness,
though it is still not perfect.
(do_define): Don't define illegal macro names.
2000-12-07 Aldy Hernandez <aldyh@redhat.com>
* config/mips/elf.h (ASM_OUTPUT_SECTION_NAME): emit @nobits
......
......@@ -2160,8 +2160,12 @@ special_symbol (hp, op)
if (!is_idstart (*ip->bufp))
goto oops;
if (lookup (ip->bufp, -1, -1))
buf = " 1 ";
{
HASHNODE *hp = lookup (ip->bufp, -1, -1);
if (hp && hp->type != T_UNUSED && hp->type != T_SPEC_DEFINED)
buf = " 1 ";
}
while (is_idchar (*ip->bufp))
++ip->bufp;
SKIP_WHITE_SPACE (ip->bufp);
......@@ -2509,16 +2513,23 @@ do_define (buf, limit, op)
}
sym_length = bp - symname;
if (sym_length == 0)
error ("invalid macro name");
{
error ("invalid macro name");
return;
}
else if (!is_idstart (*symname)) {
U_CHAR *msg; /* what pain... */
msg = (U_CHAR *) alloca (sym_length + 1);
memcpy (msg, symname, sym_length);
msg[sym_length] = 0;
error ("invalid macro name `%s'", msg);
return;
} else {
if (! strncmp ((const char *)symname, "defined", 7) && sym_length == 7)
error ("defining `defined' as a macro");
{
error ("\"defined\" cannot be used as a macro name");
return;
}
}
/* lossage will occur if identifiers or control keywords are broken
......
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