
Module: ppl/ppl Branch: master Commit: e7717fe6c534874f4eb8752718c8e56c24736c1a URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e7717fe6c5348...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Wed Oct 1 13:55:27 2014 +0200
No need to depend on PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK for auto initialization. (Thanks to Keith Clifford.)
---
demos/ppl_lcdd/ppl_lcdd.cc | 6 ------ demos/ppl_lpsol/ppl_lpsol.c | 6 ------ demos/ppl_pips/ppl_pips.cc | 6 ------ src/Init.cc | 7 +------ src/set_GMP_memory_alloc_funcs.cc | 7 +------ tests/Polyhedron/memory1.cc | 17 ----------------- 6 files changed, 2 insertions(+), 47 deletions(-)
diff --git a/demos/ppl_lcdd/ppl_lcdd.cc b/demos/ppl_lcdd/ppl_lcdd.cc index 07ca09e..d4465b6 100755 --- a/demos/ppl_lcdd/ppl_lcdd.cc +++ b/demos/ppl_lcdd/ppl_lcdd.cc @@ -45,12 +45,6 @@ namespace PPL = Parma_Polyhedra_Library;
typedef PPL::C_Polyhedron POLYHEDRON_TYPE;
-#if !PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK -extern "C" void -ppl_set_GMP_memory_allocation_functions(void) { -} -#endif - #elif defined(USE_POLKA)
#include <ppl-config.h> diff --git a/demos/ppl_lpsol/ppl_lpsol.c b/demos/ppl_lpsol/ppl_lpsol.c index c0f10ef..52d1cce 100644 --- a/demos/ppl_lpsol/ppl_lpsol.c +++ b/demos/ppl_lpsol/ppl_lpsol.c @@ -1313,12 +1313,6 @@ error_handler(enum ppl_enum_error_code code, fatal("PPL error code %d: %s", code, description); }
-#if !PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK -void -ppl_set_GMP_memory_allocation_functions(void) { -} -#endif - #if defined(NDEBUG)
#if !(defined(PPL_GLPK_HAS_GLP_TERM_OUT) && defined(GLP_OFF)) diff --git a/demos/ppl_pips/ppl_pips.cc b/demos/ppl_pips/ppl_pips.cc index 2ab9dc3..1259d80 100644 --- a/demos/ppl_pips/ppl_pips.cc +++ b/demos/ppl_pips/ppl_pips.cc @@ -41,12 +41,6 @@ namespace PPL = Parma_Polyhedra_Library;
typedef PPL::C_Polyhedron POLYHEDRON_TYPE;
-#if !PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK -extern "C" void -ppl_set_GMP_memory_allocation_functions(void) { -} -#endif - #elif defined(USE_PIPLIB)
#error "PipLib not supported yet" diff --git a/src/Init.cc b/src/Init.cc index 0daaab0..1b6bc2b 100644 --- a/src/Init.cc +++ b/src/Init.cc @@ -48,12 +48,7 @@ unsigned int PPL::Init::count = 0; PPL::fpu_rounding_direction_type PPL::Init::old_rounding_direction;
extern "C" void -ppl_set_GMP_memory_allocation_functions(void) -#if PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK - __attribute__((weak)); -#else - ; -#endif +ppl_set_GMP_memory_allocation_functions(void);
#if PPL_CAN_CONTROL_FPU \ && defined(PPL_ARM_CAN_CONTROL_FPU) && PPL_ARM_CAN_CONTROL_FPU diff --git a/src/set_GMP_memory_alloc_funcs.cc b/src/set_GMP_memory_alloc_funcs.cc index 5e696a1..ddb826f 100644 --- a/src/set_GMP_memory_alloc_funcs.cc +++ b/src/set_GMP_memory_alloc_funcs.cc @@ -24,13 +24,8 @@ site: http://bugseng.com/products/ppl/ . */ #include "ppl-config.h"
extern "C" void -ppl_set_GMP_memory_allocation_functions(void) -#if PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK - __attribute__((weak)); +ppl_set_GMP_memory_allocation_functions(void);
void ppl_set_GMP_memory_allocation_functions(void) { } -#else - ; -#endif diff --git a/tests/Polyhedron/memory1.cc b/tests/Polyhedron/memory1.cc index c3e59ff..f49e5f0 100644 --- a/tests/Polyhedron/memory1.cc +++ b/tests/Polyhedron/memory1.cc @@ -21,9 +21,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. For the most up-to-date information see the Parma Polyhedra Library site: http://bugseng.com/products/ppl/ . */
-// Note: we cannot know, at this stage whether -// PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK evaluates to true. -#define PPL_NO_AUTOMATIC_INITIALIZATION #include "ppl_test.hh" #include <new> #include <cstring> @@ -162,23 +159,13 @@ cxx_free(void* p, size_t) {
#define INIT_MEMORY 3*1024*1024
-#if PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK extern "C" void ppl_set_GMP_memory_allocation_functions(void) { mp_set_memory_functions(cxx_malloc, cxx_realloc, cxx_free); } -#endif // PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK
int main() TRY { -#if !PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK - mp_set_memory_functions(cxx_malloc, cxx_realloc, cxx_free); -#endif // !PPL_CXX_SUPPORTS_ATTRIBUTE_WEAK - - // Note: we have included <ppl.hh> under the definition of - // PPL_NO_AUTOMATIC_INITIALIZATION. - Parma_Polyhedra_Library::initialize(); - set_handlers();
// Find a dimension that cannot be computed with INIT_MEMORY bytes. @@ -209,10 +196,6 @@ main() TRY { nout << "Estimated memory for dimension " << dimension << ": " << (lower_bound+upper_bound)/2 << " bytes" << endl;
- // Note: we have included <ppl.hh> under the definition of - // PPL_NO_AUTOMATIC_INITIALIZATION. - Parma_Polyhedra_Library::finalize(); - return 0; } CATCH