Boost logo

Boost-Commit :

From: oryol_at_[hidden]
Date: 2008-04-12 12:08:32


Author: jeremypack
Date: 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
New Revision: 44348
URL: http://svn.boost.org/trac/boost/changeset/44348

Log:
Maik fixes for GCC 4.3

This apparently had problems compiling on GCC 4.3 with certain options. These fixes are also tested on OS X.
I will test with GCC 4.0 on Ubunutu and MSVC.

Text files modified:
   sandbox/boost/extension/functor.hpp | 4 +-
   sandbox/boost/extension/impl/library_impl.hpp | 2 +
   sandbox/boost/extension/impl/typeinfo.hpp | 2
   sandbox/libs/extension/benchmarks/Jamfile.v2 | 4 +-
   sandbox/libs/extension/benchmarks/multiple_calls.cpp | 38 +++++++++++++++++-------------
   sandbox/libs/extension/benchmarks/multiple_libraries.cpp | 49 ++++++++++++++++++++-------------------
   sandbox/libs/extension/benchmarks/plain_old_approach.cpp | 20 ++++++++-------
   sandbox/libs/extension/examples/info/im/network_parameters.hpp | 1
   sandbox/libs/extension/examples/info/multilanguage_main.cpp | 1
   sandbox/libs/extension/examples/main.cpp | 2 +
   sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp | 3 ++
   sandbox/libs/extension/examples/versioning/main_versions.cpp | 1
   sandbox/libs/extension/test/construction.cpp | 2 +
   sandbox/libs/extension/test/double_param_test.cpp | 2 +
   sandbox/libs/extension/test/single_param_test.cpp | 2 +
   15 files changed, 78 insertions(+), 55 deletions(-)

Modified: sandbox/boost/extension/functor.hpp
==============================================================================
--- sandbox/boost/extension/functor.hpp (original)
+++ sandbox/boost/extension/functor.hpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -14,7 +14,7 @@
 #ifndef BOOST_EXTENSION_FUNCTOR_HPP
 #define BOOST_EXTENSION_FUNCTOR_HPP
 
-#include <boost/extension/impl/linked_library.hpp>
+#include <boost/extension/impl/library_impl.hpp>
 
 #ifdef BOOST_EXTENSIONS_USE_PP
 
@@ -50,7 +50,7 @@
 
 namespace boost { namespace extensions {
 
-using boost::extensions::impl::generic_function_ptr;
+//using boost::extensions::impl::generic_function_ptr;
 
 #ifdef BOOST_EXTENSIONS_USE_PP
 

Modified: sandbox/boost/extension/impl/library_impl.hpp
==============================================================================
--- sandbox/boost/extension/impl/library_impl.hpp (original)
+++ sandbox/boost/extension/impl/library_impl.hpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -13,6 +13,8 @@
 #ifndef BOOST_EXTENSION_LIBRARY_IMPL_HPP
 #define BOOST_EXTENSION_LIBRARY_IMPL_HPP
 
+#include <cstring>
+
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 
 #ifndef _WIN32_WINNT

Modified: sandbox/boost/extension/impl/typeinfo.hpp
==============================================================================
--- sandbox/boost/extension/impl/typeinfo.hpp (original)
+++ sandbox/boost/extension/impl/typeinfo.hpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -39,7 +39,7 @@
 
 // This list should be expanded to all platforms that successfully
 // compare type_info across shared library boundaries.
-#if defined(__APPLE__) || defined(BOOST_EXTENSION_FORCE_FAST_TYPEINFO)
+#if defined(__APPLE__) || defined(__GNUC__) || defined(BOOST_EXTENSION_FORCE_FAST_TYPEINFO)
 namespace boost {
 namespace extensions {
 bool operator<(const default_type_info& first,

Modified: sandbox/libs/extension/benchmarks/Jamfile.v2
==============================================================================
--- sandbox/libs/extension/benchmarks/Jamfile.v2 (original)
+++ sandbox/libs/extension/benchmarks/Jamfile.v2 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -19,8 +19,8 @@
     : requirements
       <include>../../../
       <include>$(BOOST_ROOT)
- <toolset>gcc:<find-static-library>boost_filesystem
- <toolset>gcc:<find-static-library>dl
+ <toolset>gcc:<find-shared-library>dl
+ <find-shared-library>boost_filesystem
     :
     ;
 

Modified: sandbox/libs/extension/benchmarks/multiple_calls.cpp
==============================================================================
--- sandbox/libs/extension/benchmarks/multiple_calls.cpp (original)
+++ sandbox/libs/extension/benchmarks/multiple_calls.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -11,12 +11,15 @@
  * See http://www.boost.org/ for latest version.
  */
 
+#include <boost/extension/functor.hpp>
 #include <boost/extension/factory_map.hpp>
 #include <boost/extension/shared_library.hpp>
 #include <boost/extension/convenience.hpp>
 #include <boost/timer.hpp>
+#include <list>
 
 #include <iostream>
+#include <memory>
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 
@@ -51,20 +54,21 @@
     l.open();
     {
       factory_map fm;
- functor<void, factory_map &> load_func = l.get_functor<void,
+ functor<void, factory_map &> load_func = l.get<void,
         factory_map &>("extension_export_word");
       load_func(fm);
-
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
-
+
+ std::map<int, factory<word> > & factory_list = fm.get<word, int>();
+
       for(unsigned int c = 0; c < times; ++c) {
 
- for (std::list<factory<word, int> >::iterator current_word =
- factory_list.begin();
- current_word != factory_list.end();
- ++current_word) {
- std::auto_ptr<word> word_ptr(current_word->create());
-
+ for (std::map<int, factory<word> >::iterator current_word =
+ factory_list.begin();
+ current_word != factory_list.end();
+ ++current_word)
+ {
+ std::auto_ptr<word> word_ptr(current_word->second.create());
+
           // do something with the word
           std::string s(word_ptr->get_val());
           s += "\n";
@@ -74,7 +78,7 @@
     }
     l.close();
   }
- std::cout << "Boost.extensions style: " << extensions_style.elapsed()
+ std::cout << "Boost.extensions style: " << extensions_style.elapsed()
             << std::endl;
 
 
@@ -98,27 +102,27 @@
       export_words_function_type export_words;
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
- export_words =
- (export_words_function_type) GetProcAddress(library,
+ export_words =
+ (export_words_function_type) GetProcAddress(library,
                                                     "extension_export_words");
 #else
       *(void **) (&export_words) = dlsym(library, "extension_export_words");
 #endif
-
+
       if(export_words == 0) {
         std::cerr << "Cannot get exported symbol." << std::endl;
         return 1;
       }
-
+
       for(unsigned int c = 0; c < times; ++c) {
         // retrieve the words
         word *first_word, *second_word;
         (*export_words)(&first_word, &second_word);
-
+
         // do something with the word
         std::string f(first_word->get_val());
         f += "\n";
-
+
         std::string s(second_word->get_val());
         s += "\n";
 

Modified: sandbox/libs/extension/benchmarks/multiple_libraries.cpp
==============================================================================
--- sandbox/libs/extension/benchmarks/multiple_libraries.cpp (original)
+++ sandbox/libs/extension/benchmarks/multiple_libraries.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -20,6 +20,7 @@
 
 #include <iostream>
 #include <string>
+#include <memory>
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 
@@ -45,11 +46,11 @@
 void copy_libraries(const std::string &lib_base, unsigned int qty)
 {
   for(unsigned int i = 1; i <= qty; ++i) {
- std::string library_copy = lib_base
+ std::string library_copy = lib_base
       + boost::lexical_cast<std::string>(i)
       + ".extension";
 
- if(boost::filesystem::exists(lib_base + ".extension") &&
+ if(boost::filesystem::exists(lib_base + ".extension") &&
        !boost::filesystem::exists(library_copy)) {
 
       boost::filesystem::copy_file(lib_base + ".extension", library_copy);
@@ -62,8 +63,8 @@
 void remove_libraries(const std::string &lib_base, unsigned int qty)
 {
   for(unsigned int i = 1; i <= qty; ++i) {
- std::string library_copy = lib_base
- + boost::lexical_cast<std::string>(i)
+ std::string library_copy = lib_base
+ + boost::lexical_cast<std::string>(i)
       + ".extension";
 
     if(boost::filesystem::exists(library_copy)) {
@@ -87,34 +88,34 @@
   boost::timer extensions_style;
   for(unsigned int lib_number = 1; lib_number <= libs; ++lib_number) {
 
- shared_library l(std::string("libHelloWorldLib"
- + boost::lexical_cast<std::string>(lib_number)
+ shared_library l(std::string("libHelloWorldLib"
+ + boost::lexical_cast<std::string>(lib_number)
                          + ".extension").c_str());
 
     l.open();
     {
       factory_map fm;
- void (*load_func)(factory_map &) =
+ void (*load_func)(factory_map &) =
         l.get<void, factory_map &>("extension_export_word");
 
       load_func(fm);
 
       std::map<int, factory<word> > & factory_list = fm.get<word, int>();
- for (std::map<int, factory<word> >::iterator current_word =
- factory_list.begin(); current_word != factory_list.end();
- ++current_word)
- {
- // Using auto_ptr to avoid needing delete. Using smart_ptrs is
- // recommended.
- // Note that this has a zero argument constructor - currently constructors
- // with up to six arguments can be used.
- std::auto_ptr<word> word_ptr(current_word->second.create());
+ for (std::map<int, factory<word> >::iterator current_word =
+ factory_list.begin(); current_word != factory_list.end();
+ ++current_word)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is
+ // recommended.
+ // Note that this has a zero argument constructor - currently constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<word> word_ptr(current_word->second.create());
         std::string cheese = word_ptr->get_val();
- }
+ }
     }
     l.close();
   }
- std::cout << "Boost.extensions style: " << extensions_style.elapsed()
+ std::cout << "Boost.extensions style: " << extensions_style.elapsed()
             << std::endl;
 
 
@@ -123,12 +124,12 @@
   for(unsigned int lib_number = 1; lib_number <= libs; ++lib_number) {
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
- HMODULE library = LoadLibrary(std::string("libPlainOldHelloWorldLib"
- + boost::lexical_cast<std::string>(lib_number)
+ HMODULE library = LoadLibrary(std::string("libPlainOldHelloWorldLib"
+ + boost::lexical_cast<std::string>(lib_number)
                       + ".extension").c_str());
 #else
- void *library = dlopen(std::string("libPlainOldHelloWorldLib"
- + boost::lexical_cast<std::string>(lib_number)
+ void *library = dlopen(std::string("libPlainOldHelloWorldLib"
+ + boost::lexical_cast<std::string>(lib_number)
                        + ".extension").c_str(), RTLD_LAZY);
 #endif
 
@@ -142,7 +143,7 @@
     export_words_function_type export_words;
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
- export_words = (export_words_function_type) GetProcAddress(library,
+ export_words = (export_words_function_type) GetProcAddress(library,
                                                "extension_export_words");
 #else
     *(void **) (&export_words) = dlsym(library, "extension_export_words");
@@ -152,7 +153,7 @@
       std::cerr << "Cannot get exported symbol." << std::endl;
       return 1;
     }
-
+
     // retrieve the words
     word *first_word, *second_word;
     (*export_words)(&first_word, &second_word);

Modified: sandbox/libs/extension/benchmarks/plain_old_approach.cpp
==============================================================================
--- sandbox/libs/extension/benchmarks/plain_old_approach.cpp (original)
+++ sandbox/libs/extension/benchmarks/plain_old_approach.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -9,12 +9,14 @@
  * See http://www.boost.org/ for latest version.
  */
 
+#include <boost/extension/functor.hpp>
 #include <boost/extension/factory_map.hpp>
 #include <boost/extension/shared_library.hpp>
 #include <boost/extension/convenience.hpp>
 #include <boost/timer.hpp>
 
 #include <iostream>
+#include <memory>
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 
@@ -50,15 +52,15 @@
     l.open();
     {
       factory_map fm;
- functor<void, factory_map &> load_func =
- l.get_functor<void, factory_map &>("extension_export_word");
+ functor<void, factory_map &> load_func =
+ l.get<void, factory_map &>("extension_export_word");
       load_func(fm);
 
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
- for (std::list<factory<word, int> >::iterator current_word =
- factory_list.begin(); current_word != factory_list.end();
+ std::map<int, factory<word> > & factory_list = fm.get<word, int>();
+ for (std::map<int, factory<word> >::iterator current_word =
+ factory_list.begin(); current_word != factory_list.end();
            ++current_word) {
- std::auto_ptr<word> word_ptr(current_word->create());
+ std::auto_ptr<word> word_ptr(current_word->second.create());
 
         // do something with the word
         std::string s(word_ptr->get_val());
@@ -67,7 +69,7 @@
     }
     l.close();
   }
- std::cout << "Boost.extensions style: " << extensions_style.elapsed()
+ std::cout << "Boost.extensions style: " << extensions_style.elapsed()
             << std::endl;
 
 
@@ -89,7 +91,7 @@
     export_words_function_type export_words;
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
- export_words = (export_words_function_type) GetProcAddress(library,
+ export_words = (export_words_function_type) GetProcAddress(library,
                                                "extension_export_words");
 #else
     *(void **) (&export_words) = dlsym(library, "extension_export_words");
@@ -99,7 +101,7 @@
       std::cerr << "Cannot get exported symbol." << std::endl;
       return 1;
     }
-
+
     // retrieve the words
     word *first_word, *second_word;
     (*export_words)(&first_word, &second_word);

Modified: sandbox/libs/extension/examples/info/im/network_parameters.hpp
==============================================================================
--- sandbox/libs/extension/examples/info/im/network_parameters.hpp (original)
+++ sandbox/libs/extension/examples/info/im/network_parameters.hpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -10,6 +10,7 @@
  */
 
 #include <string>
+#include <cstring>
 #include <iostream>
 #include <boost/shared_ptr.hpp>
 

Modified: sandbox/libs/extension/examples/info/multilanguage_main.cpp
==============================================================================
--- sandbox/libs/extension/examples/info/multilanguage_main.cpp (original)
+++ sandbox/libs/extension/examples/info/multilanguage_main.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -14,6 +14,7 @@
 #include <boost/extension/convenience.hpp>
 
 #include <iostream>
+#include <memory>
 
 #include "word_description.hpp"
 

Modified: sandbox/libs/extension/examples/main.cpp
==============================================================================
--- sandbox/libs/extension/examples/main.cpp (original)
+++ sandbox/libs/extension/examples/main.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -15,6 +15,8 @@
 #include <boost/extension/convenience.hpp>
 #include "word.hpp"
 
+#include <memory>
+
 int main()
 {
   using namespace boost::extensions;

Modified: sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp
==============================================================================
--- sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp (original)
+++ sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -18,8 +18,11 @@
 #include "vehicle.hpp"
 #include "computer.hpp"
 #include <iostream>
+#include <memory>
 #include <boost/extension/convenience.hpp>
 // #include <boost/extension/filesystem.hpp>
+
+
 int main()
 {
   using namespace boost::extensions;

Modified: sandbox/libs/extension/examples/versioning/main_versions.cpp
==============================================================================
--- sandbox/libs/extension/examples/versioning/main_versions.cpp (original)
+++ sandbox/libs/extension/examples/versioning/main_versions.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -15,6 +15,7 @@
 #include <boost/extension/convenience.hpp>
 
 #include <iostream>
+#include <memory>
 
 
 #include "../word.hpp"

Modified: sandbox/libs/extension/test/construction.cpp
==============================================================================
--- sandbox/libs/extension/test/construction.cpp (original)
+++ sandbox/libs/extension/test/construction.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -82,11 +82,13 @@
      (Automobile*)0);
 }
 
+namespace boost { namespace extensions {
 template <>
 Automobile * create_function<Automobile, Racecar>::create()
 {
   return new Racecar(101);
 }
+}} // namespace boost::extensions
 
 BOOST_AUTO_TEST_CASE(factory_template)
 {

Modified: sandbox/libs/extension/test/double_param_test.cpp
==============================================================================
--- sandbox/libs/extension/test/double_param_test.cpp (original)
+++ sandbox/libs/extension/test/double_param_test.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -83,11 +83,13 @@
      (Automobile*)0);
 }
 
+namespace boost { namespace extensions {
 template <>
 Automobile * create_function<Automobile, Racecar>::create()
 {
   return new Racecar(25, 2.0f);
 }
+}} // namespace boost::extensions
 
 BOOST_AUTO_TEST_CASE(factory_template)
 {

Modified: sandbox/libs/extension/test/single_param_test.cpp
==============================================================================
--- sandbox/libs/extension/test/single_param_test.cpp (original)
+++ sandbox/libs/extension/test/single_param_test.cpp 2008-04-12 12:08:30 EDT (Sat, 12 Apr 2008)
@@ -83,11 +83,13 @@
      (Automobile*)0);
 }
 
+namespace boost { namespace extensions {
 template <>
 Automobile * create_function<Automobile, Racecar>::create()
 {
   return new Racecar(50);
 }
+}} // namespace boost::extensions
 
 BOOST_AUTO_TEST_CASE(factory_template)
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk