On Mon, Feb 11, 2013 at 7:12 PM, Iyer, Balaji V <balaji.v.i...@intel.com> wrote: > Hello Everyone, > Attached, please find a patch that implements Array Notations for C++. > This patch affects the C++ compiler and should build (or be applied) on top > of the Array Notation for C patch (2 of n: > http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01213.html). To my best > knowledge, I have implemented all the applicable comments that GCC reviewers > have made about my previous patches into this. Please let me know if it is Ok > for trunk.
Note that these patches have to wait until stage1 for GCC 4.9 opens independent on whether they are approved. Thanks, Richard. > > Here are the ChangeLog Entries: > > gcc/cp/Changelog > 2013-02-11 Balaji V. Iyer <balaji.v.i...@intel.com> > > * typeck.c (cp_build_array_ref): Added a check if array notation used > as index for an array has a rank greater than 1. If so, then emit an > error. > (cp_build_binary_op): Find the correct type when array notation expr. > is > used in op0 and op1. > (cp_build_addr_expr_1): Check if array notation is used and if so then > handle the arg and var like you handle an array. > (convert_for_assignment): If array notation is used, then just return > the rhs. > * semantics.c (finish_return_stmt): Added a check for array notations > in > return statement. If so, then issue an error. > (cxx_eval_constant_expression): Added a ARRAY_NOTATION_REF case. > (potential_constant_expression_1): Likewise. > * tree.c (lvalue_kind): Likewise. > * pt.c (tsubst_copy_and_build): Likewise. > (type_unification_real): Return 1 when array notation is used and cilk > plus is enabled. > (instantiate_decl): Check if array notation is used in (sub)tree when > Cilk plus is enabled. If so, then expand them. > * parser.c (cp_parser_nested_name_specifier_opt): Added a check if > cilk > plus is enabled. If so, then we don't issue the error. > (cp_parser_postfix_open_square_expression): Added checks for colon(s) > after square braces when cilkplus is enabled. if so, then do the > array > notation parsing. > (cp_parser_compound_statement): Added a check to see if array > notations > are used in the (sub)tree. if so, then call function to expand them. > (cp_parser_ctor_initializer_opt_and_function_body): Likewise. > (cp_parser_function_definition_after_declarator): Likewise. > (cp_parser_selection_statement): Added a check if array notation is > used > in a switch statement. If so, then issue an error. > (cp_parser_iteration_statement): Likewise for while and do-while and > for > statements. > (cp_parser_direct_declarator): Added a check for intialization near an > array notation. If so, then issue an error. > * cp-tree.h (build_x_array_notation_expr): New function declaration. > (contains_array_notation_expr): Likewise. > (fix_array_notation_exprs): Likewise. > (is_builtin_array_notation_fn): Likewise. > (find_correct_array_notation_type): Likewise. > (cp_parser_array_notation): New function. > * cp-objcp-common.c (cp_common_init_ts): Marked ARRAY_NOTATION_REF as > typed. > * call.c (convert_like_real): Added a check for array notations when > cilkplus is enabled. > (build_over_call): Added a check if the function call is a builtin > array notation function. If so, then no type conversion is necessary. > * cp-array-notation.c: New file. > * Make-lang.in (CXX_AND_OBJCXX_OBJS): Added cp/cp-array-notation.o > > gcc/testsuite/Changelog > 2013-02-11 Balaji V. Iyer <balaji.v.i...@intel.com> > > * g++.dg/cilk-plus/array_notation/compile/array_test1.cc: New test. > * g++.dg/cilk-plus/array_notation/compile/array_test2.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/builtin_fn_double.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/compile/builtin_funcs.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/gather_scatter.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/if_test1.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/if_test2.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/postdecr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/postincr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/preincr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/predecr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/compile/sec_implicit_ex.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/errors/decl-ptr-colon.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/fn_ptr.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/fp_triplet_values.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/errors/gather_scatter.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/misc.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/parser_errors.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/parser_errors2.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/parser_errors3.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/parser_errors4.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/rank_mismatch.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/sec_implicit.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/sec_implicit2.cc: Likewise. > * g++.dg/cilk-plus/array_notation/errors/sec_reduce_max_min_ind.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/an-if.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/array_test1.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/array_test1_tplt.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/array_test2.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/array_test2_tplt.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/array_test_ND.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/array_test_ND_tplt.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/builtin_fn_custom.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/builtin_fn_custom_tplt.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/builtin_fn_mutating.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/builtin_fn_mutating_tplt.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/builtin_func_double.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/builtin_func_double2.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/comma_exp.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/conditional.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/exec-once.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/gather_scatter.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/if_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/n-ptr-test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/postdecr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/postincr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/preincr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/predecr_test.cc: Likewise. > * g++.dg/cilk-plus/array_notation/execute/sec_implicit_ex.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/execute/test_builtin_return.cc: > Likewise. > * g++.dg/cilk-plus/array_notation/compile/compile.exp: New script. > * g++.dg/cilk-plus/array_notation/errors/errors.exp: Likewise. > * g++.dg/cilk-plus/array_notation/execute/execute.exp: Likewise. > > > Thanks, > > Balaji V. Iyer.