This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] RFC libstdc++11convenience.la


This breaks separates the libstdc++ source files for C++11 from the
C++03 sources, and puts C++11 files in a new source directory,
src-c++11, which is compiled into libstdc++11convenience.a, and linked
in to libstdc++ in the same manner that libsupc++ uses.

Thus, no change to user-level or tool-level linking. To use C++11,
you'd still just link in libstdc++. To use C++03, you'd still just link
in libstdc++. 

The build rules for C++11 were established early on. This seems like a
useful abstraction now that so many of the sources have to be built
with C++11 flags. 

At some point, the continued ad hoc nature of
src/Makefile.am's current approach will break down.

At some other point, we might want to start building a libstdc++11
library with different flags from src/c++03. This is how to get there.

tested x86/linux

-benjamin
2012-01-16  Benjamin Kosnik  <bkoz@redhat.com>

	Add libstdc++11convenience.la.
	* src-c++11: New directory.
	* acinclude.m4: (GLIBCXX_CONFIGURE): Add src-c++11.
	* configure: Regenerated.
	* Makefile.am (hosted_source): Add src-c++11 to SUBDIRS.
	* Makefile.in: Regenerate.
	* libsupc++/Makefile.am (AM_CXXFLAGS): USe XTEMPLATE_FLAGS for
	-fno-implicit-templates.
	* libsupc++/Makefile.in: Regenerate.
	* src/Makefile.am (inst_sources): Move... C++11 files into
	separate directory for libstdc++11convenience.la. Files are:
	fstream-inst.cc, string-inst.cc, wlocale-inst.cc, wstring-inst.cc).
	(sources): Move C++11 files. Files are: compatibility-c++0x.cc,
	compatibility-atomic-c++0x.cc, debug.cc, functexcept.cc,
	functional.cc, hash_c++0x.cc, hashtable_c++0x.cc, limits.cc,
	system_error.cc, placeholders.cc, regex.cc, shared_ptr.cc,
	mutex.cc, condition_variable.cc, chrono.cc, thread.cc, future.cc.
	* src/Makefile.in: Regenerate.
	* src-c++11/Makefile.am: New.
	* src-c++11/Makefile.in: Generate.


diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am
index f1b5b07..02d60e1 100644
--- a/libstdc++-v3/Makefile.am
+++ b/libstdc++-v3/Makefile.am
@@ -24,7 +24,7 @@
 include $(top_srcdir)/fragment.am
 
 if GLIBCXX_HOSTED
-  hosted_source = doc src po testsuite
+  hosted_source = src-c++11 src doc po testsuite
 endif
 
 ## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 9d08178..0bb4d63 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
   # Keep these sync'd with the list in Makefile.am.  The first provides an
   # expandable list at autoconf time; the second provides an expandable list
   # (i.e., shell variable) at configure time.
-  m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite])
+  m4_define([glibcxx_SUBDIRS],[include libsupc++ python src-c++11 src doc po testsuite])
   SUBDIRS='glibcxx_SUBDIRS'
 
   # These need to be absolute paths, yet at the same time need to
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am
index fb5c26f..b27725d 100644
--- a/libstdc++-v3/libsupc++/Makefile.am
+++ b/libstdc++-v3/libsupc++/Makefile.am
@@ -104,8 +104,8 @@ libsupc__convenience_la_SOURCES = $(sources) $(c_sources)
 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
 # as the occasion call for it.
 AM_CXXFLAGS = \
-	-fno-implicit-templates \
 	$(LIBSUPCXX_PICFLAGS) \
+	$(XTEMPLATE_FLAGS) \
 	$(WARN_CXXFLAGS) \
 	$(OPTIMIZE_CXXFLAGS) \
 	$(CONFIG_CXXFLAGS)
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index eefa6e2..681f365 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -1,7 +1,7 @@
-## Makefile for the src subdirectory of the GNU C++ Standard library.
+## Makefile for the C++11 sources of the GNU C++ Standard library.
 ##
 ## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-## 2006, 2007, 2008, 2009, 2010, 2011
+## 2006, 2007, 2008, 2009, 2010, 2011, 2012
 ## Free Software Foundation, Inc.
 ##
 ## This file is part of the libstdc++ version 3 distribution.
@@ -171,7 +171,6 @@ inst_sources = \
 	allocator-inst.cc \
 	concept-inst.cc \
 	ext-inst.cc \
-	fstream-inst.cc \
 	ios-inst.cc \
 	iostream-inst.cc \
 	istream-inst.cc \
@@ -180,9 +179,7 @@ inst_sources = \
 	ostream-inst.cc \
 	sstream-inst.cc \
 	streambuf-inst.cc \
-	string-inst.cc \
-	wlocale-inst.cc \
-	wstring-inst.cc
+	wlocale-inst.cc
 else
 XTEMPLATE_FLAGS =
 inst_sources =
@@ -195,27 +192,19 @@ sources = \
 	mt_allocator.cc \
 	codecvt.cc \
 	compatibility.cc \
-	compatibility-c++0x.cc \
-	compatibility-atomic-c++0x.cc \
 	compatibility-debug_list.cc \
 	compatibility-debug_list-2.cc \
 	compatibility-list.cc \
 	compatibility-list-2.cc \
 	complex_io.cc \
 	ctype.cc \
-	debug.cc \
-	functexcept.cc \
-	functional.cc \
 	globals_io.cc \
-	hash_c++0x.cc \
 	hash_tr1.cc \
-	hashtable_c++0x.cc \
 	hashtable_tr1.cc \
 	ios.cc \
 	ios_failure.cc \
 	ios_init.cc \
 	ios_locale.cc \
-	limits.cc \
 	list.cc \
 	locale.cc \
 	locale_init.cc \
@@ -225,18 +214,9 @@ sources = \
 	math_stubs_long_double.cc \
 	stdexcept.cc \
 	strstream.cc \
-	system_error.cc \
 	tree.cc \
 	istream.cc \
-	placeholders.cc \
-	regex.cc \
-	shared_ptr.cc \
 	streambuf.cc \
-	mutex.cc \
-	condition_variable.cc \
-	chrono.cc \
-	thread.cc \
-	future.cc \
 	valarray.cc \
 	${host_sources} \
 	${host_sources_extra}
@@ -248,11 +228,13 @@ libstdc___la_SOURCES = $(sources)
 
 libstdc___la_LIBADD = \
 	$(GLIBCXX_LIBS) \
-	$(top_builddir)/libsupc++/libsupc++convenience.la
+	$(top_builddir)/libsupc++/libsupc++convenience.la \
+	$(top_builddir)/src-c++11/libstdc++11convenience.la
 
 libstdc___la_DEPENDENCIES = \
 	${version_dep} \
-	$(top_builddir)/libsupc++/libsupc++convenience.la
+	$(top_builddir)/libsupc++/libsupc++convenience.la \
+	$(top_builddir)/src-c++11/libstdc++11convenience.la
 
 libstdc___la_LDFLAGS = \
 	-version-info $(libtool_VERSION) ${version_arg} -lm
@@ -292,107 +274,6 @@ compatibility-parallel_list-2.lo: compatibility-parallel_list-2.cc
 compatibility-parallel_list-2.o: compatibility-parallel_list-2.cc
 	$(CXXCOMPILE) -c $<
 
-# Use special rules for the C++0x sources so that the proper flags are passed.
-functexcept.lo: functexcept.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-functexcept.o: functexcept.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-shared_ptr.lo: shared_ptr.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-shared_ptr.o: shared_ptr.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-system_error.lo: system_error.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-system_error.o: system_error.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-mutex.lo: mutex.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-mutex.o: mutex.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-condition_variable.lo: condition_variable.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-condition_variable.o: condition_variable.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-compatibility-c++0x.lo: compatibility-c++0x.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-compatibility-c++0x.o: compatibility-c++0x.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-compatibility-atomic-c++0x.lo: compatibility-atomic-c++0x.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-compatibility-atomic-c++0x.o: compatibility-atomic-c++0x.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-functional.lo: functional.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-functional.o: functional.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-hash_c++0x.lo: hash_c++0x.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-hash_c++0x.o: hash_c++0x.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-hashtable_c++0x.lo: hashtable_c++0x.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-hashtable_c++0x.o: hashtable_c++0x.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-limits.lo: limits.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-limits.o: limits.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-fstream-inst.lo: fstream-inst.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-fstream-inst.o: fstream-inst.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-string-inst.lo: string-inst.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-string-inst.o: string-inst.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-wstring-inst.lo: wstring-inst.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-wstring-inst.o: wstring-inst.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-chrono.lo: chrono.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-chrono.o: chrono.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-thread.lo: thread.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-thread.o: thread.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-future.lo: future.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-future.o: future.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-regex.lo: regex.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-regex.o: regex.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-debug.lo: debug.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-debug.o: debug.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
-placeholders.lo: placeholders.cc
-	$(LTCXXCOMPILE) -std=gnu++0x -c $<
-placeholders.o: placeholders.cc
-	$(CXXCOMPILE) -std=gnu++0x -c $<
-
 if GLIBCXX_LDBL_COMPAT
 # Use special rules for compatibility-ldbl.cc compilation, as we need to
 # pass -mlong-double-64.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]