From 0f89df67fc5dbad0e6eb068f6facc4cbb0342c0d Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 22 Apr 2000 23:02:08 +0000 Subject: cpphash.c (trad_stringify, add_pat): New functions. * cpphash.c (trad_stringify, add_pat): New functions. (collect_expansion): Restore support for -traditional syntax. Use trad_stringify and add_pat. (_cpp_macroexpand): Restore support for -traditional semantics. * cpplex.c (_cpp_scan_line): Don't change space_before if we get a COMMENT token. (_cpp_lex_token): Provide COMMENT tokens to caller if traditional and parsing_define_directive. (skip_comment): Warn about // comments if -Wtraditional. * cpplib.c (do_define): Fix typo. Create EMPTY nodes with proper node type. (do_undef): Don't warn about undefining EMPTY nodes. From-SVN: r33350 --- gcc/cpplib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc/cpplib.c') diff --git a/gcc/cpplib.c b/gcc/cpplib.c index f881584..7f2554b 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -352,7 +352,7 @@ do_define (pfile) if (list->tokens_used == 2 && list->tokens[1].type == CPP_VSPACE) - empty = 0; /* Empty definition of object-like macro. */ + empty = 1; /* Empty definition of object-like macro. */ /* If the next character, with no intervening whitespace, is '(', then this is a function-like macro. Otherwise it is an object- @@ -425,7 +425,8 @@ do_define (pfile) } else { - HASHNODE *hp = _cpp_make_hashnode (sym, len, T_MACRO, hash); + HASHNODE *hp = _cpp_make_hashnode (sym, len, empty ? T_EMPTY : T_MACRO, + hash); hp->value.defn = def; *slot = hp; } @@ -768,7 +769,7 @@ do_undef (pfile) if (CPP_OPTION (pfile, debug_output)) pass_thru_directive (hp->name, len, pfile, T_UNDEF); - if (hp->type != T_MACRO) + if (hp->type != T_MACRO && hp->type != T_EMPTY) cpp_warning (pfile, "undefining `%s'", hp->name); htab_clear_slot (pfile->hashtab, (void **)slot); -- cgit v1.1