GCC modified for the FreeChainXenon project
![]() The __variant_construct_by_index helper function sets the new index before constructing the new object. This means that if the construction throws then the exception needs to be caught, so the index can be reset to variant_npos, and then the exception rethrown. This means callers are responsible for restoring the variant's invariants and they need the overhead of a catch handler and a rethrow. If we don't set the index until after construction completes then the invariant is never broken, and callers can ignore the exception and let it propagate. The callers all call _M_reset() first, which sets index to variant_npos as required while the variant is valueless. We need to be slightly careful here, because changing the order of operations in __variant_construct_by_index and removing the try-block from variant::emplace<I> changes an implicit ABI contract between those two functions. If the linker were to create an executable containing an instantiation of the old __variant_construct_by_index and an instantiation of the new variant::emplace<I> code then we would have a combination that breaks the invariant and doesn't have the exception handling to restore it. To avoid this problem, we can rename the __variant_construct_by_index function so that the new emplace<I> code calls a new symbol, and is unaffected by the behaviour of the old symbol. libstdc++-v3/ChangeLog: * include/std/variant (__detail::__variant::__get_storage): Remove unused function. (__variant_construct_by_index): Set index after construction is complete. Rename to ... (__detail::__variant::__construct_by_index): ... this. (variant): Use new name for __variant_construct_by_index friend declaration. Remove __get_storage friend declaration. (variant::emplace): Use new name and remove try-blocks. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.