This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Vector subscripts in C++


Hello,

this patch adds vector subscripting to C++ by reusing the C code. build_array_ref and cp_build_array_ref could probably share more, but I don't understand them enough to do it.

(note that I can't commit, so if you like the patch...)

gcc/cp/ChangeLog
2012-04-17  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/51033
	* typeck.c (cp_build_array_ref): Handle VECTOR_TYPE.
	* decl2.c (grok_array_decl): Likewise.

gcc/c-family/ChangeLog
2012-04-17  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/51033
	* c-common.c (convert_vector_to_pointer_for_subscript): New function.
	* c-common.h (convert_vector_to_pointer_for_subscript): Declare it.

gcc/ChangeLog
2012-04-17  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/51033
	* c-typeck.c (build_array_ref): Call
	convert_vector_to_pointer_for_subscript.
	* doc/extend.texi (Vector Extensions): Subscripting not just for C.

gcc/testsuite/ChangeLog
2012-04-17  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/51033
	* gcc.dg/vector-1.c: Move to ...
	* c-c++-common/vector-1.c: ... here.
	* gcc.dg/vector-2.c: Move to ...
	* c-c++-common/vector-2.c: ... here.
	* gcc.dg/vector-3.c: Move to ...
	* c-c++-common/vector-3.c: ... here. Adapt to C++.
	* gcc.dg/vector-4.c: Move to ...
	* c-c++-common/vector-4.c: ... here.
	* gcc.dg/vector-init-1.c: Move to ...
	* c-c++-common/vector-init-1.c: ... here.
	* gcc.dg/vector-init-2.c: Move to ...
	* c-c++-common/vector-init-2.c: ... here.
	* gcc.dg/vector-subscript-1.c: Move to ... Adapt to C++.
	* c-c++-common/vector-subscript-1.c: ... here.
	* gcc.dg/vector-subscript-2.c: Move to ...
	* c-c++-common/vector-subscript-2.c: ... here.
	* gcc.dg/vector-subscript-3.c: Move to ...
	* c-c++-common/vector-subscript-3.c: ... here.

--
Marc Glisse

Attachment: p3
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]