aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
AgeCommit message (Collapse)AuthorFilesLines
2011-12-20gcc:Joseph Myers1-10/+10
* c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield) (finish_struct): Refer to C11 in comments. Use flag_isoc11. * c-parser.c (c_parser_static_assert_declaration) (c_parser_static_assert_declaration_no_semi, c_parser_declspecs) (c_parser_alignas_specifier, c_parser_alignof_expression): Refer to C11 in comments. Use flag_isoc11. * c-typeck.c (comptypes_check_different_types): Refer to C11 in comment. * doc/cpp.texi (Overview): Refer to -std=c11 instead of -std=c1x. * doc/cppopts.texi (-std=c11, -std=gnu11): Document in preference to -std=c1x and -std=gnu1x. * doc/extend.texi (Inline, Alternate Keywords, Other Builtins) (__builtin_complex, Unnamed Fields): Refer to -std=c11 and C11 instead of -std=c1x and C1X. * doc/invoke.texi (-std=c11, -std=iso9899:2011): Document in preference to -std=c1x. (-std=gnu11): Document in preference to -std=gnu1x. * doc/standards.texi: Document C11 instead of C1X. Document C11 as actual standard. Document headers required from freestanding C11 implementations. * ginclude/float.h, ginclude/stddef.h: Test __STDC_VERSION__ >= 201112L for C11. Update comments to refer to C11. gcc/c-family: * c-common.c (flag_isoc99): Update comment to refer to C11. (flag_isoc1x): Change to flag_isoc11. * c-common.h (flag_isoc99): Update comment to refer to C11. (flag_isoc1x): Change to flag_isoc11. * c-cppbuiltin.c (cpp_atomic_builtins): Change comment to refer to C11. * c-opts.c (set_std_c1x): Change to set_std_c11. (c_common_handle_option): Handle OPT_std_c11 and OPT_std_gnu11. Call set_std_c11. (set_std_c89, set_std_c99, set_std_c11): Use flag_isoc11. (set_std_c1): Use CLK_STDC11 and CLK_GNUC11. * c.opt (std=c1x): Change to std=c11. Document as non-draft standard. (std=c1x, std=iso9899:2011): Add as aliases of std=c11. (std=gnu1x): Change to std=gnu11. Refer to non-draft standard. (std=gnu1x): Make alias of std=gnu11. gcc/testsuite: * gcc.dg/c11-version-1.c, gcc.dg/c11-version-2.c, gcc.dg/c94-version-1.c, gcc.dg/c99-version-1.c, gcc.dg/gnu11-version-1.c: New tests. libcpp: * include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11. (CLK_STDC1X): Change to CLK_STDC11. * init.c (lang_defaults): Update comments. (cpp_init_builtins): Update language tests. Use 201112L for C11 __STDC_VERSION__. From-SVN: r182551
2011-12-15re PR c/51360 (spurious unused-but-set-variable warning for var used in ↵Jakub Jelinek1-0/+2
OpenMP pragma) PR c/51360 * c-parser.c (c_parser_omp_clause_num_threads, c_parser_omp_clause_schedule): Call mark_exp_read. * semantics.c (finish_omp_clauses): For OMP_CLAUSE_NUM_THREADS_EXPR and OMP_CLAUSE_SCHEDULE_CHUNK_EXPR call mark_rvalue_use. * c-c++-common/gomp/pr51360.c: New test. * g++.dg/gomp/pr51360.C: New test. From-SVN: r182381
2011-11-30re PR c/51321 (__builtin_types_compatible_p (any_type_t[1][], ↵Andrew Pinski1-2/+9
any_other_type_t) crashes GCC) 2011-11-30 Andrew Pinski <apinski@cavium.com> PR c/51321 * c-parser.c (c_parser_postfix_expression): Check groktypename results before looking at the main variant. 2011-11-30 Andrew Pinski <apinski@cavium.com> * gcc.dg/pr51321.c: New testcase. From-SVN: r181857
2011-11-15Require parentheses when parsing transaction expressions.Torvald Riegel1-2/+7
gcc/ * c-parser.c (c_parser_transaction_expression): Require parentheses when parsing transaction expressions. gcc/cp/ * parser.c (cp_parser_transaction_expression): Require parentheses when parsing transaction expressions. gcc/testsuite/ * c-c++-common/tm/trxn-expr-3.c: New test. From-SVN: r181383
2011-11-08Merge from transactional-memory branch.Aldy Hernandez1-52/+301
From-SVN: r181154
2011-11-06c-decl.c (shadow_tag_warned, [...]): Handle _Alignas specifiers.Joseph Myers1-1/+67
* c-decl.c (shadow_tag_warned, grokdeclarator): Handle _Alignas specifiers. (build_null_declspecs): Initialize align_log and alignas_p fields. (declspecs_add_alignas): New. * c-parser.c (c_token_starts_declspecs): Handle RID_ALIGNAS. (c_parser_declspecs): Handle _Alignas specifiers. (c_parser_alignas_specifier): New. (c_parser_alignof_expression): Diagnose alignof use for non-C1X. Diagnose _Alignof (expression). * c-tree.h (struct c_declspecs): Add align_log and alignas_p fields. (declspecs_add_alignas): Declare. * ginclude/stddef.h (max_align_t): Define for C1X and C++11. * ginclude/stdalign.h: New. * Makefile.in (USER_H): Add stdalign.h. c-family: * c-common.c (c_common_reswords): Add _Alignas and _Alignof. (c_sizeof_or_alignof_type): Diagnose alignof applied to a function type. (check_user_alignment): New. Split out of handle_aligned_attribute. Disallow integer constants with noninteger types. Conditionally allow zero. (handle_aligned_attribute): Use check_user_alignment. * c-common.h (RID_ALIGNAS, check_user_alignment): New. testsuite: * g++.dg/cpp0x/alignof3.C, gcc.dg/c1x-align-1.c, gcc.dg/c1x-align-2.c, gcc.dg/c1x-align-3.c, gcc.dg/c1x-align-4.c, gcc.dg/c90-align-1.c, gcc.dg/c99-align-1.c: New tests. * gcc.dg/gnu89-const-expr-1.c, gcc.dg/gnu90-const-expr-1.c, gcc.dg/gnu99-const-expr-1.c, gcc.dg/gnu99-static-1.c: Update expected diagnostics. From-SVN: r181048
2011-11-04re PR c++/50608 (cannot apply 'offsetof' to a non-constant address)Eric Botcazou1-1/+1
2011-11-04 Eric Botcazou <ebotcazou@adacore.com> PR c++/50608 * c-parser.c (c_parser_postfix_expression) <RID_OFFSETOF>: Adjust call to fold_offsetof. * c-typeck.c (build_unary_op) <ADDR_EXPR>: Call fold_offsetof_1. c-family/ * c-common.c (c_fully_fold_internal) <ADDR_EXPR>: Call fold_offsetof_1. (fold_offsetof_1): Make global.  Remove STOP_REF argument and adjust. <INDIRECT_REF>: Return the argument. <ARRAY_REF>: Remove special code for negative offset. Call fold_build_pointer_plus instead of size_binop. (fold_offsetof): Remove STOP_REF argument and adjust. * c-common.h (fold_offsetof_1): Declare. (fold_offsetof): Remove STOP_REF argument. cp/ * semantics.c (finish_offsetof): Adjust call to fold_offsetof. * typeck.c (cp_build_addr_expr_1): Call fold_offsetof_1. From-SVN: r180986
2011-10-11c.opt: (fallow-parameterless-variadic-functions): New.Tristan Gingold1-4/+13
c-family/ChangeLog 2011-10-11 Tristan Gingold <gingold@adacore.com> * c.opt: (fallow-parameterless-variadic-functions): New. ChangeLog 2011-10-11 Tristan Gingold <gingold@adacore.com> * doc/invoke.texi (C Dialect Options): Document -fallow-parameterless-variadic-functions. * c-parser.c (c_parser_parms_list_declarator): Handle it. testsuite/ChangeLog 2011-10-11 Tristan Gingold <gingold@adacore.com> * gcc.dg/va-arg-4.c: New test. * gcc.dg/va-arg-5.c: Ditto. From-SVN: r179786
2011-10-07Rename vshuffle/vec_shuffle to vec_perm.Richard Henderson1-3/+3
* doc/extend.texi (__builtin_shuffle): Improve the description to include the modulus of the selector. Mention OpenCL. * doc/md.texi (vec_perm, vec_perm_const): Document named patterns. * tree.def (VEC_PERM_EXPR): Rename from VEC_SHUFFLE_EXPR. * genopinit.c (optabs): Rename vshuffle to vec_perm. * c-typeck.c (c_build_vec_perm_expr): Rename from c_build_vec_shuffle_expr. Update for name changes. * optabs.c (expand_vec_perm_expr_p): Rename from expand_vec_shuffle_expr_p. (expand_vec_perm_expr): Rename from expand_vec_shuffle_expr. * optabs.h (OTI_vec_perm): Rename from DOI_vshuffle. (vec_perm_optab): Rename from vshuffle_optab. * expr.c, gimple-pretty-print.c, gimple.c, gimplify.c, c-tree.h, c-parser.c, tree-cfg.c, tree-inline.c, tree-pretty-print.c, tree-ssa-operands.c, tree-vect-generic.c: Update for name changes. * config/i386/i386.c (ix86_expand_vec_perm): Rename from ix86_expand_vshuffle. * config/i386/i386-protos.h: Update. * config/i386/sse.md (VEC_PERM_AVX2): Rename from VSHUFFLE_AVX2. (vec_perm<VEC_PERM_AVX2>): Rename from vshuffle<VSHUFFLE_AVX2>. From-SVN: r179701
2011-10-06Fix bconstp-3.c failure in PR50607.Artjoms Sinkarovs1-75/+73
From-SVN: r179588
2011-10-03Vector shuffling patch from Artem Shinkarov.Artjoms Sinkarovs1-82/+175
From-SVN: r179462
2011-08-19c-parser.c (c_parser_postfix_expression): Convert operands of ↵Joseph Myers1-0/+6
__builtin_complex to their semantic types. * c-parser.c (c_parser_postfix_expression): Convert operands of __builtin_complex to their semantic types. From-SVN: r177915
2011-08-19c-parser.c (c_parser_postfix_expression): Handle RID_BUILTIN_COMPLEX.Joseph Myers1-0/+47
* c-parser.c (c_parser_postfix_expression): Handle RID_BUILTIN_COMPLEX. * doc/extend.texi (__builtin_complex): Document. c-family: * c-common.c (c_common_reswords): Add __builtin_complex. * c-common.h (RID_BUILTIN_COMPLEX): New. testsuite: * gcc.dg/builtin-complex-err-1.c, gcc.dg/builtin-complex-err-2.c, gcc.dg/dfp/builtin-complex.c, gcc.dg/torture/builtin-complex-1.c: New tests. From-SVN: r177911
2011-08-19c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if pedantic.Joseph Myers1-0/+3
* c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if pedantic. * c-parser.c (c_parser_declspecs): Include _Noreturn in syntax comment. * ginclude/stdnoreturn.h (noreturn): Don't define for C++. testsuite: * gcc.dg/c90-noreturn-1.c, gcc.dg/c99-noreturn-1.c: New tests. From-SVN: r177899
2011-08-18c-decl.c (shadow_tag_warned): Check for _Noreturn.Joseph Myers1-1/+4
* c-decl.c (shadow_tag_warned): Check for _Noreturn. (quals_from_declspecs): Assert _Noreturn not present. (grokdeclarator): Handle _Noreturn. (build_null_declspecs): Initialize noreturn_p. (declspecs_add_scspec): Handle RID_NORETURN. * c-parser.c (c_token_starts_declspecs, c_parser_declspecs) (c_parser_attributes): Handle RID_NORETURN. * c-tree.h (struct c_declspecs): Add noreturn_p. * ginclude/stdnoreturn.h: New. * Makefile.in (USER_H): Add stdnoreturn.h. c-family: * c-common.c (c_common_reswords): Add _Noreturn. (keyword_is_function_specifier): Handle RID_NORETURN. * c-common.h (RID_NORETURN): New. testsuite: * gcc.dg/c1x-noreturn-1.c, gcc.dg/c1x-noreturn-2.c, gcc.dg/c1x-noreturn-3.c, gcc.dg/c1x-noreturn-4.c, gcc.dg/c1x-noreturn-5.c: New tests. From-SVN: r177881
2011-08-02backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated ↵Jakub Jelinek1-50/+399
allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * testsuite/libgomp.c/atomic-11.c: New test. * testsuite/libgomp.c/atomic-12.c: New test. * testsuite/libgomp.c/atomic-13.c: New test. * testsuite/libgomp.c/atomic-14.c: New test. * testsuite/libgomp.c/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-05-27move TS_STATEMENT_LIST to be a substructure of TS_TYPEDNathan Froyd1-1/+1
move TS_STATEMENT_LIST to be a substructure of TS_TYPED gcc/ * c-decl.c (c_push_function_context): Copy the current statement list stack. (add_stmt): Check building_stmt_list_p and push_stmt if necessary. (finish_struct): Call building_stmt_list_p instead of checking cur_stmt_list. * c-parser.c (c_parser_postfix_expression): Likewise. * c-typeck.c (c_end_compound_stmt): Likewise. * print-tree.c (print_node) [STATEMENT_LIST]: Don't print TREE_CHAIN. * tree-iterator.c (stmt_list_cache): Change to a VEC. (alloc_stmt_list): Adjust for stmt_list_cache's new type. (free_stmt_list): Likewise. * tree.h (struct tree_statement_list): Include typed_tree instead of tree_common. * tree.c (initialize_tree_contains_struct): Mark TS_STATEMENT_LIST as TS_TYPED instead of TS_COMMON. gcc/c-family/ * c-common.h (struct stmt_tree_s) [x_cur_stmt_list]: Change to a VEC. (stmt_list_stack): Define. (cur_stmt_list): Adjust for new type of x_cur_stmt_list. * c-semantics.c (push_stmt_list, pop_stmt_list): Likewise. gcc/cp/ * cp-tree.h (building_stmt_tree): Delete. * decl.c (save_function_data): Tweak initializer for x_cur_stmt_list. (build_aggr_init_full_exprs): Call building_stmt_list_p instead of building_stmt_tree. (initialize_local_var): Likewise. (finish_function): Likewise. * decl2.c (finish_anon_union): Likewise. * init.c (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (expand_aggr_init_1): Likewise. * name-lookup.c (do_local_using_decl): Likewise. (do_namespace_alias): Likewise. (do_using_directive): Likewise. (cp_emit_debug_info_for_using): Likewise. * semantics.c (add_stmt): Assert that stmt_list_stack is non-empty. From-SVN: r174343
2011-05-24In gcc/: 2011-05-24 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-8/+29
In gcc/: 2011-05-24 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/48187 * c-parser.c (c_parser_objc_class_instance_variables): More robust parsing of syntax error in ObjC instance variable lists. In particular, avoid an infinite loop if there is a stray ']'. Updated error message. In gcc/cp/: 2011-05-24 Nicola Pero <nicola.pero@meta-innovation.com>, * parser.c (cp_parser_objc_class_ivars): Deal gracefully with a syntax error in declaring an ObjC instance variable. In gcc/testsuite/: 2011-05-24 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/48187 * objc.dg/pr48187.m: New testcase. * obj-c++.dg/pr48187.mm: New testcase. * objc.dg/ivar-extra-semicolon.m: New testcase. From-SVN: r174142
2011-05-05c-decl.c (finish_decl): Don't call get_pending_sizes.Joseph Myers1-26/+26
* c-decl.c (finish_decl): Don't call get_pending_sizes. (grokparm): Add parameter expr. Pass it to grokdeclarator. (push_parm_decl): Add parameter expr. Pass it to grokdeclarator. (c_variable_size): Remove. (grokdeclarator): Use save_expr instead of c_variable_size. Don't call put_pending_sizes. (get_parm_info): Add parameter expr. Use it to set arg_info->pending_sizes. (store_parm_decls): Use arg_info->pending_sizes instead or calling get_pending_sizes. * c-parser.c (c_parser_parms_declarator): Update call to c_parser_parms_list_declarator. (c_parser_parms_list_declarator): Take parameter expr. Update call to push_parm_decl. Update recursive call. Don't call get_pending_sizes. Update calls to get_parm_info. (c_parser_objc_method_definition): Update calls to c_parser_objc_method_decl and objc_start_method_definition. (c_parser_objc_methodproto): Update call to c_parser_objc_method_decl. (c_parser_objc_method_decl): Add parameter expr. Update call to grokparm. (c_parser_objc_try_catch_finally_statement): Update call to grokparm. * c-tree.h (struct c_arg_info.pending_sizes): Change to a tree. (get_parm_info, grokparm, push_parm_decl): Update prototypes. c-family: * c-objc.h (objc_start_method_definition): Update prototype. * stub-objc.c (objc_start_method_definition): Add extra parameter. cp: * parser.c (cp_parser_objc_method_definition_list): Update call to objc_start_method_definition. objc: * objc-act.c (objc_start_method_definition): Add parameter expr. Update call to start_method_def. (objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter, objc_synthesize_setter) Update calls to objc_start_method_definition. (objc_get_parm_info): Add parameter expr. Update call to get_parm_info. (start_method_def): Add parameter expr. Update call to objc_get_parm_info. * objc-gnu-runtime-abi-01.c (build_module_initializer_routine): Update call to objc_get_parm_info. * objc-runtime-shared-support.h (objc_get_parm_info): Add extra parameter. From-SVN: r173422
2011-05-02Upgrade the utility of timevars.Lawrence Crowl1-3/+20
Index: gcc/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * timevar.h (timevar_cond_start): Remove unused POP_TIMEVAR_AND_RETURN. (timevar_cond_start): New for starting a timer only when it is not already running. (timevar_cond_stop): New for stopping a timer when it was not already running. * timevar.c (timevar_stop): Enable start/stop timers to start again. (timevar_cond_start): New as above. (timevar_cond_stop): New as above. * timevar.def: Add start/stop timers for compiler phases, TV_PHASE_SETUP, TV_PHASE_PARSING, TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO (C), TV_PHASE_CHECK_DBGINFO (C++), TV_PHASE_GENERATE, and TV_PHASE_FINALIZE. Change push/pop timer TV_PARSE to TV_PARSE_GLOBAL. Add push/pop timers TV_PARSE_STRUCT, TV_PARSE_ENUM, TV_PARSE_FUNC, TV_PARSE_INLINE, TV_PARSE_INMETH, TV_TEMPLATE_INST. Change push/pop timer TV_NAME_LOOKUP into a start/stop timer. Make unused TV_OVERLOAD into a start/stop timer. Remove unused timers TV_OVERLOAD, TV_TEMPLATE_INSTANTIATION. Mark the strings for TV_NAME_LOOKUP and TV_OVERLOAD with a "|" to indicate that they are start/stop timers. * toplev.c (compile_file): Change TV_PARSE to TV_PARSE_GLOBAL. Add start/stop timers TV_PHASE_PARSING and TV_PHASE_GENERATE. Move initialization to do_compile. (do_compile): Add initialization from above. Add start/stop timers TV_PHASE_SETUP and TV_PHASE_FINALIZE. * c-decl.c (c_write_global_declarations): Add start/stop of TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO. * c-parser.c (c_parser_declaration_or_fndef): Push/pop TV_PARSE_FUNC or TV_PARSE_INLINE, as appropriate. (c_parser_enum_specifier): Push/pop TV_PARSE_ENUM. (c_parser_struct_or_union_specifier): Push/pop TV_PARSE_STRUCT. Index: gcc/cp/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop. (poplevel): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (define_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (xref_tag): Likewise. (lookup_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. * pt.c: (instantiate_class_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (instantiate_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (lookup_template_class): Refactor timevar calls out to a wrapper function. Change use of TV_NAME_LOOKUP to TV_TEMPLATE_INST. (instantiate_decl): Change TV_PARSE to TV_TEMPLATE_INST. * name-lookup.c: (store_bindings): Change TV_NAME_LOOKUP to start/stop. (poplevel_class): Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_namespace): Likewise. (pop_nested_namespace): Likewise. (pushdecl_namespace_level): Likewise. (store_class_bindings): Likewise. (push_to_top_level): Likewise. (identifier_type_value): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (find_binding): Likewise. (push_using_decl): Likewise. (lookup_arg_dependent): Likewise. (push_using_directive): Likewise. (qualified_lookup_using_namespace): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (lookup_type_current_level): Likewise. Refactor inner return to break. (pushdecl_class_level): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start_cond/stop_cond. (pushdecl_top_level_1): Likewise. (lookup_using_namespace): Likewise. (pushdecl_with_scope): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_overloaded_decl): Likewise. (push_class_level_binding): Likewise. (namespace_binding): Likewise. (set_namespace_binding): Likewise. (supplement_binding): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_name_real): Likewise. (lookup_type_scope): Likewise. (namespace_ancestor): Likewise. (lookup_name_innermost_nonclass_level): Likewise. (pushtag): Likewise. (pop_from_top_level): Likewise. (pushdecl_maybe_friend): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Wrap long lines. (add_using_namespace): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Bypass wrapper on call to self. * decl2.c: (cp_write_global_declarations): Add start/stop of new TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_CHECK_DBGINFO. Remove push/pop calls to TV_VARCONST. * parser.c: Add include of "timevar.h". (cp_parser_explicit_instantiation): Add push/pop calls to TV_TEMPLATE_INST. (cp_parser_enum_specifier): Add push/pop calls to new TV_PARSE_ENUM. (cp_parser_class_specifier): Add wrapper to add push/pop calls to TV_PARSE_STRUCT. (cp_parser_function_definition_from_specifiers_and_declarator): Add push/pop calls to new TV_PARSE_FUNC or TV_PARSE_INLINE. (cp_parser_late_parsing_for_member): Add push/pop calls to new TV_PARSE_INMETH. * call.c: Add include of "timevar.h". (convert_class_to_reference): Wrap and add push/pop calls to TV_OVERLOAD. (build_op_call): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (build_user_type_conversion): Reorganize to single return and add push/pop calls to TV_OVERLOAD. (perform_overload_resolution): Likewise. * Make-lang.in: Add dependence of call.o and parser.o on $(TIMEVAR_H). From-SVN: r173277
2011-04-14In gcc/c-family/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-3/+1
In gcc/c-family/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * stub-objc.c (objc_declare_protocols): Renamed to objc_declare_protocol. * c-objc.h: Likewise. In gcc/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_protocol_definition): Updated for change from objc_declare_protocols() to objc_declare_protocol(). In gcc/objc/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_declare_protocols): Renamed to objc_declare_protocol. Changed first argument to be an identifier instead of a tree chain of identifiers, so that callers don't have to create a temporary tree chain. In gcc/cp/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_protocol_declaration): Updated for change from objc_declare_protocols() to objc_declare_protocol(). From-SVN: r172444
2011-04-14In gcc/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-3/+1
In gcc/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_class_declaration): Updated call to objc_declare_class. In gcc/c-family/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * stub-objc.c (objc_declare_class): Updated argument name. In gcc/cp/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_class_declaration): Updated for change in objc_declare_class(). In gcc/objc/: 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_declare_class): Changed to take a single identifier as argument instead of a tree list. This means callers don't have to build temporary tree lists to call this function. (synth_module_prologue): Updated calls to objc_declare_class. From-SVN: r172425
2011-04-12In gcc/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-3/+2
In gcc/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_initelt): Updated call to objc_build_message_expr. (c_parser_postfix_expression): Likewise. In gcc/c-family/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com> * c-objc.h (objc_build_message_expr): Updated prototype. * stub-objc.c (objc_build_message_expr): Likewise. In gcc/objc/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_build_message_expr): Accept two arguments instead of one so that callers can simply pass the arguments without having to create a temporary chain to hold them. In gcc/cp/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_message_expression): Updated call to objc_build_message_expr. From-SVN: r172338
2011-04-12In gcc/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-2/+1
In gcc/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_lex_one_token): Rewritten conditional used when compiling Objective-C to be more efficient. In gcc/objc/: 2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_is_class_name, objc_is_id): For efficiency, avoid calling identifier_global_value() multiple times. From-SVN: r172327
2011-03-14c-parser.c (c_parser_asm_string_literal): Clear warn_overlength_strings.Tom Tromey1-0/+3
gcc * c-parser.c (c_parser_asm_string_literal): Clear warn_overlength_strings. gcc/testsuite * gcc.dg/Woverlength-strings-pedantic-c90-asm.c: New file. * gcc.dg/Woverlength-strings-pedantic-c89-asm.c: New file. * gcc.dg/Woverlength-strings-pedantic-c99-asm.c: New file. From-SVN: r170948
2011-03-14c-parser.c (disable_extension_diagnostics): Save warn_overlength_strings.Tom Tromey1-1/+4
gcc * c-parser.c (disable_extension_diagnostics): Save warn_overlength_strings. (restore_extension_diagnostics): Restore warn_overlength_strings. gcc/testsuite * gcc.dg/Woverlength-strings-pedantic-c89-ext.c: New file. * gcc.dg/Woverlength-strings-pedantic-c90-ext.c: New file. * gcc.dg/Woverlength-strings-pedantic-c99-ext.c: New file. From-SVN: r170947
2011-01-19c-parser.c (c_parser_for_statement): Initialize collection_expression.Alexandre Oliva1-1/+3
* c-parser.c (c_parser_for_statement): Initialize collection_expression. From-SVN: r169033
2011-01-12In gcc/: 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-12/+12
In gcc/: 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_at_property_declaration): Improved error message. 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_lex_one_token): Updated and reindented some comments. No changes in code. In gcc/cp/: 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_at_property_declaration): Improved error message. In gcc/testsuite/: 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/property/at-property-29.m: New. * obj-c++.dg/property/at-property-29.mm: New. From-SVN: r168698
2011-01-09In gcc/: 2011-01-09 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-2/+1
In gcc/: 2011-01-09 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/47232 * c-parser.c (c_parser_declaration_or_fndef): Improved error message. In gcc/testsuite/: 2011-01-09 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/47232 * objc.dg/attributes/invalid-attribute-1.m: New. * obj-c++.dg/attributes/invalid-attribute-1.mm: New. From-SVN: r168619
2011-01-08In gcc/: 2011-01-08 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-0/+8
In gcc/: 2011-01-08 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/47078 * c-parser.c (c_parser_objc_type_name): If the type is unknown, for error recovery purposes behave as if it was not specified so that the default type is usd. In gcc/testsuite/: 2011-01-08 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/47078 * objc.dg/invalid-method-2.m: New. * obj-c++.dg/invalid-method-2.mm: New. In gcc/cp/: 2011-01-08 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/47078 * parser.c (cp_parser_objc_typename): If the type is unknown, for error recovery purposes behave as if it was not specified so that the default type is used. From-SVN: r168601
2011-01-05c-parser.c (c_parser_omp_atomic): Pass location of assignment operator to ↵Tom Tromey1-1/+4
c_finish_omp_atomic. gcc * c-parser.c (c_parser_omp_atomic): Pass location of assignment operator to c_finish_omp_atomic. * c-typeck.c (lvalue_or_else): Add 'loc' argument. (build_unary_op): Update. (build_modify_expr): Update. (build_asm_expr): Update. gcc/cp * typeck.c (cp_build_addr_expr_1): Update call to lvalue_error. (lvalue_or_else): Likewise. gcc/c-family * c-common.h (lvalue_error): Update. * c-common.c (lvalue_error): Add 'loc' argument. Call error_at, not error. From-SVN: r168514
2010-12-18In gcc/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-0/+2
In gcc/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_try_catch_finally_statement): Call objc_maybe_warn_exceptions. (c_parser_objc_synchronized_statement): Call objc_maybe_warn_exceptions. In gcc/cp/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_try_catch_finally_statement): Call objc_maybe_warn_exceptions. (cp_parser_objc_synchronized_statement): Same change. In gcc/c-family/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com> * c-objc.h (objc_maybe_warn_exceptions): New. * stub-objc.c (objc_maybe_warn_exceptions): New. In gcc/objc/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_init): Call using_eh_for_cleanups. (objc_init_exceptions): Renamed to objc_maybe_warn_exceptions. Do not call using_eh_for_cleanups. (objc_begin_try_stmt): Do not call objc_init_exceptions. (objc_build_throw_stmt): Updated call to objc_maybe_warn_exceptions. In gcc/testsuite/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/fobjc-exceptions-1.m: Updated. * objc.dg/fobjc-exceptions-2.m: New. * objc.dg/fobjc-exceptions-3.m: New. * obj-c++.dg/fobjc-exceptions-1.mm: New. * obj-c++.dg/fobjc-exceptions-2.mm: New. * obj-c++.dg/fobjc-exceptions-3.mm: New. From-SVN: r168032
2010-12-17re PR c/20385 (Lame parse error message for undefined type)Paolo Bonzini1-77/+119
gcc: 2010-12-17 Paolo Bonzini <bonzini@gnu.org> PR c/20385 * function.c (used_types_insert): Handle ERROR_MARK. * c-decl.c (grokdeclarator): Handle ERROR_MARK. (declspecs_add_type): Leave error_mark_node in specs->type. (finish_declspecs): Change it to integer_type_node here. * c-parser.c (c_parser_peek_2nd_token): Move earlier. (enum c_lookahead_kind): New. (c_parser_next_token_starts_typename): New name of c_parser_next_tokens_start_typename. Accept lookahead enum and handle it here instead of... (c_parser_next_tokens_start_declaration): ... here. Call it. (c_parser_declspecs): Accept another argument. Do not exit on C_ID_ID if it is guessed to be an unknown typename. (c_parser_parms_declarator): Use 2nd token to distinguish a K&R declaration from an ANSI declaration starting with an unknown typename. (c_parser_struct_declaration, c_parser_objc_type_name, c_parser_typeof_specifier, c_parser_declarator, c_parser_direct_declarator_inner): Adjust calls. (c_parser_parameter_declaration): Likewise. (c_parser_type_name): Pass back an error_mark_node to the caller. (c_parser_postfix_expression): Do error recovery when c_parser_type_name returns NULL. testsuite: 2010-12-17 Paolo Bonzini <bonzini@gnu.org> PR c/20385 * objc.dg/tls/init-2.m: Adjust. * gcc.dg/noncompile/920923-1.c: Adjust. * gcc.dg/noncompile/pr44517.c: Adjust. * gcc.dg/declspec-18.c: New test. From-SVN: r167999
2010-12-10In gcc/: 2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-5/+19
In gcc/: 2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_class_definition): Recognize Objective-C 2.0 class extensions. In gcc/cp/: 2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_superclass_or_category): Recognize Objective-C 2.0 class extensions. Added iface_p and is_class_extension arguments. (cp_parser_objc_class_interface): Updated call to cp_parser_objc_superclass_or_category. (cp_parser_objc_class_implementation): Same change. In gcc/objc/: 2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_in_class_extension): New. (objc_start_category_interface): If -fobjc-std=objc1 was specified, produce an error if a class extension is used. (objc_finish_interface): Reset objc_in_class_extension to false. (objc_add_property_declaration): Allow a class extension to extend readonly properties in the main @interface to be readwrite. (start_class): Added code to deal with class extensions. In that case, return the existing interface after adding any additional protocols to it and setting objc_in_class_extension to true. (continue_class): If in a class extension, do not generate the instance variable template. In gcc/testsuite/: 2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/class-extension-1.m: New. * objc.dg/class-extension-2.m: New. * objc.dg/class-extension-3.m: New. * objc.dg/property/at-property-26.m: New. * objc.dg/property/at-property-27.m: New. * objc.dg/property/at-property-28.m: New. * obj-c++.dg/class-extension-1.mm: New. * obj-c++.dg/class-extension-2.mm: New. * obj-c++.dg/class-extension-3.mm: New. * obj-c++.dg/property/at-property-26.mm: New. * obj-c++.dg/property/at-property-27.mm: New. * obj-c++.dg/property/at-property-28.mm: New. From-SVN: r167680
2010-12-07In gcc/: 2010-12-07 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-5/+0
In gcc/: 2010-12-07 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_typeof_specifier): Removed special treatment of objc_volatilized attribute for Objective-C. From-SVN: r167526
2010-12-06In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-3/+3
In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_for_statement): Use c_fully_fold() instead of c_process_expr_stmt() for the iterating and collection expressions of an Objective-C fast enumeration loop. In gcc/objc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_finish_foreach_loop): Mark the object_expression as used. In gcc/testsuite/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/foreach-8.m: New. From-SVN: r167518
2010-12-06In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-0/+1
In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * c-family/c-common.h: Removed the declarations of all the objc_ callbacks, and moved them into c-objc.h. Removed objc_ivar_visibility_kind and moved it into c-objc.h. * c-family/c-objc.h: New file. * c-family/c-common.c: Include c-objc.h. * c-family/c-format.c: Same change. * c-family/stub-objc.c: Same change. * c-decl.c: Include c-family/c-objc.h. * c-parser.c: Same change. * c-typeck.c: Same change. * c-config-lang.in (gtfiles): Added c-family/c-objc.h. * Makefile.in (c-decl.o): Depend on c-family/c-objc.h. (c-parser.o): same change. (c-typeck.o): Same change. (c-family/c-format.o): Same change. (c-family/stub-objc.o): Same change. (c-family/c-common.o): Same change. (PLUGIN_HEADERS): Added c-family/c-objc.h. In gcc/cp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * call.c: Include c-family/c-objc.h. * decl.c: Same change. * decl2.c: Same change. * error.c: Same change. * lex.c: Same change. * parser.c: Same change. * pt.c: Same change. * semantics.c: Same change. * typeck.c: Same change. * Make-lang.in (cp/decl.o): Depend on c-family/c-objc.h. (cp/decl2.o): Same change. (cp/call.o): Same change. (cp/error.o): Same change. (cp/lex.o): Same change. (cp/parser.o): Same change. (cp/pt.o): Same change. (cp/semantics.o): Same change. (cp/typeck.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c: Include c-family/c-objc.h. * objc-lang.c: Same change. * Make-lang.in (objc/objc-act.o): Depend on c-family/c-objc.h. (objc/objc-lang.o): Same change. * config-lang.in (gtfiles): Added c-family/c-objc.h. In gcc/objcp/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> * config-lang.in (gtfiles): Added c-family/c-objc.h. * Make-lang.in (objcp/objcp-act.o): Depend on c-family/c-objc.h. (objcp/objcp-lang.o): Same change. (objcp/objcp-decl.o): Same change. * objcp-lang.c: Include c-family/c-objc.h. * objcp-decl.c: Same change. From-SVN: r167481
2010-11-30diagnostic-core.h: Include bversion.h.Joseph Myers1-1/+0
* diagnostic-core.h: Include bversion.h. * toplev.h: Don't include input.h or bversion.h. (parse_optimize_options): Don't declare here. * alias.c, auto-inc-dec.c, c-aux-info.c, c-convert.c, c-parser.c, caller-save.c, cfg.c, cfganal.c, cfgbuild.c, cfgcleanup.c, combine-stack-adj.c, config/arm/pe.c, config/darwin-c.c, config/host-darwin.c, config/i386/host-cygwin.c, config/i386/host-mingw32.c, config/i386/msformat-c.c, config/i386/netware.c, config/i386/nwld.c, config/i386/winnt-cxx.c, config/i386/winnt-stubs.c, config/ia64/ia64-c.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/microblaze/microblaze-c.c, config/rs6000/host-darwin.c, config/rs6000/rs6000-c.c, config/score/score3.c, config/score/score7.c, config/sh/symbian-base.c, config/sh/symbian-c.c, config/sh/symbian-cxx.c, config/sol2-c.c, config/sol2.c, config/v850/v850-c.c, config/vxworks.c, convert.c, cppbuiltin.c, cselib.c, dbgcnt.c, ddg.c, dfp.c, dominance.c, emit-rtl.c, fixed-value.c, fwprop.c, ggc-common.c, gimple.c, gimplify.c, graphite-blocking.c, graphite-clast-to-gimple.c, graphite-dependences.c, graphite-flattening.c, graphite-interchange.c, graphite-poly.c, graphite-scop-detection.c, graphite.c, haifa-sched.c, implicit-zee.c, integrate.c, ipa-pure-const.c, ipa-reference.c, ira-build.c, ira-conflicts.c, ira-costs.c, ira-lives.c, jump.c, lists.c, loop-doloop.c, loop-iv.c, lto-cgraph.c, lto-compress.c, lto-opts.c, lto-section-in.c, lto-section-out.c, lto-streamer-out.c, lto-symtab.c, modulo-sched.c, optabs.c, params.c, postreload-gcse.c, postreload.c, predict.c, profile.c, regcprop.c, reginfo.c, regmove.c, reorg.c, resource.c, sched-deps.c, sched-ebb.c, sched-rgn.c, sdbout.c, sel-sched-dump.c, sel-sched-ir.c, sese.c, stmt.c, targhooks.c, tree-cfgcleanup.c, tree-mudflap.c, tree-nomudflap.c, tree-object-size.c, tree-outof-ssa.c, tree-phinodes.c, tree-profile.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-operands.c, tree-ssa-structalias.c, tree-ssa-uninit.c, tree-vect-patterns.c, value-prof.c, var-tracking.c, web.c: Don't include toplev.h. * Makefile.in (TOPLEV_H): Remove. All uses changed to use toplev.h. Dependencies for above files and c-family files changed to remove $(TOPLEV_H) or toplev.h. (C_TREE_H): Don't include $(TOPLEV_H). (DIAGNOSTIC_CORE_H): Use $(INPUT_H) instead of input.h. Add bversion.h. * config/arm/t-pe, config/arm/t-wince-pe, config/i386/t-cygming, config/ia64/t-ia64, config/mep/t-mep, config/score/t-score-elf, config/t-darwin, config/t-sol2, config/t-vxworks, config/v850/t-v850, config/v850/t-v850e: Dependencies for above files changed to remove $(TOPLEV_H) or toplev.h. c-family: * c-common.h (parse_optimize_options): Declare. * c-cppbuiltin.c, c-format.c, c-gimplify.c, c-lex.c, c-omp.c, c-pch.c, c-pragma.c, c-semantics.c: Don't include toplev.h. cp: * cp-gimplify.c, cp-lang.c, cvt.c, cxx-pretty-print.c, error.c, except.c, expr.c, friend.c, init.c, mangle.c, name-lookup.c, optimize.c, parser.c, rtti.c, tree.c, typeck2.c: Don't include toplev.h. * Make-lang.in: Dependencies for above files changed to remove toplev.h. java: * expr.c, lang.c, mangle.c, mangle_name.c, typeck.c, verify-glue.c: Don't include toplev.h. * Make-lang.in: Dependencies for above files changed to remove toplev.h. lto: * Make-lang.in (lto/lto-object.o): Depend on toplev.h instead of $(TOPLEV_H). From-SVN: r167293
2010-11-29In gcc/objc/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-23/+67
In gcc/objc/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_eh_runtime_type): Avoid ICE if error_mark_node is passed as argument. (objc_begin_catch_clause): Added code to deal with an error_mark_node or NULL_TREE argument. Improved checks for invalid arguments. Added code to traverse typedefs. In gcc/testsuite/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/exceptions-1.m: New. * objc.dg/exceptions-2.m: New. * objc.dg/exceptions-3.m: New. * objc.dg/exceptions-4.m: New. * objc.dg/exceptions-5.m: New. * obj-c++.dg/exceptions-1.mm: New. * obj-c++.dg/exceptions-2.mm: New. * obj-c++.dg/exceptions-3.mm: New. * obj-c++.dg/exceptions-4.mm: New. * obj-c++.dg/exceptions-5.mm: New. In gcc/cp/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_try_catch_finally_statement): Parse @catch(...) and pass NULL_TREE to objc_begin_catch_clause() in that case. Improved error recovery. Reorganized code to be almost identical to c_parser_objc_try_catch_finally_statement. In gcc/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_try_catch_statement): Renamed to c_parser_objc_try_catch_finally_statement for consistency with the C++ parser. Parse @catch(...) and pass NULL_TREE to objc_begin_catch_clause() in that case. Improved error recovery. Reorganized code to be almost identical to cp_parser_objc_try_catch_finally_statement. From-SVN: r167233
2010-11-19In gcc/: 2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-1/+1
In gcc/: 2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_protocol_definition): Pass attributes to objc_declare_protocols. In gcc/c-family/: 2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (objc_declare_protocols): Added additional argument. * stub-objc.c (objc_declare_protocol): Same change. In gcc/cp/: 2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_protocol_declaration): Pass attributes to objc_declare_protocols. In gcc/objc/: 2010-11-19 Nicola Pero <nicola@nicola.brainstorm.co.uk> * objc-act.c (lookup_protocol): Added 'warn_if_deprecated' argument. If it is 'true' and the protocol is deprecated, emit a deprecation warning. (objc_start_protocol): Do not warn that protocol attributes are unimplemented. Pass the attributes to start_protocol. (start_protocol): Added attributes argument. Recognize the 'deprecated' attribute and mark the protocols with TREE_DEPRECATED if present. Store attributes in the protocol. (objc_declare_protocols): Added 'attributes' argument. Recognize the 'deprecated' attribute and mark the protocols with TREE_DEPRECATED if present. Store attributes in the protocol. Updated call to lookup_protocol. (objc_build_protocol_expr): Updated call to lookup_protocol. (check_protocol_recursively): Same change. (lookup_and_install_protocols): Same change. * objc-act.h: Updated comments. In gcc/testsuite/: 2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/attributes/proto-attribute-1.m: Updated. * objc.dg/attributes/proto-attribute-2.m: New. * objc.dg/attributes/proto-attribute-3.m: New. * obj-c++.dg/attributes/proto-attribute-1.mm: Updated. * obj-c++.dg/attributes/proto-attribute-2.mm: New. * obj-c++.dg/attributes/proto-attribute-3.mm: New. From-SVN: r166938
2010-11-17c-parser.c (c_token_is_qualifier, [...]): New.Paolo Bonzini1-8/+93
2010-11-17 Paolo Bonzini <bonzini@gnu.org> * c-parser.c (c_token_is_qualifier, c_parser_next_token_is_qualifier): New. (c_parser_declaration_or_fndef, c_parser_struct_declaration): Improve error message on specs->tagdef_seen_p. (c_parser_struct_or_union_specifier): Improve error recovery. (c_parser_declspecs): Move exit condition on C_ID_ID early. Reorganize exit condition for C_ID_TYPENAME/C_ID_CLASSNAME using c_parser_next_token_is_qualifier; extend it to cover a ctsk_tagdef typespec and !typespec_ok in general. testsuite: 2010-11-17 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/two-types-1.c: New test. * gcc.dg/two-types-2.c: New test. * gcc.dg/two-types-3.c: New test. * gcc.dg/two-types-4.c: New test. * gcc.dg/two-types-5.c: New test. * gcc.dg/two-types-6.c: New test. * gcc.dg/two-types-7.c: New test. * gcc.dg/two-types-8.c: New test. * gcc.dg/two-types-9.c: New test. * gcc.dg/two-types-10.c: New test. * objc.dg/two-types-1.m: New test. From-SVN: r166874
2010-11-14re PR c/46462 (Revision 166700 caused new C test failures)Paolo Bonzini1-5/+10
2010-11-13 Paolo Bonzini <bonzini@gnu.org> PR c/46462 * c-decl.c (declspecs_add_type): Make variables with error types integers. * c-parser.c (c_parser_next_tokens_start_declaration): Two IDs do not start a declaration before an Objective-C foreach. (c_parser_declaration_or_fndef): Improve recovery after unknown type name. (c_parser_for_statement): Hoist entrance of "foreach context" before ifs, add corresponding reset where it was missing. Do not set objc_could_be_foreach_context for C. From-SVN: r166732
2010-11-13[multiple changes]Paolo Bonzini1-9/+41
2010-10-30 Paolo Bonzini <bonzini@gnu.org> PR c/20385 * c-parser.c (c_parser_next_token_starts_declaration): Rename to... (c_parser_next_tokens_start_declaration): ... this. Handle 2nd token lookahead. (c_parser_compound_statement_nostart, c_parser_label, c_parser_for_statement, c_parser_omp_for_loop): Adjust calls. (c_parser_declaration_or_fndef): Detect the case now matched by c_parser_next_tokens_start_declaration, give error and correct it. testsuite: 2010-11-13 Paolo Bonzini <bonzini@gnu.org> PR c/20385 * gcc.dg/decl-9.c: New. From-SVN: r166700
2010-11-13c-tree.h (enum c_typespec_kind): Add ctsk_none.Paolo Bonzini1-7/+12
2010-11-13 Paolo Bonzini <bonzini@gnu.org> * c-tree.h (enum c_typespec_kind): Add ctsk_none. (struct c_declspecs): Replace tagdef_seen_p and type_seen_p with typespec_kind. * c-decl.c (build_null_declspecs): Initialize typespec_kind. (shadow_tag_warned, check_compound_literal_type): Adjust uses of tag_defined_p. (declspecs_add_type): Set typespec_kind. * c-parser.c (c_parser_declaration_or_fndef, c_parser_declspecs, c_parser_struct_declaration, c_parser_parameter_declaration, c_parser_type_name, c_parser_objc_diagnose_bad_element_prefix): Adjust uses of type_seen_p. * c-typeck.c (c_cast_expr): Use typespec_kind instead of tag_defined_p, pass ctsk_firstref through. testsuite: 2010-11-13 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/Wcxx-compat-8.c: Add testcases involving incomplete types. From-SVN: r166699
2010-11-10c-parser.c (c_parser_struct_declaration): Handle declaration specifiers ↵Joseph Myers1-1/+2
followed by CPP_CLOSE_BRACE. * c-parser.c (c_parser_struct_declaration): Handle declaration specifiers followed by CPP_CLOSE_BRACE. testsuite: * gcc.dg/struct-semi-4.c: New test. From-SVN: r166516
2010-11-06NS/CF String format syntax parsing.Iain Sandoe1-2/+5
gcc: PR target/44981 * doc/extend.tex (format): Document NSString extension. (format_arg): Likewise. (Darwin Format Checks): New section. * doc/tm.texi: Document string object hooks (generated). * doc/tm.texi.in (TARGET_OBJC_CONSTRUCT_STRING_OBJECT) Rename. (TARGET_STRING_OBJECT_REF_TYPE_P): New. (TARGET_CHECK_STRING_OBJECT_FORMAT_ARG): New. * target.def (objc_construct_string_object): Rename, amend documentation. (string_object_ref_type_p): New hook. (check_string_object_format_arg): New hook. * c-parser.c (c_parser_attributes): Allow objective-c class names as attribute identifiers. * config/darwin-c.c (darwin_cfstring_ref_p): New. (darwin_check_cfstring_format_arg): New. (darwin_additional_format_types): New. * config/darwin-protos.h (darwin_cfstring_ref_p) New. (darwin_check_cfstring_format_arg): New. * config/darwin.h (TARGET_OBJC_CONSTRUCT_STRING_OBJECT) Renamed. (TARGET_STRING_OBJECT_REF_TYPE_P): New. (TARGET_N_FORMAT_TYPES): New. (TARGET_CHECK_STRING_OBJECT_FORMAT_ARG): New. gcc/c-family: PR target/44981 * c-format.c (format_type): New type gcc_objc_string_format_type. (valid_stringptr_type_p): New. (handle_format_arg_attribute): Use valid_stringptr_type_p (). (check_format_string): Pass expected type, use valid_stringptr_type_p (), check that the format string types are consistent with the format specification. (decode_format_attr): Warn if NSString is used outside objective-c. (format_types_orig): Add NSString. (format_name): New. (format_flags): New. (check_format_arg): Handle format strings requiring an external parser. first_target_format_type: New variable. (handle_format_attribute): Set up first_target_format_type, pass the expected format arg string type to check_format_string(). * c-common.h (FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL): New flag. * stub-objc.c (objc_string_ref_type_p): New. (objc_check_format_arg): New. gcc/objc: PR target/44981 * objc-act.c (objc_build_string_object): Amend for renamed hook. (objc_string_ref_type_p): New. (objc_check_format_arg): New. gcc/testsuite: PR target/44981 * gcc.dg/darwin-cfstring-format-1.c: New. * gcc.dg/warn-nsstring.c: New. * objc.dg/fsf-nsstring-format-1.m: New. * obj-c++.dg/fsf-nsstring-format-1.mm: New. * obj-c++.dg/torture/strings/const-cfstring-1.mm: Update for darwin10 linker warning. From-SVN: r166398
2010-11-04In gcc/: 2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-9/+59
In gcc/: 2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com> Fixed using the Objective-C 2.0 dot-syntax with class names. * c-parser.c (c_parser_next_token_starts_declspecs): In Objective-C, detect Objective-C 2.0 dot-syntax with a class name. (c_parser_next_token_starts_declaration): Same. (c_parser_postfix_expression): Parse the Objective-C 2.0 dot-syntax with a class name. In gcc/cp/: 2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com> Fixed using the Objective-C 2.0 dot-syntax with class names. * parser.c (cp_parser_primary_expression): Recognize Objective-C 2.0 dot-syntax with class names and process it. (cp_parser_nonclass_name): Recognize Objective-C 2.0 dot-syntax with class names. (cp_parser_class_name): Same change. (cp_parser_simple_type_specifier): Tidied comments. In gcc/c-family/: 2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com> Fixed using the Objective-C 2.0 dot-syntax with class names. * c-common.h (objc_build_class_component_ref): New. * stub-objc.c (objc_build_class_component_ref): New. In gcc/objc/: 2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com> Fixed using the Objective-C 2.0 dot-syntax with class names. * objc-act.c (objc_build_class_component_ref): New. In gcc/testsuite/: 2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com> Fixed using the Objective-C 2.0 dot-syntax with class names. * objc.dg/property/dotsyntax-3.m: New. * objc.dg/property/dotsyntax-4.m: New. * obj-c++.dg/property/dotsyntax-3.mm: New. * obj-c++.dg/property/dotsyntax-4.mm: New. * objc.dg/fobjc-std-1.m: Added test for warnings when the Objective-C 2.0 dot-syntax is used with class names. * obj-c++.dg/fobjc-std-1.mm: Same change. From-SVN: r166333
2010-10-30In gcc/: 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-19/+3
In gcc/: 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com> Implemented Objective-C 2.0 @property, @synthesize and @dynamic. * c-parser.c (c_parser_objc_at_property_declaration): Removed parsing of RID_COPIES and RID_IVAR. Updated call to objc_add_property_declaration. * c-typecheck.c (build_component_ref): Call objc_maybe_build_component_ref instead of objc_build_setter_call. Use objc_is_property_ref to improve Objective-C checks. (cp_build_modify_expr): Call objc_maybe_build_modify_expr instead of objc_build_getter_call. In gcc/c-family/: 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com> Implemented Objective-C 2.0 @property, @synthesize and @dynamic. * c-common.h (enum rid): Removed RID_COPIES and RID_IVAR. (objc_add_property_declaration): Removed arguments for copies and ivar. (objc_build_getter_call): Renamed to objc_maybe_build_component_ref. (objc_build_setter_call): Renamed to objc_maybe_build_modify_expr. (objc_is_property_ref): New. * c-common.c (c_common_reswords): Removed copies and ivar. * stub-objc.c (objc_add_property_declaration): Removed arguments for copies and ivar. (objc_build_getter_call): Renamed to objc_maybe_build_component_ref. (objc_build_setter_call): Renamed to objc_maybe_build_modify_expr. (objc_is_property_ref): New. In gcc/cp/: 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com> Implemented Objective-C 2.0 @property, @synthesize and @dynamic. * parser.c (cp_parser_objc_at_property_declaration): Removed parsing of RID_COPIES and RID_IVAR. Updated call to objc_add_property_declaration. * typecheck.c (finish_class_member_access_expr): Call objc_maybe_build_component_ref instead of objc_build_setter_call. (cp_build_modify_expr): Call objc_maybe_build_modify_expr instead of objc_build_getter_call. In gcc/objc/: 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com> Implemented Objective-C 2.0 @property, @synthesize and @dynamic. * objc-tree.def (PROPERTY_REF): New. * objc-act.h: Added comments for all the PROPERTY_ macros. (PROPERTY_NAME): Use DECL_NAME. (PROPERTY_COPIES): Removed. (PROPERTY_READONLY): Use DECL_LANG_FLAG_0 for it. (PROPERTY_NONATOMIC): New. (objc_property_assign_semantics): Make it a typedef. (PROPERTY_ASSIGN_SEMANTICS): New. (PROPERTY_DYNAMIC): New. (PROPERTY_REF_OBJECT): New. (PROPERTY_REF_PROPERTY_DECL): New. * objc-act.c (CALL_EXPR_OBJC_PROPERTY_GETTER): Removed. (in_objc_property_setter_name_context): Removed. (objc_add_property_declaration): Removed copies and ivar arguments and code supporting them. Fixed recovering when readonly and setter attributes are specified. Removed support for @property in @implementation context. Updated error message. Double-check that a property does not have a DECL_INITIAL. Validate the property assign semantics and emit appropriate errors and warnings. Check for duplicate property declarations. Set DECL_SOURCE_LOCATION, TREE_DEPRECATED, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS and PROPERTY_DYNAMIC of the new PROPERTY_DECL. Do not set PROPERTY_COPIES. Set PROPERTY_IVAR_NAME to NULL_TREE. (objc_build_getter_call): Renamed to objc_maybe_build_component_ref. If the property is not found in the interface, search in the protocol list. Do not generate the getter call; instead, build and return a PROPERTY_REF. (objc_is_property_ref): New. (objc_setter_func_call): Removed. (get_selector_from_reference): Removed. (is_property): Removed. (objc_build_setter_call): Renamed to objc_maybe_build_modify_expr. Updated to work on a PROPERTY_REF and use the PROPERTY_DECL from the PROPERTY_REF. Generate an error if the property is read-only. (build_property_reference): Removed. (objc_finish_message_expr): Removed check to produce "readonly property can not be set" error when in_objc_property_setter_name_context. We now generate the error earlier, in objc_maybe_build_modify_expr, which will only generate the setter call if the property is readwrite. (check_methods): Recognize dynamic properties. (check_methods_accessible): Same change. (objc_build_property_ivar_name): Removed. (objc_build_property_setter_name): Dropped bool argument. Always add the ':' at the end. (objc_gen_one_property_datum): Removed. (objc_process_getter_setter): Removed. (objc_synthesize_getter): Mark 'klass' argument as unused. Use PROPERTY_GETTER_NAME instead of PROPERTY_NAME. Set the DECL_SOURCE_LOCATION of the new method to be the same as the one for the @synthesize. Always use PROPERTY_IVAR_NAME as it is instead of trying to guess what it should be. Removed use of CLASS_IVARS. Use the location of @synthesize for c_finish_return and c_end_compound_statement. (objc_synthesize_setter): Mark 'klass' argument as unused. Use PROPERTY_SETTER_NAME instead of trying to guess what it should be. Set the DECL_SOURCE_LOCATION of the new method to be the same as the one for the @synthesize. Always use PROPERTY_IVAR_NAME as it is instead of trying to guess what it should be. Removed use of CLASS_IVARS. Use the location of @synthesize for c_finish_return and c_end_compound_statement. Emit an error and keep going, instead of aborting, if the setter prototype does not have the expected argument. (objc_add_synthesize_declaration_for_property): New. (objc_add_synthesize_declaration): Removed ATTRIBUTE_UNUSED from all arguments. Improved error message. Filled in the rest of the function, which used to be a placeholder, with an actual implementation. (objc_add_dynamic_declaration_for_property): New. (objc_add_dynamic_declaration): Removed ATTRIBUTE_UNUSED from all arguments. Improved error message. Filled in the rest of the function, which used to be a placeholder, with an actual implementation. (objc_gen_property_data): Rewritten. (finish_class): Added explicit switch cases for CLASS_INTERFACE_TYPE, CATEGORY_INTERFACE_TYPE and PROTOCOL_INTERFACE_TYPE. Added a default switch case which is gcc_unreachable. Rewritten the processing of properties, in particular to not synthesize prototypes for getters and setters if they already exist and to install the getter and setter names into PROPERTY_GETTER_NAME and PROPERTY_SETTER_NAME. Do not generate warnings about setter, getter and ivar property attributes. (objc_lookup_ivar): Removed support for properties. (objc_gimplify_property_ref): New. (objc_gimplify_expr): Use a switch. In case of a PROPERTY_REF, call objc_gimplify_property_ref. In gcc/testsuite/: 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com> Implemented Objective-C 2.0 @property, @synthesize and @dynamic. * objc.dg/property/property-neg-1.m: Updated for changes in the syntax of @property and the implementation of @synthesize/@dynamic. * objc.dg/property/property-neg-2.m: Same change. * objc.dg/property/property-neg-3.m: Same change. * objc.dg/property/property-neg-4.m: Same change. * objc.dg/property/property-neg-5.m: Same change. * objc.dg/property/property-neg-7.m: Same change. * objc.dg/property/property-1.m: Same change. * objc.dg/property/synthesize-1.m: Same change. * objc.dg/property/at-property-2.m: Same change. * objc.dg/property/at-property-4.m: Same change. * objc.dg/property/fsf-property-method-acces.m: Updated for changes in the syntax of @property and the implementation of @synthesize/@dynamic. Use the same code for GNU and NeXT runtime. * objc.dg/property/fsf-property-basic.m: Same change. * objc.dg/property/fsf-property-named-ivar.m: Same change. * objc.dg/property/at-property-5.m: New. * objc.dg/property/at-property-6.m: New. * objc.dg/property/at-property-7.m: New. * objc.dg/property/at-property-8.m: New. * objc.dg/property/at-property-9.m: New. * objc.dg/property/at-property-10.m: New. * objc.dg/property/at-property-11.m: New. * objc.dg/property/synthesize-2.m: New. * objc.dg/property/dynamic-2.m: New. * obj-c++.dg/property/property-neg-1.mm: Updated for changes in the syntax of @property and the implementation of @synthesize/@dynamic. * obj-c++.dg/property/property-neg-2.mm: Same change. * obj-c++.dg/property/property-neg-3.mm: Same change. * obj-c++.dg/property/property-neg-4.mm: Same change. * obj-c++.dg/property/property-neg-5.mm: Same change. * obj-c++.dg/property/property-neg-7.mm: Same change. * obj-c++.dg/property/property-1.mm: Same change. * obj-c++.dg/property/synthesize-1.mm: Same change. * obj-c++.dg/property/at-property-2.mm: Same change. * obj-c++.dg/property/at-property-4.mm: Same change. * obj-c++.dg/property/fsf-property-method-acces.mm: Updated for changes in the syntax of @property and the implementation of @synthesize/@dynamic. Use the same code for GNU and NeXT runtime. * obj-c++.dg/property/fsf-property-basic.mm: Same change. * obj-c++.dg/property/fsf-property-named-ivar.mm: Same change. * obj-c++.dg/property/at-property-5.mm: New. * obj-c++.dg/property/at-property-6.mm: New. * obj-c++.dg/property/at-property-7.mm: New. * obj-c++.dg/property/at-property-8.mm: New. * obj-c++.dg/property/at-property-9.mm: New. * obj-c++.dg/property/at-property-10.mm: New. * obj-c++.dg/property/at-property-11.mm: New. * obj-c++.dg/property/synthesize-2.mm: New. * obj-c++.dg/property/dynamic-2.mm: New. From-SVN: r166087
2010-10-27In gcc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-41/+65
In gcc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_at_property_declaration): Recognize RID_ASSIGN, RID_COPY, RID_RETAIN, RID_READWRITE and RID_NONATOMIC. Do not use objc_set_property_attr, but use local variables instead. Detect repeated usage of setter, getter and ivar attributes. Improved error processing when a setter name does not end in ':'. Do not check for CPP_CLOSE_PAREN after we determined that the token is a keyword. Updated call to objc_add_property_declaration. In gcc/cp/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_at_property_declaration): Recognize RID_ASSIGN, RID_COPY, RID_RETAIN, RID_READWRITE and RID_NONATOMIC. Do not use objc_set_property_attr, but use local variables instead. Detect repeated usage of setter, getter and ivar attributes. Improved error processing when a setter name does not end in ':'. Do not check for CPP_CLOSE_PAREN after we determined that the token is a keyword. Updated call to objc_add_property_declaration. In gcc/c-family/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (enum rid): Added RID_READWRITE, RID_ASSIGN, RID_RETAIN, RID_COPY and RID_NONATOMIC. Updated RID_FIRST_PATTR and RID_LAST_PATTR. (objc_add_property_declaration): Added additional arguments. (objc_property_attribute_kind): Removed. (objc_set_property_attr): Removed. * c-common.c (c_common_reswords): Added readwrite, assign, retain, copy and nonatomic. * stub-objc.c (objc_add_property_declaration): Added additional arguments. (objc_set_property_attr): Removed. In gcc/objc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_add_property_declaration): Added arguments to pass the various property attributes that were parsed with the property declaration. Process arguments to determine the final property attributes and produce error messages as appropriate. Added temporary code to keep the compiler silent about variables set but not used - for new attributes that are only checked but have no effect yet. (property_readonly): Removed. (property_setter): Removed. (property_getter): Removed. (property_ivar): Removed. (property_copies): Removed. (objc_set_property_attr): Removed. * objc-act.h (enum property_assign_semantics): New. In gcc/testsuite/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * obj-c.dg/property/at-property-4.m: New. * obj-c++.dg/property/at-property-4.mm: New. * obj-c++.dg/property/property-neg-5.m: Updated testcase for updates in warning. * obj-c++.dg/property/property-neg-5.mm: Updated testcase for updates in warning. From-SVN: r165997
2010-10-27In gcc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-113/+159
In gcc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_at_property): Renamed to c_parser_objc_at_property_declaration. Updated calls to objc_add_property_variable, now objc_add_property_declaration. Code rewritten to be much more robust in recovering from syntax errors. Added comments. (c_parser_objc_property_attrlist): Removed. (c_parser_external_declaration): Updated calls to c_parser_objc_at_property, now c_parser_objc_at_property_declaration. (c_parser_objc_methodprotolist): Same change. In gcc/c-family/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * c-common.h (objc_add_property_variable): Renamed to objc_add_property_declaration. Added location argument. * stub-objc.c (objc_add_property_variable): Same change. In gcc/cp/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * parser.c (cp_parser_objc_property_decl): Renamed to cp_parser_objc_struct_declaration. Return the parsed trees instead of calling objc_add_property_variable directly. Detect missing or invalid declspecs. Implemented attributes. Do not eat the ';' at the end. Exit loop whenever a non-comma is parsed, not just EOF. (cp_parser_objc_at_property): Renamed to cp_parser_objc_at_property_declaration. Updated calls to objc_add_property_variable, now objc_add_property_declaration, and to cp_parser_objc_property_decl, now cp_parser_objc_struct_declaration. Rewritten all code to be more robust in dealing with syntax errors, and almost identical to the one in c_parser_objc_at_property_declaration. (cp_parser_objc_property_attrlist): Removed. (cp_parser_objc_method_prototype_list): Updated call to cp_parser_objc_at_property. (cp_parser_objc_method_definition_list): Same change. (cp_parser_objc_class_ivars): Detect a number of invalid declarations of instance variables and produce errors when they are found. In gcc/objc/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_add_property_variable): Renamed to objc_add_property_declaration. Added location argument. Updated warnings and errors to use it. Use error, not fatal_error, if a property declaration is found outside an interface or implementation context. In gcc/testsuite/: 2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/property/at-property-1.m: New. * objc.dg/property/at-property-2.m: New. * objc.dg/property/at-property-3.m: New. * objc.dg/ivar-invalid-type-1.m: New. * obj-c++.dg/property/at-property-1.mm: New. * obj-c++.dg/property/at-property-2.mm: New. * obj-c++.dg/property/at-property-3.mm: New. * obj-c++.dg/ivar-invalid-type-1.mm: New. * objc.dg/property/property-neg-6.m: Updated testcase for updates in error reporting. From-SVN: r165996