This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi. Here is updated version of the patch. All pragmas except internal are tokenized and inserted into the token stream. For #pragma GCC visibility ... new-line we get: CPP_PRAGMA GCC visibility ... CPP_EOF new-line. CPP_PRAGMA payload is a pointer to handler. c_lex is a pointer to function which is used by pragma handlers to get tokens. So no changes in pragma handlers is required. C parser was updated to handle CPP_PRAGMA tokens like C++ parser. c_register_pragma_with expansion was removed and flags were added to c_register_pragma (fixes PR 18637), this requires trivial changes in REGISTER_TARGET_PRAGMAS macro. Also PR 18638 should be fixed (need testing). Bootstrapped on i686-unknown-linux-gnu. cc1 was built for arm-unknown-linux-gnu, c4x-unknown-gnu-linux, powerpc-apple-darwin7.6.0, sparc64-sun-solaris2.9. I think there is no need to build it for other targets with target pragmas, because all the changes are similar and obvious. OK for mainline? FYI I got bootstrap failure on gcc/version.c: gcc: cannot specify -o with -c or -S and multiple compilations Fixed by removing two spaces in gcc/Makefile.in in DEVPHASE_s and DATESTAMP_s variables, and adding them in gcc/version.c in version string variable. -- Dmitry gcc/ChangeLog: 2005-04-12 Dmitry Kurochkin <dmitry.kurochkin@gmail.com> PR c/18367 and c++/18638 * c-lex.c (c_lex_direct): New function. (c_lex_with_flags): New arg HANDLER. All callers changed. (c_lex): Pointer to c_lex_direct. * c-parser.c (c_token): New fields FLAGS and HANDLER. (c_lex_one_token, c_parser_error, c_parser_declaration_or_fndef) (c_parser_struct_or_union_specifier, c_parser_statement): Handle CPP_PRAGMA token. (c_parser_handle_pragma, c_pragma_lex): New function. * c-pragma.c (c_register_pragma): New args ALLOW_EXPANSION and ALLOW_NAME_EXPANSION. All callers changed. (c_register_pragma_with_expansion): Remove function. All callers changed. * c-pragma.h (c_register_pragma_with_expansion): Remove declaration. (c_lex, c_lex_with_flags): Change declaration. * doc/tm.texi (REGISTER_TARGET_PRAGMAS): Update. gcc/cp/ChangeLog: 2005-04-12 Dmitry Kurochkin <dmitry.kurochkin@gmail.com> PR c++/18368 * lex.c (init_cp_pragma): Changed calls to c_register_pragma. * parser.c (cp_token): New fields IN_PRAGMA and HANDLER. (eof_token): Initialize new fields. (cp_lex): New function. (cp_lexer_new_main): Remove setting of defer_pragmas option. (cp_lexer_get_preprocessor_token, cp_parser_error): Handle CPP_PRAGMA token. (cp_lexer_handle_pragma): Rewrite function. (cp_lex): New function. libcpp/ChangeLog: 2005-04-12 Dmitry Kurochkin <dmitry.kurochkin@gmail.com> PR c++/18638 * directives.c (pragma_cb): Move typedef to include/cpplib.h. (_cpp_handle_directive): Handle pragmas. (insert_pragma_entry): New arg IS_NAMESPACE. All callers changed. (register_pragma): New arg ALLOW_NAME_EXPANSION. All callers changed. (do_pragma): Changed pragma handling. (cpp_handle_deferred_pragma): Remove function. * include/cpplib.h (TTYPE_TABLE): Update comment. (PRAGMA_NSPACE): New CPP token flag. (cpp_token_fld_kind): New enum CPP_TOKEN_FLD_PRAGMA_HANDLER. (pragma_cb): Move typedef from directives.c. (cpp_token): New field HANDLER in VAL union. (cpp_options): Remove DEFER_PRAGMAS field. (cpp_register_pragma): Change declaration. (cpp_handle_deferred_pragma): Remove declaration. * libcpp/internal.h (lexer_state): Remove IN_DEFERRED_PRAGMA field. Add IN_TOKEN_PRAGMA field. (cpp_reader): New field PRAGMA_NSPACE. * init.c (cpp_create_reader): Initialize PRAGMA_NSPACE field. * lex.c (_cpp_lex_token, _cpp_lex_direct): Change pragma handling. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA_HANDLER for CPP_PRAGMA token. * macro.c (cpp_get_token): Change pragma handling.
Attachment:
DIFF
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |