This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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] | |
This is a preliminary pass to allow -Weffc++ to be used again. I still have to run through the testsuite. There are some things that I think are pretty interesting, and a lot of additional work to get this to work fully. http://gcc.gnu.org/onlinedocs/gcc/C---Dialect-Options.html#C++%20Dialect%20Options In general, it would be nice if -Weffc++ 1) didn't complain when assignment operators return a function that returns *this 2) if a base class has private copy constructors and assignment operators, then don't warn that they are missing in derived classes. It would be cool, in some imaginary world, if -Weffc++ could be made conditional on a specific item, instead of lumping them all together. Still, useful things were found, some of which are listed below. If it's possible, I would like to make -Weffc++ play nice with g++ so that people can use this feature. 1) bvector was not fixed up w/ the allocator patches 2) the base allocator classes don't have virtual destructors, intentionally, which I think is ok since the destructors don't really do anything. If people disagree, this would be a wise time to step up. 3) there are a lot of places where member initialization lists should be used for libstdc++. 4) cxxabi.h was reformatted. I couldn't take it anymore, but this will be split out from this patch. I'll wait for comments, and don't expect parts of this patch to go in at all. tested x86/linux 2004-04-13 Benjamin Kosnik <bkoz@redhat.com> Fixups for -Weffc++. * include/bits/stl_bvector.h (_Bvector_base): Use _Bvector_impl idiom that other containers use. * include/bits/stl_iterator.h (insert_iterator::operator++(int)): Break compatibility with standard, typo similar to DR 260. * include/bits/streambuf_iterator.h (ostreambuf_iterator::operator++(int)): Same. Define copy constructor and assignment operator. (istreambuf_iterator): Add definitions for copy constructor and assignment operator. * include/ext/new_allocator.h (new_allocator::~new_allocator): Make virtual. * include/ext/mt_allocator.h (__mt_alloc::__mt_alloc): Same. * include/ext/bitmap_allocator.h (bitmap_allocator::~bitmap_allocator): Same. * include/ext/pool_allocator.h (__pool_alloc::~__pool_alloc): Same. * include/ext/malloc_allocator.h (malloc_allocator::~malloc_allocator): Same. * include/bits/basic_string.h (basic_string::operator=): Return pointer to this instead of result of assign. Although redundant, this doesn't impact resultant codegen. * include/bits/stl_iterator.h (__normal_iterator): Declare assignment operator private and define copy constructor. * include/bits/locale_facets.h (__numpunct_cache): Declare assignment operator and copy constructor private. (__timepunct_cache): Same. (__moneypunct_cache): Same. (collate): Use member initialization list for _M_c_locale_collate. * src/codecvt.cc: Use member initialization list to initialize _M_c_locale_codecvt. * include/bits/basic_ios.h: Same, for _M_tie, _M_fill, _M_fill_init, _M_streambuf. * include/std/std_sstream.h: Same, for _M_mode. * src/ctype.cc: Same, with _M_c_locale_ctype and _M_narrow_ok. * config/os/gnu-linux/ctype_noninline.h: Same. * include/bits/basic_ios.h (basic_ios): Complete member initialization list. * src/ios.cc (ios_base): Same. * src/locale.cc (_Impl): Same. * src/locale_init.cc: Same. * src/localename.cc: Same. * include/bits/istream.tcc (basic_istream::sentry): Same. * include/bits/ostream.tcc (basic_ostream::sentry): Same. * include/std/std_sstream.h: Same. * include/std/std_streambuf.h: Same. * config/locale/gnu/messages_members.h: Same. * config/locale/gnu/time_members.h (__timepunct): Same. * include/bits/fstream.tcc (basic_filebuf): Add _M_lock and _M_pback to member initialization list. * src/allocator.cc: Instantiate new_allocator. * include/ext/rope: Make derived classes match exception specifications. Add copy constructors and assignment operators. * include/debug/safe_base.h (_Safe_sequence_base): Declare copy constructor and assignment operator. (_Safe_iterator_base): Same. * include/debug/formatter.h (_Error_formatter): Add copy constructor and assignment operator. * include/backward/strstream: Declare assignment operator and copy constructor private. * libsupc++/cxxabi.h: Remove duplicated and useless public and private keywords in class declarations. Format. Use stddef.h. Expose declarations to "C" compilation. * libsupc++/tinfo.cc (__upcast_result): Add copy constructor and assignment operator. (__dyncast_result): Same. * libsupc++/vec.cc (uncatch_exception): Same, use member initialization list. * config/linker-map.gnu: Export vtable, typeinfo for std::allocator instantiations. Simplify vtable, typeinfo export list. * testsuite/testsuite_hooks.h (func_callback): Declare copy constructor and assignment operator private. * testsuite/23_containers/deque/cons/clear_allocator.cc: Match exception specifications of base class. * testsuite/23_containers/list/cons/clear_allocator.cc: Same. * testsuite/23_containers/vector/cons/clear_allocator.cc: Same. * testsuite/23_containers/vector/bool/clear_allocator.cc: New.
Attachment:
p.20040413.bz2
Description: BZip2 compressed data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |