C++ PATCHes to add __is_trivially_*

Jason Merrill jason@redhat.com
Tue Sep 30 17:13:00 GMT 2014


Ville asked for help with the necessary compiler intrinsics for the 
is_trivially_* C++11 library traits.

The first patch cleans up a few oddities I noticed with the existing 
intrinsics.  __is_convertible_to was never implemented and isn't needed. 
  There's no need for a second grokdeclarator in trait parsing since 
cp_parser_type_id already does a grokdeclarator.  And the assert at the 
top of finish_trait_expr is redundant with the gcc_unreachable in the 
switch.

The second patch adds __is_trivially_copyable, which just uses the 
existing trivially_copyable_p predicate in the compiler.

The third patch adds __is_trivially_assignable and 
__is_trivially_constructible, which work by building up an expression 
representing assignment or object declaration and then scanning it for 
calls to functions other than trivial special member functions.  Note 
that there are still bugs in trivial_fn_p that are exposed by this 
intrinsic.

Tested x86_64-pc-linux-gnu, applying to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trait-cleanup.patch
Type: text/x-patch
Size: 8904 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140930/cb5c4391/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_trivially_copyable.patch
Type: text/x-patch
Size: 3882 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140930/cb5c4391/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_trivially_xable.patch
Type: text/x-patch
Size: 13101 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140930/cb5c4391/attachment-0002.bin>


More information about the Gcc-patches mailing list