public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Benjamin Kosnik <bkoz@redhat.com>
To: Mike Spertus <mike_spertus@symantec.com>
Cc: <gcc-patches@gcc.gnu.org>, Jason Merrill <jason@redhat.com>,
	       libstdc++@gcc.gnu.org
Subject: Re: Intrinsics for N2965: Type traits and base classes
Date: Wed, 28 Sep 2011 06:43:00 -0000	[thread overview]
Message-ID: <20110927195930.54e0d0df@shotwell> (raw)
In-Reply-To: <4E809F45.2010908@symantec.com>

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]


> 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 traits for giving the base classes of
> the class:
> 
> template<typename _Tp>
> struct bases
> {
>    typedef tuple<__bases(_Tp)...> type;
> };

Cool! So glad to see this.
 
> I didn't modify the standard library to include the above type trait
> in the patch because it is not yet clear what type it should return
> (e.g., a tuple, a "typelist," something satisfying the requirements
> of a boost::mpl sequence, or a generalization of parameter packs). I
> have (cursorily) tested it with the above type trait and the
> corresponding direct_bases trait.

OK.

Here's a patch for the above. What's wrong with tuple? I kind of like
it.... seems simple. It's what's in N2965, so let's start there.

Since it's the first TR2 header, I did the build bits for you. 

Also, I cc'd the library list. 

best,
benjamin

