Re: Intrinsics for N2965: Type traits and base classes

2011-10-19 Thread Benjamin Kosnik
Please post a ChangeLog entry with a patch. Someone added one for you: 2011-10-17 Michael Spertus mike_sper...@symantec.com * gcc/c-family/c-common.c (c_common_reswords): Add __bases, __direct_bases. * gcc/c-family/c-common.h: Add RID_BASES and RID_DIRECT_BASES.

Re: Intrinsics for N2965: Type traits and base classes

2011-10-18 Thread Eric Botcazou
This patch consists intrinsics to properly create the bases and direct_bases of a class in the correct order (including multiple nested ambiguous virtual and non-virtual classes) for N2965 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2965.html). This allows you to create type

Re: Intrinsics for N2965: Type traits and base classes

2011-10-17 Thread Benjamin Kosnik
This is now in, thanks everybody for playing! Attached is the final diff. tested x86_64/linux -benjamindiff --git a/gcc/ChangeLog b/gcc/ChangeLog index ddc5149..6c73404 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-10-17 Michael Spertus mike_sper...@symantec.com + + *

Re: Intrinsics for N2965: Type traits and base classes

2011-10-14 Thread Jason Merrill
On 10/13/2011 01:35 PM, Michael Spertus wrote: +int main() { + assert(typeid(bF::type) + == typeid(typesA,C,D,A,C,D,B,C,C,D,B,E)); + assert(typeid(dbF::type) == typeid(typesA,B,E)); + assert(typeid(dbint::type) == typeid(types)); + return 0; +} Let's make this a compile-time test

RE: Intrinsics for N2965: Type traits and base classes

2011-10-14 Thread Michael Spertus
Redo test to run at compile-time per Jason's suggestion Index: libstdc++-v3/include/tr2/type_traits === --- libstdc++-v3/include/tr2/type_traits(revision 0) +++ libstdc++-v3/include/tr2/type_traits(revision 0) @@ -0,0

Re: Intrinsics for N2965: Type traits and base classes

2011-10-14 Thread Jason Merrill
Looks good, thanks. I'll let Benjamin check this in. Jason

RE: Intrinsics for N2965: Type traits and base classes

2011-10-14 Thread Michael Spertus
:) -Original Message- From: Jason Merrill [mailto:ja...@redhat.com] Sent: Friday, October 14, 2011 2:41 PM To: Michael Spertus Cc: Benjamin Kosnik; Jonathan Wakely; gcc-patches@gcc.gnu.org; libstd...@gcc.gnu.org Subject: Re: Intrinsics for N2965: Type traits and base classes

RE: Intrinsics for N2965: Type traits and base classes

2011-10-13 Thread Michael Spertus
Addressing Jason's comments: Index: libstdc++-v3/include/tr2/type_traits === --- libstdc++-v3/include/tr2/type_traits(revision 0) +++ libstdc++-v3/include/tr2/type_traits(revision 0) @@ -0,0 +1,96 @@ +// TR2

Re: Intrinsics for N2965: Type traits and base classes

2011-10-10 Thread Benjamin Kosnik
This is looking pretty good, from the libstdc++ side. This latest round of gcc hacking fixes the previous testsuite fixes, so once you get the gcc bits OK'd by Jason you can check in. I'd still like to see some testcases for the intrinsic, independent of the library. Seems like some simple

RE: Intrinsics for N2965: Type traits and base classes

2011-10-09 Thread Michael Spertus
Here is a new diff that works for non-class types (fixing Benjamin's failing test), fixes some spacing and alphabetization, and doesn't inadvertently break the __underlying_type trait. Index: libstdc++-v3/include/tr2/type_traits

Re: Intrinsics for N2965: Type traits and base classes

2011-10-09 Thread Jason Merrill
On 10/09/2011 08:13 PM, Michael Spertus wrote: +dfs_calculate_bases_pre (tree binfo, void *data_) +{ + (void)data_; You can use ATTRIBUTE_UNUSED to mark an unused parameter. I'd still like to see some testcases for the intrinsic, independent of the library. Jason

Re: Intrinsics for N2965: Type traits and base classes

2011-10-03 Thread Jason Merrill
The code looks good, though you are still missing some spaces before '('. The main thing left is some testcases. Jason

Re: Intrinsics for N2965: Type traits and base classes

2011-10-03 Thread Jonathan Wakely
On 3 October 2011 02:55, Michael Spertus wrote: Index: gcc/c-family/c-common.h === --- gcc/c-family/c-common.h     (revision 178892) +++ gcc/c-family/c-common.h     (working copy) @@ -139,7 +139,8 @@   RID_IS_LITERAL_TYPE,      

Re: Intrinsics for N2965: Type traits and base classes

2011-10-03 Thread Benjamin Kosnik
OK. Here is a new diff that hopefully takes into account all of Jason's and Benjamin's comments. Benjamin's TR2 build patch is not repeated (or tested!) here. Benjamin, I'd really appreciate if you wouldn't mind confirming I handled that correctly in tr2/type_traits (Including the inclusion

RE: Intrinsics for N2965: Type traits and base classes

2011-10-02 Thread Michael Spertus
OK. Here is a new diff that hopefully takes into account all of Jason's and Benjamin's comments. Benjamin's TR2 build patch is not repeated (or tested!) here. Benjamin, I'd really appreciate if you wouldn't mind confirming I handled that correctly in tr2/type_traits (Including the inclusion of

Re: Intrinsics for N2965: Type traits and base classes

2011-09-29 Thread Benjamin Kosnik
OK. Here are some simple benchmarks. I simulated heavy use of reflection with 1000 classes that each had about a thousand base classes. I also created a super-simple typelist class templatetypename... T struct typelist {}; // Variadic templates rock If bases returns a typelist, the

Re: Intrinsics for N2965: Type traits and base classes

2011-09-28 Thread Jonathan Wakely
On 28 September 2011 04:22, Michael Spertus wrote: Benjamin, I think tuple is wrong both for performance reasons (I believe these are likely to be serious enough to depress use due to inordinately long compiles) and because it prematurely locks us into a rigid choice of how our typelists

Re: Intrinsics for N2965: Type traits and base classes

2011-09-28 Thread Mike Spertus
Don't worry, I'm not suggesting including boost::mpl at all, just leaving the return type of the bases trait unspecified. IMO, your example illustrates my point that without performance tuning, compiling metaprograms can be prohibitively expensive, so I want to avoid running the tuple

Re: Intrinsics for N2965: Type traits and base classes

2011-09-28 Thread Mike Spertus
OK. Here are some simple benchmarks. I simulated heavy use of reflection with 1000 classes that each had about a thousand base classes. I also created a super-simple typelist class templatetypename... T struct typelist {}; // Variadic templates rock If bases returns a typelist, the program

Re: Intrinsics for N2965: Type traits and base classes

2011-09-27 Thread Benjamin Kosnik
Oops, this is the right patch. -benjamindiff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a59a0b6..e1176ee 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 2011-09-27 Benjamin Kosnik b...@redhat.com + * doc/Makefile.am: Add tr2 support. + *

Re: Intrinsics for N2965: Type traits and base classes

2011-09-27 Thread Michael Spertus
Benjamin, I think tuple is wrong both for performance reasons (I believe these are likely to be serious enough to depress use due to inordinately long compiles) and because it prematurely locks us into a rigid choice of how our typelists are implemented. My inclination is to make it

Re: Intrinsics for N2965: Type traits and base classes

2011-09-26 Thread Jason Merrill
On 09/26/2011 11:50 AM, Mike Spertus wrote: This patch consists intrinsics to properly create the bases and direct_bases of a class Looks pretty good. Some comments: #define GCC_TREE_H - #include hashtab.h I don't see any reason to remove this blank line. + if (TREE_CODE