From 072fa90d9e7f5ac4df1fb42054b906b872497113 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Apr 2005 11:25:08 +0200 Subject: BUG#9714 libsupc++ problem - Remove linking of libsupc++ - Move all local static variables to filescope configure.in: Remove linking with libsupc++ sql/examples/ha_archive.cc: Move local static variables to file scope sql/examples/ha_example.cc: Move local static variables to file scope sql/examples/ha_tina.cc: Move local static variables to file scope sql/ha_berkeley.cc: Move local static variables to file scope sql/ha_blackhole.cc: Move local static variables to file scope sql/ha_federated.cc: Move local static variables to file scope sql/ha_heap.cc: Move local static variables to file scope sql/ha_innodb.cc: Move local static variables to file scope sql/ha_myisam.cc: Move local static variables to file scope sql/ha_myisammrg.cc: Move local static variables to file scope sql/ha_ndbcluster.cc: Move local static variables to file scope sql/item.cc: Move local static instance variables to file scope sql/item_sum.cc: Move local static variables to file scope --- configure.in | 38 +++++++++----------------------------- sql/examples/ha_archive.cc | 13 +++++++++++-- sql/examples/ha_example.cc | 8 +++++++- sql/examples/ha_tina.cc | 9 ++++++++- sql/ha_berkeley.cc | 9 +++++++-- sql/ha_blackhole.cc | 9 ++++++--- sql/ha_federated.cc | 9 ++++----- sql/ha_heap.cc | 7 ++++++- sql/ha_innodb.cc | 9 ++++++--- sql/ha_myisam.cc | 10 +++++++++- sql/ha_myisammrg.cc | 10 +++++++++- sql/ha_ndbcluster.cc | 9 +++++++-- sql/item.cc | 12 ++++++------ sql/item_sum.cc | 14 ++++++++------ 14 files changed, 103 insertions(+), 63 deletions(-) diff --git a/configure.in b/configure.in index ff4527ee09f..a5b9edae877 100644 --- a/configure.in +++ b/configure.in @@ -336,7 +336,7 @@ AC_SUBST(LD) AC_SUBST(INSTALL_SCRIPT) export CC CXX CFLAGS LD LDFLAGS AR - +echo "GXX: $GXX" if test "$GXX" = "yes" then # mysqld requires -fno-implicit-templates. @@ -344,36 +344,16 @@ then # mysqld doesn't use run-time-type-checking, so we disable it. CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" - # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux, - # we will gets some problems when linking static programs. - # The following code is used to fix this problem. - + #CXX_VERNO=`echo $CXX_VERSION | sed -e 's/[[^0-9. ]]//g; s/^ *//g; s/ .*//g'` + echo "CXX: $CXX" if echo $CXX | grep gcc > /dev/null 2>&1 then - GCC_VERSION=`gcc -v 2>&1 | grep version | sed -e 's/[[^0-9. ]]//g; s/^ *//g; s/ .*//g'` - case $SYSTEM_TYPE in - *freebsd*) - # The libsupc++ library on freebsd with gcc 3.4.2 is dependent on - # libstdc++, disable it since other solution works fine - GCC_VERSION="NOSUPCPP_$GCC_VERSION" - ;; - *) - ;; - esac - echo "Using gcc version '$GCC_VERSION'" - case "$GCC_VERSION" in - 3.4.*|3.5.*) - # Statically link the language support function's found in libsupc++.a - LIBS="$LIBS -lsupc++" - echo "Using -libsupc++ for static linking with gcc" - ;; - *) - # Using -lsupc++ doesn't work in gcc 3.3 on SuSE 9.2 - # (causes link failures when linking things staticly) - CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL" - echo "Using MYSYS_NEW for static linking with gcc" - ;; - esac + echo "Setting CXXFLAGS" + # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux, + # we will gets some problems when linking static programs. + # The following code is used to fix this problem. + CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL" + echo "Using MYSYS_NEW for static linking with gcc" fi fi diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index a88bfc0391b..231031c9834 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -431,11 +431,20 @@ int ha_archive::free_share(ARCHIVE_SHARE *share) } -/* +/* We just implement one additional file extension. */ +static const char *ha_archive_exts[] = { + ARZ, + ARN, + ARM, + NullS +}; + const char **ha_archive::bas_ext() const -{ static const char *ext[]= { ARZ, ARN, ARM, NullS }; return ext; } +{ + return ha_archive_exts; +} /* diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc index d043a66e71a..562b51878bf 100644 --- a/sql/examples/ha_example.cc +++ b/sql/examples/ha_example.cc @@ -186,8 +186,14 @@ static int free_share(EXAMPLE_SHARE *share) exist for the storage engine. This is also used by the default rename_table and delete_table method in handler.cc. */ +static const char *ha_example_exts[] = { + NullS +}; + const char **ha_example::bas_ext() const -{ static const char *ext[]= { NullS }; return ext; } +{ + return ha_example_exts; +} /* diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index b515932d25f..9ac446587ec 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -384,8 +384,15 @@ int ha_tina::find_current_row(byte *buf) If frm_error() is called in table.cc this is called to find out what file extensions exist for this handler. */ +static const char *ha_tina_exts[] = { + ".CSV", + NullS +}; + const char **ha_tina::bas_ext() const -{ static const char *ext[]= { ".CSV", NullS }; return ext; } +{ + return ha_tina_exts; +} /* diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 54d9865ddd5..04d81b2f95a 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -371,10 +371,15 @@ void berkeley_cleanup_log_files(void) /***************************************************************************** ** Berkeley DB tables *****************************************************************************/ +static const char *ha_berkeley_exts[] = { + ha_berkeley_ext, + NullS +}; const char **ha_berkeley::bas_ext() const -{ static const char *ext[]= { ha_berkeley_ext, NullS }; return ext; } - +{ + return ha_berkeley_exts; +} ulong ha_berkeley::index_flags(uint idx, uint part, bool all_parts) const { diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index e34d5d723a4..d9aedbe751d 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -25,10 +25,13 @@ #include "ha_blackhole.h" +static const char *ha_black_hole_exts[] = { + NullS +}; + const char **ha_blackhole::bas_ext() const -{ - static const char *ext[]= { NullS }; - return ext; +{ + return ha_blackhole_exts; } int ha_blackhole::open(const char *name, int mode, uint test_if_locked) diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 33acc9cad0b..0ac209d82e0 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -941,14 +941,13 @@ static int free_share(FEDERATED_SHARE *share) also used by the default rename_table and delete_table method in handler.cc. */ +static const char *ha_federated_exts[] = { + NullS +}; const char **ha_federated::bas_ext() const { - static const char *ext[]= - { - NullS - }; - return ext; + return ha_federated_exts; } diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 0d700f6c9a5..52ff776c5d6 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -26,9 +26,14 @@ /***************************************************************************** ** HEAP tables *****************************************************************************/ +static const char *ha_heap_exts[] = { + NullS +}; const char **ha_heap::bas_ext() const -{ static const char *ext[1]= { NullS }; return ext; } +{ + return ha_heap_exts; +} /* Hash index statistics is updated (copied from HP_KEYDEF::hash_buckets to diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 3f592e36219..4d334c24107 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1863,17 +1863,20 @@ ha_innobase::get_row_type() const /******************************************************************** Gives the file extension of an InnoDB single-table tablespace. */ +static const char* ha_innobase_exts[] = { + ".ibd", + NullS +}; const char** ha_innobase::bas_ext() const /*========================*/ /* out: file extension string */ { - static const char* ext[] = {".ibd", NullS}; - - return(ext); + return ha_innobase_exts; } + /********************************************************************* Normalizes a table name string. A normalized name consists of the database name catenated to '/' and table name. An example: diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 2179eaa7f8f..2049efb73db 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -123,8 +123,16 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...) } +static const char *ha_myisam_exts[] = { + ".MYI", + ".MYD", + NullS +}; + const char **ha_myisam::bas_ext() const -{ static const char *ext[]= { ".MYI",".MYD", NullS }; return ext; } +{ + return ha_myisam_exts; +} const char *ha_myisam::index_type(uint key_number) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 4cd39660728..5add9478bf4 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -32,8 +32,16 @@ ** MyISAM MERGE tables *****************************************************************************/ +static const char *ha_myisammrg_exts[] = { + ".MRG", + NullS +}; + const char **ha_myisammrg::bas_ext() const -{ static const char *ext[]= { ".MRG", NullS }; return ext; } +{ + return ha_myisammrg_exts; +} + const char *ha_myisammrg::index_type(uint key_number) { diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 020a76b667e..ea73ad224af 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3062,10 +3062,15 @@ int ha_ndbcluster::extra_opt(enum ha_extra_function operation, ulong cache_size) DBUG_RETURN(extra(operation)); } +static const char *ha_ndbcluster_exts[] = { + ha_ndb_ext, + NullS +}; const char** ha_ndbcluster::bas_ext() const -{ static const char *ext[]= { ha_ndb_ext, NullS }; return ext; } - +{ + return ha_ndbcluster_exts; +} /* How many seeks it will take to read through the table diff --git a/sql/item.cc b/sql/item.cc index 73c8e80228b..57055a9745a 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -43,11 +43,11 @@ void Hybrid_type_traits::fix_length_and_dec(Item *item, Item *arg) const item->max_length= item->float_length(arg->decimals); } +static const Hybrid_type_traits real_traits_instance; const Hybrid_type_traits *Hybrid_type_traits::instance() { - static const Hybrid_type_traits real_traits; - return &real_traits; + return &real_traits_instance; } @@ -67,11 +67,11 @@ Hybrid_type_traits::val_str(Hybrid_type *val, String *to, uint8 decimals) const } /* Hybrid_type_traits_decimal */ +static const Hybrid_type_traits_decimal decimal_traits_instance; const Hybrid_type_traits_decimal *Hybrid_type_traits_decimal::instance() { - static const Hybrid_type_traits_decimal decimal_traits; - return &decimal_traits; + return &decimal_traits_instance; } @@ -143,11 +143,11 @@ Hybrid_type_traits_decimal::val_str(Hybrid_type *val, String *to, } /* Hybrid_type_traits_integer */ +static const Hybrid_type_traits_integer integer_traits_instance; const Hybrid_type_traits_integer *Hybrid_type_traits_integer::instance() { - static const Hybrid_type_traits_integer integer_traits; - return &integer_traits; + return &integer_traits_instance; } void diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 64f23c3fc08..3dd4b6618a2 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -506,7 +506,6 @@ Item_sum_distinct::Item_sum_distinct(THD *thd, Item_sum_distinct *original) This is to speedup SUM/AVG(DISTINCT) evaluation for 8-32 bit integer values. */ - struct Hybrid_type_traits_fast_decimal: public Hybrid_type_traits_integer { @@ -521,13 +520,16 @@ struct Hybrid_type_traits_fast_decimal: public val->traits= Hybrid_type_traits_decimal::instance(); val->traits->div(val, u); } - static const Hybrid_type_traits_fast_decimal *instance() - { - static const Hybrid_type_traits_fast_decimal fast_decimal_traits; - return &fast_decimal_traits; - } + static const Hybrid_type_traits_fast_decimal *instance(); }; +static const Hybrid_type_traits_fast_decimal fast_decimal_traits_instance; + +const Hybrid_type_traits_fast_decimal + *Hybrid_type_traits_fast_decimal::instance() +{ + return &fast_decimal_traits_instance; +} void Item_sum_distinct::fix_length_and_dec() { -- cgit v1.2.1