From 0c4f4ff015f7c4a06b9d4c9e8f22f44a57e2a318 Mon Sep 17 00:00:00 2001 From: Ashish Agarwal Date: Sun, 19 May 2013 23:38:06 +0530 Subject: Bug#16194302: SUPPORT FOR FLOATING-POINT SYSTEM VARIABLES USING THE PLUGIN INTERFACE. ISSUE: No support for floating-point plugin system variables. SOLUTION: Allowing plugins to define and expose floating-point system variables of type double. MYSQL_SYSVAR_DOUBLE and MYSQL_THDVAR_DOUBLE are added. ISSUE: Fractional part of the def, min, max values of system variables are ignored. SOLUTION: Adding functions that are used to store the raw representation of a double in the raw bits of unsigned longlong in a way that the binary representation remains the same. --- mysys/my_getopt.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'mysys') diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index adee17ba3d1..8575fde0ca9 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -90,6 +90,35 @@ void my_getopt_register_get_addr(my_getopt_value func_addr) getopt_get_addr= func_addr; } +union ull_dbl +{ + ulonglong ull; + double dbl; +}; + +/** + Returns an ulonglong value containing a raw + representation of the given double value. +*/ +ulonglong getopt_double2ulonglong(double v) +{ + union ull_dbl u; + u.dbl= v; + compile_time_assert(sizeof(ulonglong) >= sizeof(double)); + return u.ull; +} + +/** + Returns the double value which corresponds to + the given raw representation. +*/ +double getopt_ulonglong2double(ulonglong v) +{ + union ull_dbl u; + u.ull= v; + return u.dbl; +} + /** Handle command line options. Sort options. @@ -1044,14 +1073,18 @@ double getopt_double_limit_value(double num, const struct my_option *optp, { my_bool adjusted= FALSE; double old= num; - if (optp->max_value && num > (double) optp->max_value) + double min, max; + + max= getopt_ulonglong2double(optp->max_value); + min= getopt_ulonglong2double(optp->min_value); + if (max && num > max) { - num= (double) optp->max_value; + num= max; adjusted= TRUE; } - if (num < (double) optp->min_value) + if (num < min) { - num= (double) optp->min_value; + num= min; adjusted= TRUE; } if (fix) @@ -1134,7 +1167,7 @@ static void init_one_value(const struct my_option *option, void *variable, *((ulonglong*) variable)= (ulonglong) value; break; case GET_DOUBLE: - *((double*) variable)= ulonglong2double(value); + *((double*) variable)= getopt_ulonglong2double(value); break; case GET_STR: /* -- cgit v1.2.1 From c94ccb237e5f8b0f72c742746aa49f8ff8440f98 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Fri, 14 Jun 2013 10:52:23 +0200 Subject: Bug#16729109: FIX COMPILATION WARNINGS WITH GCC 4.8 Backport to 5.5 (external Bug#69407 Build warnings with mysql) support-files/build-tags: Run etags on sql_yacc.yy, ignore other .yy files unittest/mysys/explain_filename-t.cc: NO_PLAN seems to fail on some platforms, use the actual number instead. --- mysys/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 814f093c2d6..95d3e568be7 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -69,6 +69,11 @@ TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY} ${LIBNSL} ${LIBM} ${LIBRT}) DTRACE_INSTRUMENT(mysys) +# Need explicit pthread for gcc -fsanitize=address +IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=") + TARGET_LINK_LIBRARIES(mysys pthread) +ENDIF() + ADD_EXECUTABLE(thr_lock thr_lock.c) TARGET_LINK_LIBRARIES(thr_lock mysys) SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN") -- cgit v1.2.1 From 1827eb8a2a8afd73603dabb442e7375774578da0 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Wed, 26 Jun 2013 12:19:02 +0300 Subject: Bug #16996656: UNIQUE OPTION PREFIXES NOT DEPRECATED IN 5.5+ Backported the deprecation warnings from WL#6978 to 5.5 --- mysys/my_getopt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 8575fde0ca9..8d1da06af8c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -829,6 +829,7 @@ static int findopt(char *optpat, uint length, { uint count; const struct my_option *opt= *opt_res; + my_bool is_prefix= FALSE; for (count= 0; opt->name; opt++) { @@ -837,11 +838,14 @@ static int findopt(char *optpat, uint length, (*opt_res)= opt; if (!opt->name[length]) /* Exact match */ return 1; + if (!count) { /* We only need to know one prev */ count= 1; *ffname= opt->name; + if (opt->name[length]) + is_prefix= TRUE; } else if (strcmp(*ffname, opt->name)) { @@ -853,6 +857,12 @@ static int findopt(char *optpat, uint length, } } } + if (is_prefix && count == 1) + my_getopt_error_reporter(WARNING_LEVEL, + "Using unique option prefix %.*s instead of %s " + "is deprecated and will be removed in a future " + "release. Please use the full name instead.", + length, optpat, *ffname); return count; } -- cgit v1.2.1