aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2000-08-04 01:30:06 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-08-04 01:30:06 +0000
commitba89d661ac573f2402fa4f3b4cb117c8c74968e2 (patch)
tree254d84e8b966d54bb05be43ebe0b47a16be7a4ea /gcc/cpplib.c
parentd31772ca70b9d2a315372456bfdf343c3806a3f8 (diff)
downloadgcc-ba89d661ac573f2402fa4f3b4cb117c8c74968e2.zip
gcc-ba89d661ac573f2402fa4f3b4cb117c8c74968e2.tar.gz
gcc-ba89d661ac573f2402fa4f3b4cb117c8c74968e2.tar.bz2
cpplex.c (parse_name): Might have to glue a CPP_OTHER token before the name.
* cpplex.c (parse_name): Might have to glue a CPP_OTHER token before the name. (lex_line): Glue @ onto the beginning of identifiers and string constants, in Objective-C mode. (output_token, spell_token): Handle CPP_OSTRING. (can_paste, maybe_paste_with_next): Handle pasting @ onto the beginning of a NAME or a STRING, in objc mode. * cpplib.c (get_define_node): Do not permit identifiers that begin with @ to be #defined. * cppmacro.c (CAN_PASTE_AFTER): Add CPP_OTHER. * cpplib.h (TTYPE_TABLE): Add CPP_OSTRING. * c-lang.c, objc/objc-act.c (build_objc_string): Delete. * c-tree.h (build_objc_string): Delete prototype. * objc/objc-tree.def: Delete OBJC_STRING_CST. * c-lex.c (yylex): Use build_string for all three kinds of strings. * gcc.dg/cpp/20000625-2.c: Don't expect a warning on line 4. From-SVN: r35470
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index fe96d4e..1ce9bbf 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -242,6 +242,16 @@ get_define_node (pfile)
return 0;
}
+ /* In Objective C, some keywords begin with '@', but general identifiers
+ do not, and you're not allowed to #define them. */
+ if (token->val.node->name[0] == '@')
+ {
+ cpp_error_with_line (pfile, token->line, token->col,
+ "\"%s\" cannot be used as a macro name",
+ token->val.node->name);
+ return 0;
+ }
+
/* Check for poisoned identifiers now. */
if (token->val.node->type == T_POISON)
{