diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-16 22:02:09 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-16 22:02:09 +0000 |
commit | c86dbc5b5758a0e795c7a25570d27b862c96f3e3 (patch) | |
tree | c0452482f8196e8f1922c3e67ab111a544d838e0 /gcc/cpplib.c | |
parent | 614e0ab75213eed9ba31cf0752fbdbfba7e0f17a (diff) | |
download | gcc-c86dbc5b5758a0e795c7a25570d27b862c96f3e3.tar.gz |
* cppexp.c (lex): Use NODE_NAME and NODE_LEN.
* cpphash.c (_cpp_lookup_with_hash): Similarly.
* cpplex.c (cpp_ideq, parse_identifier, cpp_token_len,
cpp_spell_token, cpp_output_token): Similarly.
* cpplib.c (lex_macro_node, do_undef, do_pragma,
do_pragma_poison, parse_assertion, do_assert): Similarly.
* cppmacro.c (builtin_macro, parse_args, funlike_invocation_p,
save_parameter, _cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Similarly.
* cppmain.c (cb_define, cb_undef, dump_macro): Similarly.
* c-lex.c (cb_undef, c_lex): Similarly.
* fix-header.c (recognized_function): Similarly.
* cpplib.h (NODE_LEN, NODE_NAME): New.
(cpp_hashnode): Rename length len.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 97e0cf21fdd..b5bdd946600 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -454,7 +454,7 @@ lex_macro_node (pfile) else if (token.flags & NAMED_OP) cpp_error (pfile, "\"%s\" cannot be used as a macro name as it is an operator in C++", - token.val.node->name); + NODE_NAME (token.val.node)); else cpp_error (pfile, "macro names must be identifiers"); } @@ -464,8 +464,9 @@ lex_macro_node (pfile) /* In Objective C, some keywords begin with '@', but general identifiers do not, and you're not allowed to #define them. */ - if (node == pfile->spec_nodes.n_defined || node->name[0] == '@') - cpp_error (pfile, "\"%s\" cannot be used as a macro name", node->name); + if (node == pfile->spec_nodes.n_defined || NODE_NAME (node)[0] == '@') + cpp_error (pfile, "\"%s\" cannot be used as a macro name", + NODE_NAME (node)); else if (!(node->flags & NODE_POISONED)) return node; } @@ -503,7 +504,7 @@ do_undef (pfile) (*pfile->cb.undef) (pfile, node); if (node->flags & NODE_WARN) - cpp_warning (pfile, "undefining \"%s\"", node->name); + cpp_warning (pfile, "undefining \"%s\"", NODE_NAME (node)); _cpp_free_definition (node); } @@ -1031,9 +1032,6 @@ do_pragma (pfile) { const struct pragma_entry *p; cpp_token tok; - const cpp_hashnode *node; - const U_CHAR *name; - size_t len; int drop = 0; p = pfile->pragmas; @@ -1044,9 +1042,10 @@ do_pragma (pfile) cpp_get_token (pfile, &tok); if (tok.type == CPP_NAME) { - node = tok.val.node; - name = node->name; - len = node->length; + const cpp_hashnode *node = tok.val.node; + const U_CHAR *name = NODE_NAME (node); + size_t len = NODE_LEN (node); + while (p) { if (strlen (p->name) == len && !memcmp (p->name, name, len)) @@ -1114,7 +1113,7 @@ do_pragma_poison (pfile) continue; if (hp->type == NT_MACRO) - cpp_warning (pfile, "poisoning existing macro \"%s\"", hp->name); + cpp_warning (pfile, "poisoning existing macro \"%s\"", NODE_NAME (hp)); _cpp_free_definition (hp); hp->flags |= NODE_POISONED | NODE_DIAGNOSTIC; } @@ -1542,12 +1541,12 @@ parse_assertion (pfile, answerp, type) cpp_error (pfile, "predicate must be an identifier"); else if (parse_answer (pfile, answerp, type) == 0) { - unsigned int len = predicate.val.node->length; + unsigned int len = NODE_LEN (predicate.val.node); unsigned char *sym = alloca (len + 1); /* Prefix '#' to get it out of macro namespace. */ sym[0] = '#'; - memcpy (sym + 1, predicate.val.node->name, len); + memcpy (sym + 1, NODE_NAME (predicate.val.node), len); result = cpp_lookup (pfile, sym, len + 1); } @@ -1620,7 +1619,7 @@ do_assert (pfile) { if (*find_answer (node, new_answer)) { - cpp_warning (pfile, "\"%s\" re-asserted", node->name + 1); + cpp_warning (pfile, "\"%s\" re-asserted", NODE_NAME (node) + 1); return; } new_answer->next = node->value.answers; |