gcc/gcc/c-pragma.h

111 lines
3.5 KiB
C
Raw Normal View History

/* Pragma related interfaces.
Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
This file is part of GCC.
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
along with GCC; see the file COPYING. If not, write to the Free
2005-06-25 04:02:01 +02:00
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifndef GCC_C_PRAGMA_H
#define GCC_C_PRAGMA_H
#include <cpplib.h> /* For enum cpp_ttype. */
directives.c (struct pragma_entry): Add is_deferred. libcpp/ * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. gcc/ * c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id via integer constant. (pragma_lex): Remove. * c-pch.c (c_common_pch_pragma): Accept the name as an argument, rather than parsing it. * c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname, handle_pragma_extern_prefix): Add %< %> quotes. (registered_pragmas): New. (c_register_pragma_1): New. (c_register_pragma): Use it. (c_register_pragma_with_expansion): Likewise. (c_invoke_pragma_handler): New. (init_pragma): Use cpp_register_deferred_pragma directly for pch_preprocess. * c-pragma.h (enum pragma_kind): New. (pragma_handler): New. (c_invoke_pragma_handler): Declare. * c-common.c (c_parse_error): Pretty print CPP_PRAGMA and CPP_PRAGMA_EOL. * c-common.h (c_common_pch_pragma): Update decl. * Makefile.in (c-parser.o): Update dependencies. (GTFILES): Add c-pragma.h. * c-parser.c (struct c_token): Add pragma_kind. (struct c_parser): Add in_pragma. (c_lex_one_token): Always initialize keyword and pragma_kind. Extract data for CPP_PRAGMA. (c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL. (c_parser_consume_token): Don't allow CPP_PRAGMA unless errors. Don't allow CPP_PRAGMA_EOL if in_pragma. (c_parser_consume_pragma): New. (c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL. (c_parser_skip_to_end_of_parameter): Likewise. (c_parser_skip_to_end_of_block_or_statement): Likewise. (c_parser_skip_to_pragma_eol): New. (c_parser_external_declaration): Handle CPP_PRAGMA. (c_parser_compound_statement_nostart): Likewise. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): New. (pragma_lex): Likewise. (c_parser_pragma_pch_preprocess): New. (c_parser_new): Merge into ... (c_parse_file): ... here. Call c_parser_pragma_pch_preprocess. gcc/cp/ * lex.c (handle_pragma_java_exceptions): Fix whitespace. * parser.c (struct cp_token): Add pragma_kind. (eof_token): Update to match. (struct cp_lexer): Add in_pragma; rearrange next for better packing. (cp_parser_initial_pragma): New. (cp_lexer_new_main): Use it. Don't bother clearing c_lex_return_raw_strings. (cp_lexer_get_preprocessor_token): Always initialize keyword and pragma_kind fields. Handle CPP_PRAGMA. (cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when in_pragma is set. (cp_lexer_handle_pragma): Remove. Update callers to cp_parser_pragma. (cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string. (cp_parser_skip_to_pragma_eol): New. (cp_parser_error): Use it. (cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL; rearrange with switch statement. (cp_parser_skip_to_end_of_statement): Likewise. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_skip_to_closing_brace): Likewise. (cp_parser_skip_until_found): Likewise. (cp_parser_statement): Add in_compound argument; update callers. Use it to decide how to handle pragma parsing. (cp_parser_labeled_statement): Add in_compound argument; pass it on to cp_parser_statement. (cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_function_definition_after_decl): Likewise. (cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs. (cp_parser_pragma): New. (pragma_lex): New. gcc/testsuite/ * g++.dg/parse/pragma2.C: Update expected error lines. From-SVN: r109336
2006-01-04 17:33:38 +01:00
/* Pragma identifiers built in to the front end parsers. Identifiers
for anciliary handlers will follow these. */
typedef enum pragma_kind {
PRAGMA_NONE = 0,
[multiple changes] 2006-01-18 Richard Henderson <rth@redhat.com> Jakub Jelinek <jakub@redhat.com> Diego Novillo <dnovillo@redhat.com> * libgomp: New directory. * Makefile.def: Add target_module libgomp. * Makefile.in: Regenerate. * configure.in (target_libraries): Add target-libgomp. * configure: Regenerate. contrib/ 2006-01-18 Richard Henderson <rth@redhat.com> Diego Novillo <dnovillo@redhat.com> * gcc_update (files_and_dependencies): Add libgomp files. gcc/ 2006-01-18 Richard Henderson <rth@redhat.com> Aldy Hernandez <aldyh@redhat.com> Jakub Jelinek <jakub@redhat.com> Diego Novillo <dnovillo@redhat.com> * omp-low.c: New file. * c-omp.c: New file. 2006-01-18 Richard Henderson <rth@redhat.com> Jakub Jelinek <jakub@redhat.com> Diego Novillo <dnovillo@redhat.com> * doc/invoke.texi: Document -fopenmp. * tree-dump.h (debug_function): Declare. * hooks.c (hook_bool_tree_bool_false): New function. (hook_tree_tree_null): Remove. (hook_tree_tree_tree_null): New. * hooks.h: Update to match. * tree-pretty-print.c (debug_tree_chain): New. (print_generic_expr): Handle TDF_CHAIN. (dump_generic_node): Handle BLOCK. Do not abort with incomplete SWITCH_EXPRs. Do not dump body of an OpenMP directive if TDF_SLIM is given. <case OMP_PARALLEL, OMP_FOR, OMP_SECTIONS>: Don't print space after directive name. <OMP_FOR>: Handle printing OMP_FOR_PRE_BODY. Handle OMP_MASTER and OMP_ORDERED. Handle printing of OMP_BODY just in one place, goto dump_omp_body in the rest of OMP_* nodes that have OMP_BODY. Don't handle clause nodes here. Update omp statements to use dump_omp_clauses. Handle OMP_SINGLE, OMP_SECTIONS, OMP_SECTION, OMP_CLAUSE_ORDERED, OMP_CLAUSE_SCHEDULE, OMP_ATOMIC, OMP_CRITICAL, OMP_CLAUSE_NOWAIT, GOMP_CLAUSE_IF, GOMP_CLAUSE_NUM_THREADS, GOMP_FOR, GOMP_CLAUSE_SHARED, GOMP_CLAUSE_FIRSTPRIVATE, GOMP_CLAUSE_LASTPRIVATE, GOMP_CLAUSE_COPYIN and GOMP_CLAUSE_COPYPRIVATE. Adjust output for GOMP_PARALLEL. (dump_omp_clauses): New. (print_declaration): Dump DECL_VALUE_EXPR. (op_symbol_1): Split out of op_symbol. (dumping_stmts): Remove. Update all users. * cgraph.c (cgraph_analyze_queue): New. (cgraph_add_new_function): New. * cgraph.h (cgraph_analyze_queue): Declare. (cgraph_add_new_function): Declare. (cgraph_lower_function): Remove. * tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN of OMP_CLAUSE_* nodes. Use switch for all nodes, handle most of IS_EXPR_CODE_CLASS and TYPE_P nodes in its default clause. (empty_body_p): New. (tree_range_check_failed): New. (build5_stat): New. * tree.h (OMP_CLAUSE_REDUCTION_INIT, OMP_CLAUSE_REDUCTION_MERGE, OMP_CLAUSE_REDUCTION_PLACEHOLDER, OMP_CLAUSE_PRIVATE_DEBUG, OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE, OMP_FOR_PRE_BODY, OMP_MASTER_BODY, OMP_ORDERED_BODY OMP_BODY, OMP_CLAUSES, OMP_CLAUSE_DECL, OMP_CLAUSE_DEFAULT_KIND, OMP_CLAUSE_CHAIN, OMP_CLAUSE_OUTER_DECL, OMP_CLAUSE_INNER_DECL, OMP_CLAUSE_NUM_THREADS_EXPR, OMP_CLAUSE_IF_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_SIZE. OMP_PARALLEL_VAR_INIT, OMP_PARALLEL_VAR_REDUC, OMP_FOR_VAR_INIT, OMP_FOR_VAR_LAST, OMP_FOR_VAR_REDUC, OMP_SECTIONS_VAR_INIT, OMP_SECTIONS_VAR_LAST, OMP_SECTIONS_VAR_REDUC, OMP_CLAUSE_REDUCTION_CODE OMP_SINGLE_CLAUSES, OMP_SINGLE_BODY, OMP_CLAUSE_SCHEDULE_CHUNK_SIZE, OMP_SECTION_BODY, OMP_CRITICAL_NAME, OMP_CRITICAL_BODY): New. (TREE_RANGE_CHECK): New. (empty_body_p): Declare. (enum omp_clause_default_kind): New. (build_string_literal): Declare. (enum omp_clause_schedule_kind, OMP_CLAUSE_SCHEDULE_KIND): New. (build5_stat, build5): Declare. * tree-pass.h (TDF_CHAIN): Define. * tree-pass.h (PROP_gimple_lomp): Define. (pass_lower_omp): Declare. * diagnostic.h (debug_tree_chain): Declare. * builtins.c (get_builtin_sync_mode): Use 0 as last argument to mode_for_size. (expand_builtin): Handle sync BUILT_IN_*_16 builtins. * builtins.c (build_string_literal): Make extern. * gcc.c (include_spec_function): New. (static_spec_functions): Add it. (main): Move load of libgomp.spec ... (LINK_COMMAND_SPEC): ... here. (link_gomp_spec): New. (static_specs): Include it. (LINK_COMMAND_SPEC): Add link_gomp. (GOMP_SELF_SPECS): New. (driver_self_specs): Include it. (switch_matches): Don't mark inline. (main): Load libgomp.spec. * tree-gimple.c (is_gimple_stmt): True for OMP_MASTER, OMP_ORDERED, OMP_CRITICAL, OMP_SECTIONS, OMP_SECTION, and OMP_SINGLE, OMP_FOR and OMP_PARALLEL. * tree-gimple.h (enum omp_parallel): Declare. (determine_parallel_type): Declare. (omp_firstprivatize_variable): Declare. (omp_reduction_init): Declare. (diagnose_omp_structured_block_errors): Declare. (struct walk_stmt_info): Add want_return_expr. (struct walk_stmt_info): Add want_bind_expr, want_locations. (find_omp_clause): Declare. (insert_field_into_struct): Declare. (struct walk_stmt_info): Move from tree-nested.c (walk_stmts): Declare. * c-cppbuiltin.c (c_cpp_builtins): If -fopenmp, #define _OPENMP to 200505. * cgraphunit.c (cgraph_lower_function): Make static. (cgraph_finalize_pending_functions): New. (cgraph_finalize_function): Call it. (cgraph_finalize_compilation_unit): Likewise. * builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16, BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add. (BT_FN_UINT_UINT): New. (DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_7, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT, BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR, BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT, BT_FN_VOID_OMPFN_PTR_UINT_UINT, BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR, BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG, BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New. * builtins.def: Update DEF_BUILTIN comment to include COND argument. Move all DEF_SYNC_BUILTIN () and DEF_GOMP_BUILTIN () builtins into separate files. (DEF_GOMP_BUILTIN): New. (BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER, BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END, BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END, BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START, BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START, BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START, BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START, BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START, BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START, BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT, BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT, BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START, BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START, BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START, BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT, BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END, BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END, BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT, BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END, BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START, BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New. * sync-builtins.def: New file, moved from builtins.def. * omp-builtins.def: New file, moved from builtins.def. * c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine. * gimple-low.c (lower_function_body): Clear data. (lower_stmt): Do not handle COMPOUND_EXPR. Remove call to print_node_brief. * c-tree.h (c_finish_omp_clauses): New prototype. (C_DECL_THREADPRIVATE_P): Define. (lookup_name_no_remap, c_omp_remap_private): Remove (c_begin_omp_parallel, c_finish_omp_parallel): Update. (check_for_loop_decls): Update decl. (lookup_name_no_remap, c_omp_remap_private): Declare. (build_indirect_ref, build_modify_expr, pushdecl, pushdecl_top_level): Move to c-common.h. * dwarf2out.c (loc_descriptor_from_tree_1): Don't set unsignedp before the switch, but just in the 2 places that need it. * c-decl.c (diagnose_mismatched_decls): Do not check for mismatched thread-local attributes when OLDDECL is marked threadprivate and NEWDECL has no thread-local attributes. (merge_decls): Merge C_DECL_THREADPRIVATE_P. (c_gimple_diagnostics_recursively): Rename from c_warn_unused_result_recursively. Invoke diagnose_omp_structured_block_errors. (check_for_loop_decls): Return a singular decl found. * langhooks.c (lhd_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED for DECL_ARTIFICIAL decls. (lhd_omp_firstprivatize_type_sizes): New. (lhd_omp_assignment): New. (lhd_omp_predetermined_sharing): New. * langhooks.h (struct gimplify_omp_ctx): Forward declare. (struct lang_hooks_for_types): Add omp_firstprivatize_type_sizes, omp_privatize_by_reference, omp_predetermined_sharing, omp_disregard_value_expr, omp_private_debug_clause, omp_clause_default_ctor, omp_clause_copy_ctor, omp_clause_assign_op, omp_clause_dtor. (c_finish_omp_clauses): New. (c_finish_bc_stmt): Diagnose break within omp for. (c_begin_omp_parallel, c_finish_omp_parallel): New. (build_unary_op): Return error_mark after reporting a readonly_error. (build_modify_expr): Likewise. * gimplify.c: Include optabs.h and pointer-set.h. (enum gimplify_omp_var_data): Declare. (struct gimplify_omp_ctx): Declare. (struct gimplify_ctx): Add fields prev_context, combined_pre_p and combined_ctxp. (gimplify_ctxp, gimplify_omp_ctxp): New local variables. (push_gimplify_context, pop_gimplify_context): Allow nesting. (splay_tree_compare_decl_uid): New. (new_omp_context): New. (delete_omp_context): New. (gimple_add_tmp_var): Call omp_add_variable. (gimplify_bind_expr): Likewise. (gimplify_var_or_parm_decl): If omp_notice_variable returned true, disregard DECL_VALUE_EXPR on the decl if any. (gimplify_expr_in_ctx): New. (omp_firstprivatize_variable, omp_firstprivatize_type_sizes omp_add_variable, omp_notice_variable, omp_is_private gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1 gimplify_adjust_omp_clauses, gimplify_omp_parallel gimplify_omp_for, gimplify_omp_workshare, goa_lhs_expr_p gimplify_omp_atomic_fetch_op, goa_stabilize_expr gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex gimplify_omp_atomic): New. (gimplify_expr): Handle OMP_PARALLEL, OMP_FOR, OMP_SECTIONS, OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED, OMP_CRITICAL and OMP_ATOMIC. (gimplify_body): Verify gimplify_ctxp is empty after gimplification. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ATOMIC, PRAGMA_OMP_BARRIER, PRAGMA_OMP_CRITICAL, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR, PRAGMA_OMP_MASTER, PRAGMA_OMP_ORDERED, PRAGMA_OMP_PARALLEL, PRAGMA_OMP_PARALLEL_FOR, PRAGMA_OMP_PARALLEL_SECTIONS, PRAGMA_OMP_SECTION, PRAGMA_OMP_SECTIONS, PRAGMA_OMP_SINGLE, PRAGMA_OMP_THREADPRIVATE. * tree.def (OMP_PARALLEL, OMP_FOR, OMP_SECTIONS, OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED, OMP_CRITICAL, OMP_ATOMIC, OMP_CLAUSE_PRIVATE, OMP_CLAUSE_SHARED, OMP_CLAUSE_FIRSTPRIVATE, OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_REDUCTION, OMP_CLAUSE_COPYIN, OMP_CLAUSE_COPYPRIVATE, OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_NOWAIT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Define. * print-tree.c (print_node): Dump DECL_VALUE_EXPR. * tree-ssa-dce.c (find_control_dependence): Do not assume that ENTRY_BLOCK_PTR->next_bb == single_succ (ENTRY_BLOCK_PTR). * tree-nested.c (convert_call_expr): Call walk_body on OMP_BODY for OpenMP directives. (struct nesting_info): Add field_map, suppress_expansion, debug_var_chain. (create_nesting_tree): Initialize them. (lookup_field_for_decl): Use field_map. (get_nonlocal_debug_decl, get_local_debug_decl): New. (convert_local_omp_clauses): New. (finalize_nesting_tree_1): Add debug_var_chain to toplevel block. (walk_body): Split out of walk_function. (convert_nonlocal_omp_clauses, convert_local_omp_clauses): New. (convert_nonlocal_reference): Handle omp statements. (convert_local_reference): Likewise. (unnest_nesting_tree_1): Split out of finalize_nesting_tree_1. (unnest_nesting_tree): New. (lower_nested_functions): Call it. (insert_field_into_struct): Make extern. (struct walk_stmt_info): Move to tree-gimple.h. (walk_stmts): Make extern. * omp-builtins.def: New file. * tree-iterator.c (expr_only): Clarify comment. * c-common.h (pushdecl_top_level, pushdecl, build_modify_expr, build_indirect_ref, c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered, c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush, c_finish_omp_for, c_split_parallel_clauses, omp_clause_default_kind, c_omp_sharing_predetermined, c_omp_remap_decl): Declare. * Makefile.in (BUILTINS_DEF): Add omp-builtins.def. (OBJS-common): Add omp-low.o. (c-omp.o, omp-low.o): Add. (gimplify.o): Add dependency on $(OPTABS_H). (GTFILES): Add omp-low.c. (gt-stringpool.h): Add. * tree-cfg.c (set_bb_for_stmt): Do not update the block-to-labels map if we are currently expanding to RTL. (tree_node_can_be_shared): Remove unnecessary CONSTANT_CLASS_P checks. Handle IDENTIFIER_NODE. (tree_verify_flow_info): Do not ICE when emitting error messages about invalid labels. (dump_function_to_file): Reset CFUN before emitting the body of the function. (debug_function): New. * passes.c (init_optimization_passes): Schedule pass_lower_omp. * langhooks-def.h (lhd_omp_predetermined_sharing, lhd_omp_assignment, lhd_omp_firstprivatize_type_sizes): Declare. (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it. (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, LANG_HOOKS_OMP_PREDETERMINED_SHARING, LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE, LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR, LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, LANG_HOOKS_OMP_CLAUSE_DTOR): Define. (LANG_HOOK_DECLS): Use them. 2006-01-18 Dmitry Kurochkin <dmitry.kurochkin@gmail.com> Richard Henderson <rth@redhat.com> Jakub Jelinek <jakub@redhat.com> Diego Novillo <dnovillo@redhat.com> * c-parser.c (pragma_omp_clause): Define. (c_parser_declaration_or_fndef): Document OpenMP syntax. (c_parser_compound_statement): Likewise. (c_parser_statement): Likewise. (c_parser_pragma): Handle omp pragmas. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Define. (c_parser_omp_clause_name, check_no_duplicate_clause, c_parser_omp_variable_list, c_parser_omp_var_list_parens, c_parser_omp_clause_copyin, c_parser_omp_clause_copyprivate, c_parser_omp_clause_default, c_parser_omp_clause_firstprivate, c_parser_omp_clause_if, c_parser_omp_clause_lastprivate, c_parser_omp_clause_nowait, c_parser_omp_clause_num_threads, c_parser_omp_clause_ordered, c_parser_omp_clause_private, c_parser_omp_clause_reduction, c_parser_omp_clause_schedule, c_parser_omp_clause_shared, c_parser_omp_all_clauses, c_parser_omp_structured_block, c_parser_omp_atomic, c_parser_omp_barrier, c_parser_omp_critical, c_parser_omp_flush, c_parser_omp_for_loop, c_parser_omp_for, c_parser_omp_master, c_parser_omp_ordered, c_parser_omp_sections_scope, c_parser_omp_sections, c_parser_omp_parallel, c_parser_omp_single, c_parser_omp_construct, c_parser_omp_threadprivate): New. * c-pragma.c (init_pragma): Do omp pragma registration here. * c.opt (fopenmp): New flag. 2006-01-18 Eric Christopher <echristo@apple.com> * gcc.c (GOMP_SELF_SPECS): Bracket in #ifndef/#endif. * config/darwin.h (GOMP_SELF_SPECS): Define. testsuite/ 2006-01-18 Richard Henderson <rth@redhat.com> Aldy Hernandez <aldyh@redhat.com> Jakub Jelinek <jakub@redhat.com> Diego Novillo <dnovillo@redhat.com> Uros Bizjak <uros@kss-loka.si> * testsuite/gcc.dg/gomp: New directory. From-SVN: r109902
2006-01-18 20:21:25 +01:00
PRAGMA_OMP_ATOMIC,
PRAGMA_OMP_BARRIER,
PRAGMA_OMP_CRITICAL,
PRAGMA_OMP_FLUSH,
PRAGMA_OMP_FOR,
PRAGMA_OMP_MASTER,
PRAGMA_OMP_ORDERED,
PRAGMA_OMP_PARALLEL,
PRAGMA_OMP_PARALLEL_FOR,
PRAGMA_OMP_PARALLEL_SECTIONS,
PRAGMA_OMP_SECTION,
PRAGMA_OMP_SECTIONS,
PRAGMA_OMP_SINGLE,
PRAGMA_OMP_THREADPRIVATE,
directives.c (struct pragma_entry): Add is_deferred. libcpp/ * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. gcc/ * c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id via integer constant. (pragma_lex): Remove. * c-pch.c (c_common_pch_pragma): Accept the name as an argument, rather than parsing it. * c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname, handle_pragma_extern_prefix): Add %< %> quotes. (registered_pragmas): New. (c_register_pragma_1): New. (c_register_pragma): Use it. (c_register_pragma_with_expansion): Likewise. (c_invoke_pragma_handler): New. (init_pragma): Use cpp_register_deferred_pragma directly for pch_preprocess. * c-pragma.h (enum pragma_kind): New. (pragma_handler): New. (c_invoke_pragma_handler): Declare. * c-common.c (c_parse_error): Pretty print CPP_PRAGMA and CPP_PRAGMA_EOL. * c-common.h (c_common_pch_pragma): Update decl. * Makefile.in (c-parser.o): Update dependencies. (GTFILES): Add c-pragma.h. * c-parser.c (struct c_token): Add pragma_kind. (struct c_parser): Add in_pragma. (c_lex_one_token): Always initialize keyword and pragma_kind. Extract data for CPP_PRAGMA. (c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL. (c_parser_consume_token): Don't allow CPP_PRAGMA unless errors. Don't allow CPP_PRAGMA_EOL if in_pragma. (c_parser_consume_pragma): New. (c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL. (c_parser_skip_to_end_of_parameter): Likewise. (c_parser_skip_to_end_of_block_or_statement): Likewise. (c_parser_skip_to_pragma_eol): New. (c_parser_external_declaration): Handle CPP_PRAGMA. (c_parser_compound_statement_nostart): Likewise. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): New. (pragma_lex): Likewise. (c_parser_pragma_pch_preprocess): New. (c_parser_new): Merge into ... (c_parse_file): ... here. Call c_parser_pragma_pch_preprocess. gcc/cp/ * lex.c (handle_pragma_java_exceptions): Fix whitespace. * parser.c (struct cp_token): Add pragma_kind. (eof_token): Update to match. (struct cp_lexer): Add in_pragma; rearrange next for better packing. (cp_parser_initial_pragma): New. (cp_lexer_new_main): Use it. Don't bother clearing c_lex_return_raw_strings. (cp_lexer_get_preprocessor_token): Always initialize keyword and pragma_kind fields. Handle CPP_PRAGMA. (cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when in_pragma is set. (cp_lexer_handle_pragma): Remove. Update callers to cp_parser_pragma. (cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string. (cp_parser_skip_to_pragma_eol): New. (cp_parser_error): Use it. (cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL; rearrange with switch statement. (cp_parser_skip_to_end_of_statement): Likewise. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_skip_to_closing_brace): Likewise. (cp_parser_skip_until_found): Likewise. (cp_parser_statement): Add in_compound argument; update callers. Use it to decide how to handle pragma parsing. (cp_parser_labeled_statement): Add in_compound argument; pass it on to cp_parser_statement. (cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_function_definition_after_decl): Likewise. (cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs. (cp_parser_pragma): New. (pragma_lex): New. gcc/testsuite/ * g++.dg/parse/pragma2.C: Update expected error lines. From-SVN: r109336
2006-01-04 17:33:38 +01:00
PRAGMA_GCC_PCH_PREPROCESS,
PRAGMA_FIRST_EXTERNAL
} pragma_kind;
2002-05-26 00:01:55 +02:00
/* Cause the `yydebug' variable to be defined. */
#define YYDEBUG 1
extern int yydebug;
extern struct cpp_reader* parse_in;
#define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
#ifdef HANDLE_SYSV_PRAGMA
/* We always support #pragma pack for SYSV pragmas. */
#ifndef HANDLE_PRAGMA_PACK
#define HANDLE_PRAGMA_PACK 1
#endif
#endif /* HANDLE_SYSV_PRAGMA */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
/* If we are supporting #pragma pack(push... then we automatically
support #pragma pack(<n>) */
#define HANDLE_PRAGMA_PACK 1
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
re PR c++/9283 (__attribute__((visibility ("hidden"))) not supported for class/struct) PR c++/9283 PR c++/15000 * c-common.c (c_common_attribute_table): Allow handle_visibility_attribute to be called for types. (handle_visibility_attribute) When given a type, set the visibility bits on the TYPE_NAME. When given a decl, don't set no_add_attrs so that we can check later whether the attribute was present. Added warning if attribute applied to non class type. * c-decl.c (diagnose_mismatched_decls): Updated rules for merging decls and checking that they are consistent. * common.opt: Added -fvisibility. * c.opt, c-opts.c: Added -fvisibility-inlines-hidden. * c-pragma.h, c-pragma.c: Added handle_pragma_visibility(). * flags.h, tree.h: Added assorted support defines for overall patch * opts.c: Added parsing support for -fvisibility. * tree.c (build_decl): Set visibility for all decls to be whatever is in force at that time. * varasm.c (default_binds_local_p_1): Reworked logic determining when to make a symbol locally bound. * doc/invoke.texi: Added documentation for -fvisibility and -fvisibility-inlines-hidden. PR c++/15000 PR c++/9283 * class.c (check_field_decls): Apply hidden visibility if -fvisibility-inlines-hidden and inlined unless otherwise specified (build_vtable): Set vtable visibility to class visibility. (check_field_decls): Default static member visibility to class visibility. (check_methods): Default method visibility to class visibility. * cp-tree.h: Added CLASSTYPE_VISIBILITY and CLASSTYPE_VISIBILITY_SPECIFIED macro. * decl.c (duplicate_decls): New logic for merging definition decls with declaration decls. Added ignore & warning when non default applied to global operator new or delete. * method.c, optimize.c, rtti.c: Added setting of VISIBILITY_SPECIFIED wherever VISIBILITY was changed * rtti.c (get_tinfo_decl): Set typeinfo visibility to class visibility. (tinfo_base_init): Set typeinfo name visibility to class visibility. PR c++/9283 PR c++/15000 * gcc.dg/visibility-9.c, gcc.dg/visibility-a.c: New tests. * g++.dg/ext/visibility/: New directory. * g++.dg/ext/visibility-1.C, g++.dg/ext/visibility-2.C g++.dg/ext/visibility-3.C, g++.dg/ext/visibility-4.C, g++.dg/ext/visibility-5.C, g++.dg/ext/visibility-6.C, g++.dg/ext/visibility-7.C: Move to g++.dg/ext/visibility/. * g++.dg/ext/visibility/fvisibility.C, g++.dg/ext/visibility/fvisibility-inlines-hidden.C, g++.dg/ext/visibility/fvisibility-override1.C g++.dg/ext/visibility/fvisibility-override2.C g++.dg/ext/visibility/memfuncts.C g++.dg/ext/visibility/noPLT.C g++.dg/ext/visibility/pragma.C g++.dg/ext/visibility/pragma-override1.C g++.dg/ext/visibility/pragma-override2.C g++.dg/ext/visibility/staticmemfuncts.C g++.dg/ext/visibility/virtual.C: New tests. Co-Authored-By: Brian Ryner <bryner@brianryner.com> From-SVN: r85167
2004-07-26 00:52:22 +02:00
/* It's safe to always leave visibility pragma enabled as if
visibility is not supported on the host OS platform the
statements are ignored. */
#define HANDLE_PRAGMA_VISIBILITY 1
2003-06-22 17:07:31 +02:00
extern void init_pragma (void);
directives.c (struct pragma_entry): Add is_deferred. libcpp/ * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. gcc/ * c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id via integer constant. (pragma_lex): Remove. * c-pch.c (c_common_pch_pragma): Accept the name as an argument, rather than parsing it. * c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname, handle_pragma_extern_prefix): Add %< %> quotes. (registered_pragmas): New. (c_register_pragma_1): New. (c_register_pragma): Use it. (c_register_pragma_with_expansion): Likewise. (c_invoke_pragma_handler): New. (init_pragma): Use cpp_register_deferred_pragma directly for pch_preprocess. * c-pragma.h (enum pragma_kind): New. (pragma_handler): New. (c_invoke_pragma_handler): Declare. * c-common.c (c_parse_error): Pretty print CPP_PRAGMA and CPP_PRAGMA_EOL. * c-common.h (c_common_pch_pragma): Update decl. * Makefile.in (c-parser.o): Update dependencies. (GTFILES): Add c-pragma.h. * c-parser.c (struct c_token): Add pragma_kind. (struct c_parser): Add in_pragma. (c_lex_one_token): Always initialize keyword and pragma_kind. Extract data for CPP_PRAGMA. (c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL. (c_parser_consume_token): Don't allow CPP_PRAGMA unless errors. Don't allow CPP_PRAGMA_EOL if in_pragma. (c_parser_consume_pragma): New. (c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL. (c_parser_skip_to_end_of_parameter): Likewise. (c_parser_skip_to_end_of_block_or_statement): Likewise. (c_parser_skip_to_pragma_eol): New. (c_parser_external_declaration): Handle CPP_PRAGMA. (c_parser_compound_statement_nostart): Likewise. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): New. (pragma_lex): Likewise. (c_parser_pragma_pch_preprocess): New. (c_parser_new): Merge into ... (c_parse_file): ... here. Call c_parser_pragma_pch_preprocess. gcc/cp/ * lex.c (handle_pragma_java_exceptions): Fix whitespace. * parser.c (struct cp_token): Add pragma_kind. (eof_token): Update to match. (struct cp_lexer): Add in_pragma; rearrange next for better packing. (cp_parser_initial_pragma): New. (cp_lexer_new_main): Use it. Don't bother clearing c_lex_return_raw_strings. (cp_lexer_get_preprocessor_token): Always initialize keyword and pragma_kind fields. Handle CPP_PRAGMA. (cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when in_pragma is set. (cp_lexer_handle_pragma): Remove. Update callers to cp_parser_pragma. (cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string. (cp_parser_skip_to_pragma_eol): New. (cp_parser_error): Use it. (cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL; rearrange with switch statement. (cp_parser_skip_to_end_of_statement): Likewise. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_skip_to_closing_brace): Likewise. (cp_parser_skip_until_found): Likewise. (cp_parser_statement): Add in_compound argument; update callers. Use it to decide how to handle pragma parsing. (cp_parser_labeled_statement): Add in_compound argument; pass it on to cp_parser_statement. (cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_function_definition_after_decl): Likewise. (cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs. (cp_parser_pragma): New. (pragma_lex): New. gcc/testsuite/ * g++.dg/parse/pragma2.C: Update expected error lines. From-SVN: r109336
2006-01-04 17:33:38 +01:00
/* Front-end wrappers for pragma registration. */
typedef void (*pragma_handler)(struct cpp_reader *);
extern void c_register_pragma (const char *, const char *, pragma_handler);
sol2-c.c (solaris_register_pragmas): Use c_register_pragma_with_expansion. gcc: 2004-11-23 Daniel Jacobowitz <dan@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * config/sol2-c.c (solaris_register_pragmas): Use c_register_pragma_with_expansion. * config/sol2.h (HANDLE_PRAGMA_PACK_WITH_EXPANSION): Define. * c-pragma.c (c_register_pragma): Update call to cpp_register_pragma. (c_register_pragma_with_expansion): New function. (init_pragma): Honor HANDLE_PRAGMA_PACK_WITH_EXPANSION. * c-pragma.h (c_register_pragma_with_expansion): New prototype. * doc/extend.texi (Solaris Pragmas): Mention macro expansion for #pragma align. * doc/tm.texi (c_register_pragma_with_expansion, HANDLE_PRAGMA_PACK_WITH_EXPANSION): Document. gcc/testsuite: 2004-11-23 Daniel Jacobowitz <dan@codesourcery.com> * gcc.dg/pragma-align-2.c: Test macro expansion. * gcc.dg/pragma-pack-2.c: New test. libcpp: 2004-11-23 Daniel Jacobowitz <dan@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * internal.h (struct lexer_state): Add in_deferred_pragma. * directives.c (struct pragma_entry): Add allow_expansion. (insert_pragma_entry): Take allow_expansion flag. (register_pragma): Likewise. (cpp_register_pragma): Likewise. (_cpp_init_internal_pragmas): Update calls to cpp_register_pragma. (do_pragma): Honor allow_expansion. (cpp_handle_deferred_pragma): Set in_deferred_pragma. * include/cpplib.h (cpp_register_pragma): Update prototype. Co-Authored-By: Joseph Myers <joseph@codesourcery.com> From-SVN: r91117
2004-11-24 00:25:40 +01:00
extern void c_register_pragma_with_expansion (const char *, const char *,
directives.c (struct pragma_entry): Add is_deferred. libcpp/ * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. gcc/ * c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id via integer constant. (pragma_lex): Remove. * c-pch.c (c_common_pch_pragma): Accept the name as an argument, rather than parsing it. * c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname, handle_pragma_extern_prefix): Add %< %> quotes. (registered_pragmas): New. (c_register_pragma_1): New. (c_register_pragma): Use it. (c_register_pragma_with_expansion): Likewise. (c_invoke_pragma_handler): New. (init_pragma): Use cpp_register_deferred_pragma directly for pch_preprocess. * c-pragma.h (enum pragma_kind): New. (pragma_handler): New. (c_invoke_pragma_handler): Declare. * c-common.c (c_parse_error): Pretty print CPP_PRAGMA and CPP_PRAGMA_EOL. * c-common.h (c_common_pch_pragma): Update decl. * Makefile.in (c-parser.o): Update dependencies. (GTFILES): Add c-pragma.h. * c-parser.c (struct c_token): Add pragma_kind. (struct c_parser): Add in_pragma. (c_lex_one_token): Always initialize keyword and pragma_kind. Extract data for CPP_PRAGMA. (c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL. (c_parser_consume_token): Don't allow CPP_PRAGMA unless errors. Don't allow CPP_PRAGMA_EOL if in_pragma. (c_parser_consume_pragma): New. (c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL. (c_parser_skip_to_end_of_parameter): Likewise. (c_parser_skip_to_end_of_block_or_statement): Likewise. (c_parser_skip_to_pragma_eol): New. (c_parser_external_declaration): Handle CPP_PRAGMA. (c_parser_compound_statement_nostart): Likewise. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): New. (pragma_lex): Likewise. (c_parser_pragma_pch_preprocess): New. (c_parser_new): Merge into ... (c_parse_file): ... here. Call c_parser_pragma_pch_preprocess. gcc/cp/ * lex.c (handle_pragma_java_exceptions): Fix whitespace. * parser.c (struct cp_token): Add pragma_kind. (eof_token): Update to match. (struct cp_lexer): Add in_pragma; rearrange next for better packing. (cp_parser_initial_pragma): New. (cp_lexer_new_main): Use it. Don't bother clearing c_lex_return_raw_strings. (cp_lexer_get_preprocessor_token): Always initialize keyword and pragma_kind fields. Handle CPP_PRAGMA. (cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when in_pragma is set. (cp_lexer_handle_pragma): Remove. Update callers to cp_parser_pragma. (cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string. (cp_parser_skip_to_pragma_eol): New. (cp_parser_error): Use it. (cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL; rearrange with switch statement. (cp_parser_skip_to_end_of_statement): Likewise. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_skip_to_closing_brace): Likewise. (cp_parser_skip_until_found): Likewise. (cp_parser_statement): Add in_compound argument; update callers. Use it to decide how to handle pragma parsing. (cp_parser_labeled_statement): Add in_compound argument; pass it on to cp_parser_statement. (cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_function_definition_after_decl): Likewise. (cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs. (cp_parser_pragma): New. (pragma_lex): New. gcc/testsuite/ * g++.dg/parse/pragma2.C: Update expected error lines. From-SVN: r109336
2006-01-04 17:33:38 +01:00
pragma_handler);
extern void c_invoke_pragma_handler (unsigned int);
2003-06-22 17:07:31 +02:00
extern void maybe_apply_pragma_weak (tree);
extern void maybe_apply_pending_pragma_weaks (void);
2003-06-22 17:07:31 +02:00
extern tree maybe_apply_renaming_pragma (tree, tree);
extern void add_to_renaming_pragma_list (tree, tree);
extern enum cpp_ttype pragma_lex (tree *);
directives.c (struct pragma_entry): Add is_deferred. libcpp/ * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. gcc/ * c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id via integer constant. (pragma_lex): Remove. * c-pch.c (c_common_pch_pragma): Accept the name as an argument, rather than parsing it. * c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname, handle_pragma_extern_prefix): Add %< %> quotes. (registered_pragmas): New. (c_register_pragma_1): New. (c_register_pragma): Use it. (c_register_pragma_with_expansion): Likewise. (c_invoke_pragma_handler): New. (init_pragma): Use cpp_register_deferred_pragma directly for pch_preprocess. * c-pragma.h (enum pragma_kind): New. (pragma_handler): New. (c_invoke_pragma_handler): Declare. * c-common.c (c_parse_error): Pretty print CPP_PRAGMA and CPP_PRAGMA_EOL. * c-common.h (c_common_pch_pragma): Update decl. * Makefile.in (c-parser.o): Update dependencies. (GTFILES): Add c-pragma.h. * c-parser.c (struct c_token): Add pragma_kind. (struct c_parser): Add in_pragma. (c_lex_one_token): Always initialize keyword and pragma_kind. Extract data for CPP_PRAGMA. (c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL. (c_parser_consume_token): Don't allow CPP_PRAGMA unless errors. Don't allow CPP_PRAGMA_EOL if in_pragma. (c_parser_consume_pragma): New. (c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL. (c_parser_skip_to_end_of_parameter): Likewise. (c_parser_skip_to_end_of_block_or_statement): Likewise. (c_parser_skip_to_pragma_eol): New. (c_parser_external_declaration): Handle CPP_PRAGMA. (c_parser_compound_statement_nostart): Likewise. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): New. (pragma_lex): Likewise. (c_parser_pragma_pch_preprocess): New. (c_parser_new): Merge into ... (c_parse_file): ... here. Call c_parser_pragma_pch_preprocess. gcc/cp/ * lex.c (handle_pragma_java_exceptions): Fix whitespace. * parser.c (struct cp_token): Add pragma_kind. (eof_token): Update to match. (struct cp_lexer): Add in_pragma; rearrange next for better packing. (cp_parser_initial_pragma): New. (cp_lexer_new_main): Use it. Don't bother clearing c_lex_return_raw_strings. (cp_lexer_get_preprocessor_token): Always initialize keyword and pragma_kind fields. Handle CPP_PRAGMA. (cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when in_pragma is set. (cp_lexer_handle_pragma): Remove. Update callers to cp_parser_pragma. (cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string. (cp_parser_skip_to_pragma_eol): New. (cp_parser_error): Use it. (cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL; rearrange with switch statement. (cp_parser_skip_to_end_of_statement): Likewise. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_skip_to_closing_brace): Likewise. (cp_parser_skip_until_found): Likewise. (cp_parser_statement): Add in_compound argument; update callers. Use it to decide how to handle pragma parsing. (cp_parser_labeled_statement): Add in_compound argument; pass it on to cp_parser_statement. (cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_function_definition_after_decl): Likewise. (cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs. (cp_parser_pragma): New. (pragma_lex): New. gcc/testsuite/ * g++.dg/parse/pragma2.C: Update expected error lines. From-SVN: r109336
2006-01-04 17:33:38 +01:00
/* This is not actually available to pragma parsers. It's merely a
convenient location to declare this function for c-lex, after
having enum cpp_ttype declared. */
extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *);
2002-05-26 00:01:55 +02:00
/* If 1, then lex strings into the execution character set.
If 0, lex strings into the host character set.
If -1, lex both, and chain them together, such that the former
is the TREE_CHAIN of the latter. */
extern int c_lex_string_translate;
target-supports.exp (check-iconv-available): New function. 2004-02-26 Eric Christopher <echristo@redhat.com> * lib/target-supports.exp (check-iconv-available): New function. * lib/gcc-dg.exp (dg-require-iconv): New function. Use above. * gcc.dg/charset: New directory. * gcc.dg/charset/charset.exp: New file. * gcc.dg/charset/asm1.c: Ditto. * gcc.dg/charset/asm2.c: Ditto. * gcc.dg/charset/asm3.c: Ditto. * gcc.dg/charset/asm4.c: Ditto. * gcc.dg/charset/asm5.c: Ditto. * gcc.dg/charset/attribute1.c: Ditto. * gcc.dg/charset/attribute2.c: Ditto. * gcc.dg/charset/string1.c: Ditto. * g++.dg/charset: New directory. * g++.dg/dg.exp: Add here. Special options. * g++.dg/charset/charset.exp: New file. * g++.dg/charset/asm1.c: Ditto. * g++.dg/charset/asm2.c: Ditto. * g++.dg/charset/asm3.c: Ditto. * g++.dg/charset/asm4.c: Ditto. * g++.dg/charset/attribute1.c: Ditto. * g++.dg/charset/attribute2.c: Ditto. * g++.dg/charset/extern1.cc: Ditto. * g++.dg/charset/extern2.cc: Ditto. * g++.dg/charset/string1.c: Ditto. 2004-02-26 Eric Christopher <echristo@redhat.com> * c-lex.c (c_lex_string_translate): New variable. (lex_string): Use to determine string translation. * c-pragma.h: Prototype. * c-parse.in (start_string_translation): New. Set above. (stop_string_translation): Ditto. (attribute, attribute_list, asm_def, asm_stmt, asm_operand): Use above functions. * cp/parser.c (cp_parser_declaration): Translate strings unless token is RID_EXTERN. Set c_lex_string_translate for recursive use. (cp_parser_asm_definition): Only translate argument strings to asms. (cp_parser_asm_operand_list): Ditto. (cp_parser_attribute_list): Do not translate attribute strings. From-SVN: r78548
2004-02-27 03:01:10 +01:00
c-common.c (fix_string_type): Build the unqualified array type unconditionally... 2004-09-20 Matt Austern <austern@apple.com> Zack Weinberg <zack@codesourcery.com> * c-common.c (fix_string_type): Build the unqualified array type unconditionally, then use c_build_qualified_type to get the proper const-qualified variant, and set its TYPE_MAIN_VARIANT to refer to the unqualified type. * c-lex.c (c_lex_return_raw_string): New global. (c_lex_with_flags): Honor it. * c-pragma.h: Declare it. cp: * decl.c (make_rtl_for_nonlocal_decl, start_preparsed_function): Apply lbasename to input_filename before passing to get_fileinfo. * semantics.c (begin_class_definition): Likewise. * lex.c (handle_pragma_interface): Apply get_fileinfo to the correct filename. Rename variables to be less confusing. (handle_pragma_implementation): Likewise. Disable "appears after file is included" diagnostic. * parser.c (struct cp_token): Add in_system_header fiag. (CP_TOKEN_BLOCK_NUM_TOKENS, struct cp_token_block) (CP_TOKEN_BUFFER_SIZE, cp_token_cache_push_token) (CPP_NONE, cp_lexer_read_token): Delete. (struct cp_lexer): Remove first_token, string_tokens, main_lexer_p fields. Clarify comments. (struct cp_token_cache): Now just a pair of pointers. (CP_LEXER_BUFFER_SIZE): New #define. (CPP_PURGED): New fake token type. (cp_lexer_new_from_token_array, cp_lexer_destroy) (cp_lexer_peek_token_emit_debug_info, cp_lexer_skip_purged_tokens) (cp_lexer_handle_pragma, cp_token_cache_new, cp_parser_string_literal): New functions. (cp_lexer_new_from_tokens): Now a simple wrapper around cp_lexer_new_from_token_array. (cp_lexer_set_source_position_from_token): Also update in_system_header. (cp_lexer_next_token, cp_lexer_prev_token, cp_lexer_advance_token): Don't wrap round. (cp_lexer_token_difference): Dont handle wrapping round. (cp_lexer_new_main): Enable pragma deferral and raw strings, read the entire translation unit through c_lex_with_flags into this lexer's buffer, then turn raw strings back off again. (cp_lexer_grow_buffer): Adjust for buffer no longer being circular. (cp_lexer_get_preprocessor_token): No need to handle not being the main lexer. Set token->in_system_header too. (cp_lexer_peek_token): Skip purged tokens. Feed pragma tokens to cp_lexer_handle_pragma. No need to call cp_lexer_read_token. (cp_lexer_peek_nth_token): Likewise. (cp_lexer_purge_token): Mark the token PURGED, don't shift all the other tokens down. (cp_lexer_purge_tokens_after): Likewise. (cp_lexer_save_tokens, cp_lexer_rollback_tokens): Don't worry about there being no tokens. (cp_lexer_print_token): Revise to give useful information on all tokens. (struct cp_parser): Add field translate_strings_p. (cp_parser_new): Initialize it. (cp_parser_translation_unit): Destroy the lexer when done. (cp_parser_parameter_declaration): Restructure saving of default arguments. (cp_parser_save_member_function_body): Likewise. (cp_parser_check_for_invalid_template_id) (cp_parser_nested_name_specifier_opt, cp_parser_template_id): Adjust calls to cp_lexer_advance_token. (cp_parser_skip_to_closing_parenthesis, cp_parser_declaration): No need to fiddle c_lex_string_translate. (cp_parser_primary_expression, cp_parser_linkage_specification) (cp_parser_asm_definition, cp_parser_asm_specification_opt) (cp_parser_asm_operand_list, cp_parser_asm_clobber_list) Use cp_parser_string_literal. (cp_parser_attribute_list): Save and restore parser->translate_strings_p, not c_lex_string_translate. (cp_parser_cache_group): Delete. (cp_parser_cache_group_1): Rename cp_parser_cache_group. Do not take a cache argument. From-SVN: r87786
2004-09-21 04:22:45 +02:00
/* If true, strings should be passed to the caller of c_lex completely
unmolested (no concatenation, no translation). */
extern bool c_lex_return_raw_strings;
#endif /* GCC_C_PRAGMA_H */