[-- Attachment #2: 20110927-4.patch --]
[-- Type: text/x-patch, Size: 5074 bytes --]

diff --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  <bkoz@redhat.com>
 
+	* doc/Makefile.am: Add tr2 support.
+	* doc/Makefile.in: Regenerate.
+
+2011-09-27  Mike Spertus  <mike_spertus@symantec.com>
+
+	* include/tr2/type_traits (bases, direct_bases): New.
+
+2011-09-27  Benjamin Kosnik  <bkoz@redhat.com>
+
 	* doc/html/*: Regenerate.
 
 	* doc/Makefile.am: Un-nest the ext output directory.
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 4016882..9fdaa8d 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -604,6 +604,11 @@ tr1_headers = \
 	${tr1_srcdir}/wchar.h \
 	${tr1_srcdir}/wctype.h
 
+tr2_srcdir = ${glibcxx_srcdir}/include/tr2
+tr2_builddir = ./tr2
+tr2_headers = \
+	${tr2_srcdir}/type_traits
+
 decimal_srcdir = ${glibcxx_srcdir}/include/decimal
 decimal_builddir = ./decimal
 decimal_headers = \
@@ -887,7 +892,7 @@ endif
 # CLEANFILES and all-local are kept up-to-date.
 allstamped = \
 	stamp-std stamp-bits stamp-bits-sup stamp-c_base stamp-c_compatibility \
-	stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \
+	stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr2 stamp-decimal \
 	stamp-debug stamp-parallel stamp-profile stamp-profile-impl \
 	stamp-host 
 
@@ -1002,6 +1007,11 @@ stamp-tr1: ${tr1_headers}
 	@-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
 	@$(STAMP) stamp-tr1
 
+stamp-tr2: ${tr2_headers}
+	@-mkdir -p ${tr2_builddir}
+	@-cd ${tr2_builddir} && $(LN_S) $? . 2>/dev/null
+	@$(STAMP) stamp-tr2
+
 stamp-decimal: ${decimal_headers}
 	@-mkdir -p ${decimal_builddir}
 	@-cd ${decimal_builddir} && $(LN_S) $? . 2>/dev/null
@@ -1245,6 +1255,9 @@ install-headers:
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
 	for file in ${tr1_headers}; do \
 	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
+	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr2_builddir}
+	for file in ${tr2_headers}; do \
+	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr2_builddir}; done
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir}
 	for file in ${decimal_headers}; do \
 	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done
@@ -1291,7 +1304,7 @@ clean-local:
 # developer tries to create them via make in the include build
 # directory. (This is more of an example of how this kind of rule can
 # be made.)
-.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers)
+.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr2_headers)
 	   $(decimal_headers) $(ext_headers)
 $(std_headers): ; @:
 $(c_base_headers): ; @:
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 58dbfc4..5ad5932 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -854,6 +854,11 @@ tr1_headers = \
 	${tr1_srcdir}/wchar.h \
 	${tr1_srcdir}/wctype.h
 
+tr2_srcdir = ${glibcxx_srcdir}/include/tr2
+tr2_builddir = ./tr2
+tr2_headers = \
+	${tr2_srcdir}/type_traits
+
 decimal_srcdir = ${glibcxx_srcdir}/include/decimal
 decimal_builddir = ./decimal
 decimal_headers = \
@@ -1125,7 +1130,7 @@ PCHFLAGS = -x c++-header -nostdinc++ $(CXXFLAGS)
 # CLEANFILES and all-local are kept up-to-date.
 allstamped = \
 	stamp-std stamp-bits stamp-bits-sup stamp-c_base stamp-c_compatibility \
-	stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \
+	stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr2 stamp-decimal \
 	stamp-debug stamp-parallel stamp-profile stamp-profile-impl \
 	stamp-host 
 
@@ -1402,6 +1407,11 @@ stamp-tr1: ${tr1_headers}
 	@-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
 	@$(STAMP) stamp-tr1
 
+stamp-tr2: ${tr2_headers}
+	@-mkdir -p ${tr2_builddir}
+	@-cd ${tr2_builddir} && $(LN_S) $? . 2>/dev/null
+	@$(STAMP) stamp-tr2
+
 stamp-decimal: ${decimal_headers}
 	@-mkdir -p ${decimal_builddir}
 	@-cd ${decimal_builddir} && $(LN_S) $? . 2>/dev/null
@@ -1630,6 +1640,9 @@ install-headers:
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
 	for file in ${tr1_headers}; do \
 	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
+	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr2_builddir}
+	for file in ${tr2_headers}; do \
+	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr2_builddir}; done
 	$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir}
 	for file in ${decimal_headers}; do \
 	  $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done
@@ -1673,7 +1686,7 @@ clean-local:
 # developer tries to create them via make in the include build
 # directory. (This is more of an example of how this kind of rule can
 # be made.)
-.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers)
+.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr2_headers)
 	   $(decimal_headers) $(ext_headers)
 $(std_headers): ; @:
 $(c_base_headers): ; @:

  parent reply	other threads:[~2011-09-28  2:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110913154324.4be22faf@shotwell>
2011-09-26 16:24 ` Mike Spertus
2011-09-26 18:40   ` Jason Merrill
2011-09-28  6:43   ` Benjamin Kosnik [this message]
2011-09-28  6:49     ` Benjamin Kosnik
2011-09-28  7:08     ` Michael Spertus
2011-09-28  9:33       ` Jonathan Wakely
2011-09-28 12:49         ` Mike Spertus
2011-09-28 13:57           ` Mike Spertus
2011-09-29 19:42             ` Benjamin Kosnik
2011-10-03  1:55               ` Michael Spertus
2011-10-03 13:08                 ` Jason Merrill
2011-10-03 15:51                 ` Jonathan Wakely
2011-10-04  4:41                 ` Benjamin Kosnik
2011-10-04  5:04                   ` Benjamin Kosnik
2011-10-09 19:31                     ` Michael Spertus
2011-10-09 19:38                       ` Jason Merrill
2011-10-11  0:12                         ` Benjamin Kosnik
2011-10-13 18:16                         ` Michael Spertus
2011-10-14 16:23                           ` Jason Merrill
2011-10-14 20:23                             ` Michael Spertus
2011-10-14 20:28                               ` Jason Merrill
2011-10-14 20:36                                 ` Michael Spertus
2011-10-18  7:19                                   ` Benjamin Kosnik
2011-10-18  8:23   ` Eric Botcazou
2011-10-19 22:48     ` Benjamin Kosnik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110927195930.54e0d0df@shotwell \
    --to=bkoz@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=mike_spertus@symantec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).