summaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
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 fe96d4ed376..1ce9bbfeca8 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)
{