aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-09 16:43:36 +0000
committerJason Merrill <jason@redhat.com>2013-05-09 16:43:36 +0000
commitc1bf9bf1138295f19504c911ffc9b78af25b73cd (patch)
tree0ff2545c076f920080c2715f42b04536c9c75c62 /libstdc++-v3
parent33d266e1e282343c69f4be098e9c7ab2768dc79e (diff)
N3639 C++1y VLA support
gcc/ * gimplify.c (gimplify_vla_decl): Don't touch an existing DECL_VALUE_EXPR. gcc/cp/ * decl.c (compute_array_index_type): Allow VLAs in C++1y mode. (check_array_initializer): Allow VLA init. (reshape_init_array_1): Adjust. (cp_finish_decl): Check for invalid VLA length. * typeck2.c (process_init_constructor_array): Adjust. (store_init_value): Use build_vec_init for VLAs. * semantics.c (add_capture): Capture VLA as ptr+len. (vla_capture_type): New. (build_capture_proxy): Rebuild the VLA. * typeck.c (build_simple_component_ref): Split out from... (build_ptrmemfunc_access_expr): ...here. * tree.c (array_of_runtime_bound_p): New. * init.c (throw_bad_array_length): New. (build_vec_init): Use it. * parser.c (cp_convert_range_for): When iterating over a VLA, use it directly rather than bind a reference. * cp-tree.h: Declare new functions. libstdc++-v3/ * libsupc++/new: Add std::bad_array_length. * libsupc++/bad_array_length.cc: New. * libsupc++/eh_aux_runtime.cc: Add __cxa_bad_array_length. * libsupc++/Makefile.in: Build them. * config/abi/pre/gnu.ver: Add new symbols. * config/abi/pre/gnu-versioned-namespace.ver: Add new symbols. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@198745 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver3
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver3
-rw-r--r--libstdc++-v3/libsupc++/Makefile.in17
-rw-r--r--libstdc++-v3/libsupc++/bad_array_length.cc36
-rw-r--r--libstdc++-v3/libsupc++/cxxabi.h2
-rw-r--r--libstdc++-v3/libsupc++/eh_aux_runtime.cc4
-rw-r--r--libstdc++-v3/libsupc++/new17
8 files changed, 87 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2d91012d974..9bbb771cf2e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2013-05-08 Jason Merrill <jason@redhat.com>
+
+ Add std::bad_array_length (N3639)
+ * libsupc++/new: Add std::bad_array_length.
+ * libsupc++/bad_array_length.cc: New.
+ * libsupc++/eh_aux_runtime.cc: Add __cxa_bad_array_length.
+ * libsupc++/Makefile.in: Build them.
+ * config/abi/pre/gnu.ver: Add new symbols.
+ * config/abi/pre/gnu-versioned-namespace.ver: Add new symbols.
+
2013-05-08 Andi Kleen <ak@linux.intel.com>
PR target/55947
diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
index 07feda06454..33a0068e2d7 100644
--- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
+++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
@@ -235,6 +235,9 @@ CXXABI_2.0 {
__cxa_throw_bad_array_new_length;
_Z*St20bad_array_new_length*;
+ __cxa_throw_bad_array_length;
+ _Z*St16bad_array_length*;
+
# Default function.
_ZSt11_Hash_bytesPKv*;
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 7256c6f782e..446a68502e3 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1559,6 +1559,9 @@ CXXABI_1.3.7 {
CXXABI_1.3.8 {
__cxa_throw_bad_array_new_length;
_Z*St20bad_array_new_length*;
+
+ __cxa_throw_bad_array_length;
+ _Z*St16bad_array_length*;
} CXXABI_1.3.7;
# Symbols in the support library (libsupc++) supporting transactional memory.
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 9f24fef30eb..6ff4d0ce886 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -92,8 +92,8 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bitsdir)" \
LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
libsupc___la_LIBADD =
am__objects_1 = array_type_info.lo atexit_arm.lo atexit_thread.lo \
- bad_alloc.lo bad_array_new.lo bad_cast.lo bad_typeid.lo \
- class_type_info.lo \
+ bad_alloc.lo bad_array_length.lo bad_array_new.lo bad_cast.lo \
+ bad_typeid.lo class_type_info.lo \
del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo dyncast.lo \
eh_alloc.lo eh_arm.lo eh_aux_runtime.lo eh_call.lo eh_catch.lo \
eh_exception.lo eh_globals.lo eh_personality.lo eh_ptr.lo \
@@ -367,6 +367,7 @@ sources = \
atexit_arm.cc \
atexit_thread.cc \
bad_alloc.cc \
+ bad_array_length.cc \
bad_array_new.cc \
bad_cast.cc \
bad_typeid.cc \
@@ -789,16 +790,22 @@ cp-demangle.lo: cp-demangle.c
cp-demangle.o: cp-demangle.c
$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
-# Use special rules for the C++11 sources so that the proper flags are passed.
+# Use special rules for the C++11 and C++1y sources so that the proper
+# flags are passed.
+bad_array_length.lo: bad_array_length.cc
+ $(LTCXXCOMPILE) -std=gnu++1y -c $<
+bad_array_length.o: bad_array_length.cc
+ $(CXXCOMPILE) -std=gnu++1y -c $<
+
bad_array_new.lo: bad_array_new.cc
$(LTCXXCOMPILE) -std=gnu++11 -c $<
bad_array_new.o: bad_array_new.cc
$(CXXCOMPILE) -std=gnu++11 -c $<
eh_aux_runtime.lo: eh_aux_runtime.cc
- $(LTCXXCOMPILE) -std=gnu++11 -c $<
+ $(LTCXXCOMPILE) -std=gnu++1y -c $<
eh_aux_runtime.o: eh_aux_runtime.cc
- $(CXXCOMPILE) -std=gnu++11 -c $<
+ $(CXXCOMPILE) -std=gnu++1y -c $<
eh_ptr.lo: eh_ptr.cc
$(LTCXXCOMPILE) -std=gnu++11 -c $<
diff --git a/libstdc++-v3/libsupc++/bad_array_length.cc b/libstdc++-v3/libsupc++/bad_array_length.cc
new file mode 100644
index 00000000000..a63d660f20b
--- /dev/null
+++ b/libstdc++-v3/libsupc++/bad_array_length.cc
@@ -0,0 +1,36 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// 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 3, or (at your option)
+// any later version.
+
+// 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <new>
+
+namespace std {
+
+bad_array_length::~bad_array_length() _GLIBCXX_USE_NOEXCEPT { }
+
+const char*
+bad_array_length::what() const _GLIBCXX_USE_NOEXCEPT
+{
+ return "std::bad_array_length";
+}
+
+} // namespace std
diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h
index 83749ce8038..cf2c0602e5f 100644
--- a/libstdc++-v3/libsupc++/cxxabi.h
+++ b/libstdc++-v3/libsupc++/cxxabi.h
@@ -154,6 +154,8 @@ namespace __cxxabiv1
void
__cxa_throw_bad_array_new_length() __attribute__((__noreturn__));
+ void
+ __cxa_throw_bad_array_length() __attribute__((__noreturn__));
/**
* @brief Demangling routine.
diff --git a/libstdc++-v3/libsupc++/eh_aux_runtime.cc b/libstdc++-v3/libsupc++/eh_aux_runtime.cc
index 1cc831b4b9f..806b4798110 100644
--- a/libstdc++-v3/libsupc++/eh_aux_runtime.cc
+++ b/libstdc++-v3/libsupc++/eh_aux_runtime.cc
@@ -40,3 +40,7 @@ __cxxabiv1::__cxa_bad_typeid ()
extern "C" void
__cxxabiv1::__cxa_throw_bad_array_new_length ()
{ _GLIBCXX_THROW_OR_ABORT(std::bad_array_new_length()); }
+
+extern "C" void
+__cxxabiv1::__cxa_throw_bad_array_length ()
+{ _GLIBCXX_THROW_OR_ABORT(std::bad_array_length()); }
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index 3087502190e..cdf4cab85b9 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -79,6 +79,23 @@ namespace std
};
#endif
+ // We throw this exception for GNU VLAs of negative length in all C++
+ // dialects, so declare it if we aren't in strict conformance mode.
+#if __cplusplus > 201103L || !defined(__STRICT_ANSI__)
+ class bad_array_length : public bad_alloc
+ {
+ public:
+ bad_array_length() throw() { };
+
+ // This declaration is not useless:
+ // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
+ virtual ~bad_array_length() throw();
+
+ // See comment in eh_exception.cc.
+ virtual const char* what() const throw();
+ };
+#endif
+
struct nothrow_t { };
extern const nothrow_t nothrow;