You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

306 lines
6.8 KiB

Merge maint2.mysql.com:/data/localhome/tsmith/bk/g51 into maint2.mysql.com:/data/localhome/tsmith/bk/51 client/mysqltest.c: Auto merged configure.in: Auto merged include/config-netware.h: Auto merged include/mysql_com.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/partition_mgm.result: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/grant.test: Auto merged mysql-test/t/innodb_mysql.test: Auto merged sql/ha_innodb.cc: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_show.cc: Auto merged storage/innobase/btr/btr0btr.c: Auto merged storage/innobase/buf/buf0buf.c: Auto merged storage/innobase/dict/dict0dict.c: Auto merged storage/innobase/fil/fil0fil.c: Auto merged storage/innobase/fsp/fsp0fsp.c: Auto merged storage/innobase/include/btr0cur.ic: Auto merged storage/innobase/include/buf0buf.ic: Auto merged storage/innobase/log/log0log.c: Auto merged storage/innobase/log/log0recv.c: Auto merged storage/innobase/os/os0file.c: Auto merged storage/innobase/row/row0sel.c: Auto merged storage/innobase/srv/srv0start.c: Auto merged storage/innobase/ut/ut0dbg.c: Auto merged tests/mysql_client_test.c: Auto merged BUILD/check-cpu: Manual merge storage/innobase/row/row0mysql.c: Manual merge
19 years ago
Merge maint2.mysql.com:/data/localhome/tsmith/bk/g51 into maint2.mysql.com:/data/localhome/tsmith/bk/51 client/mysqltest.c: Auto merged configure.in: Auto merged include/config-netware.h: Auto merged include/mysql_com.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/partition_mgm.result: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/grant.test: Auto merged mysql-test/t/innodb_mysql.test: Auto merged sql/ha_innodb.cc: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_show.cc: Auto merged storage/innobase/btr/btr0btr.c: Auto merged storage/innobase/buf/buf0buf.c: Auto merged storage/innobase/dict/dict0dict.c: Auto merged storage/innobase/fil/fil0fil.c: Auto merged storage/innobase/fsp/fsp0fsp.c: Auto merged storage/innobase/include/btr0cur.ic: Auto merged storage/innobase/include/buf0buf.ic: Auto merged storage/innobase/log/log0log.c: Auto merged storage/innobase/log/log0recv.c: Auto merged storage/innobase/os/os0file.c: Auto merged storage/innobase/row/row0sel.c: Auto merged storage/innobase/srv/srv0start.c: Auto merged storage/innobase/ut/ut0dbg.c: Auto merged tests/mysql_client_test.c: Auto merged BUILD/check-cpu: Manual merge storage/innobase/row/row0mysql.c: Manual merge
19 years ago
Bug#53445: Build with -Wall and fix warnings that it generates Apart strict-aliasing warnings, fix the remaining warnings generated by GCC 4.4.4 -Wall and -Wextra flags. One major source of warnings was the in-house function my_bcmp which (unconventionally) took pointers to unsigned characters as the byte sequences to be compared. Since my_bcmp and bcmp are deprecated functions whose only difference with memcmp is the return value, every use of the function is replaced with memcmp as the special return value wasn't actually being used by any caller. There were also various other warnings, mostly due to type mismatches, missing return values, missing prototypes, dead code (unreachable) and ignored return values. BUILD/SETUP.sh: Remove flags that are implied by -Wall and -Wextra. Do not warn about unused parameters in C++. BUILD/check-cpu: Print only the compiler version instead of verbose banner. Although the option is gcc specific, the check was only being used for GCC specific checks anyway. client/mysql.cc: bcmp is no longer defined. client/mysqltest.cc: Pass a string to function expecting a format string. Replace use of bcmp with memcmp. cmd-line-utils/readline/Makefile.am: Always define _GNU_SOURCE when compiling GNU readline. Required to make certain prototypes visible. cmd-line-utils/readline/input.c: Condition for the code to be meaningful. configure.in: Remove check for bcmp. extra/comp_err.c: Use appropriate type. extra/replace.c: Replace use of bcmp with memcmp. extra/yassl/src/crypto_wrapper.cpp: Do not ignore the return value of fgets. Retrieve the file position if fgets succeed -- if it fails, the function will bail out and return a error. extra/yassl/taocrypt/include/blowfish.hpp: Use a single array instead of accessing positions of the sbox_ through a subscript to pbox_. extra/yassl/taocrypt/include/runtime.hpp: One definition of such functions is enough. extra/yassl/taocrypt/src/aes.cpp: Avoid potentially ambiguous conditions. extra/yassl/taocrypt/src/algebra.cpp: Rename arguments to avoid shadowing related warnings. extra/yassl/taocrypt/src/blowfish.cpp: Avoid potentially ambiguous conditions. extra/yassl/taocrypt/src/integer.cpp: Do not define type within a anonymous union. Use a variable to return a value instead of leaving the result in a register -- compiler does not know the logic inside the asm. extra/yassl/taocrypt/src/misc.cpp: Define handler for pure virtual functions. Remove unused code. extra/yassl/taocrypt/src/twofish.cpp: Avoid potentially ambiguous conditions. extra/yassl/testsuite/test.hpp: Function must have C language linkage. include/m_string.h: Remove check which relied on bcmp being defined -- they weren't being used as bcmp is only visible when _BSD_SOURCE is defined. include/my_bitmap.h: Remove bogus helpers which were used only in a few files and were causing warnings about dead code. include/my_global.h: Due to G++ bug, always silence false-positive uninitialized variables warnings when compiling C++ code with G++. Remove bogus helper. libmysql/Makefile.shared: Remove built-in implementation of bcmp. mysql-test/lib/My/SafeProcess/safe_process.cc: Cast pid to largest possible type for a process identifier. mysys/mf_loadpath.c: Leave space of the ending nul. mysys/mf_pack.c: Replace bcmp with memcmp. mysys/my_bitmap.c: Dead code removal. mysys/my_gethwaddr.c: Remove unused variable. mysys/my_getopt.c: Silence bogus uninitialized variable warning. Do not cast away the constant qualifier. mysys/safemalloc.c: Cast to expected type. mysys/thr_lock.c: Silence bogus uninitialized variable warning. sql/field.cc: Replace bogus helper with a more appropriate logic which is used throughout the code. sql/item.cc: Remove bogus logical condition which always evaluates to TRUE. sql/item_create.cc: Simplify code to avoid signedness related warnings. sql/log_event.cc: Replace use of bcmp with memcmp. No need to use helpers for simple bit operations. sql/log_event_old.cc: Replace bmove_align with memcpy. sql/mysqld.cc: Move use declaration of variable to the ifdef block where it is used. Remove now-unnecessary casts and arguments. sql/set_var.cc: Replace bogus helpers with simple and classic bit operations. sql/slave.cc: Cast to expected type and silence bogus warning. sql/sql_class.h: Don't use enum values as bit flags, the supposed type safety is bogus as the combined bit flags are not a value in the enumeration. sql/udf_example.c: Only declare variable when necessary. sql/unireg.h: Replace use of bmove_align with memcpy. storage/innobase/os/os0file.c: Silence bogus warning. storage/myisam/mi_open.c: Remove bogus cast, DBUG_DUMP expects a pointer to unsigned char. storage/myisam/mi_page.c: Remove bogus cast, DBUG_DUMP expects a pointer to unsigned char. strings/bcmp.c: Remove built-in bcmp. strings/ctype-ucs2.c: Silence bogus warning. tests/mysql_client_test.c: Use a appropriate type as expected by simple_command().
16 years ago
  1. #!/bin/sh
  2. #
  3. # Check cpu of current machine and find the
  4. # best compiler optimization flags for gcc
  5. # Will return result in:
  6. # cpu_arg : Type of CPU
  7. # low_cpu_arg : Type of CPU used up until GCC v3.3
  8. # check_cpu_args : Arguments for GCC compiler settings
  9. #
  10. check_compiler_cpu_flags () {
  11. # different compiler versions have different option names
  12. # for CPU specific command line options
  13. if test -z "$CC" ; then
  14. cc="gcc";
  15. else
  16. cc=$CC
  17. fi
  18. # check if compiler is gcc and dump its version
  19. cc_verno=`$cc -dumpversion 2>/dev/null`
  20. if test "x$?" = "x0" ; then
  21. set -- `echo $cc_verno | tr '.' ' '`
  22. cc_ver="GCC"
  23. cc_major=$1
  24. cc_minor=$2
  25. cc_patch=$3
  26. cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
  27. fi
  28. case "$cc_ver--$cc_verno" in
  29. *GCC*)
  30. # different gcc backends (and versions) have different CPU flags
  31. case `gcc -dumpmachine` in
  32. i?86-* | x86_64-*)
  33. if test "$cc_comp" -lt 304 ; then
  34. check_cpu_cflags="-mcpu=${low_cpu_arg}"
  35. elif test "$cc_comp" -ge 402 ; then
  36. check_cpu_cflags="-mtune=native"
  37. else
  38. check_cpu_cflags="-mtune=${cpu_arg}"
  39. fi
  40. ;;
  41. ppc-*)
  42. check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
  43. ;;
  44. *)
  45. check_cpu_cflags=""
  46. return
  47. ;;
  48. esac
  49. ;;
  50. 2.95.*)
  51. # GCC 2.95 doesn't expose its name in --version output
  52. check_cpu_cflags="-m${cpu_arg}"
  53. ;;
  54. *)
  55. check_cpu_cflags=""
  56. return
  57. ;;
  58. esac
  59. # now we check whether the compiler really understands the cpu type
  60. touch __test.c
  61. while [ "$cpu_arg" ] ; do
  62. printf "testing $cpu_arg ... " >&2
  63. # compile check
  64. eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
  65. if test "x$?" = "x0" ; then
  66. echo ok >&2
  67. break;
  68. fi
  69. echo failed >&2
  70. check_cpu_cflags=""
  71. break;
  72. done
  73. rm __test.*
  74. return 0
  75. }
  76. check_cpu () {
  77. CPUINFO=/proc/cpuinfo
  78. if test -n "$TEST_CPUINFO" ; then
  79. CPUINFO=$TEST_CPUINFO
  80. fi
  81. if test -r "$CPUINFO" -a "$CPUINFO" != " " ; then
  82. # on Linux (and others?) we can get detailed CPU information out of /proc
  83. cpuinfo="cat $CPUINFO"
  84. # detect CPU architecture
  85. cpu_arch=`$cpuinfo | grep 'arch' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
  86. # detect CPU family
  87. cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
  88. if test -z "$cpu_family" ; then
  89. cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
  90. fi
  91. # detect CPU vendor and model
  92. cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
  93. model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
  94. if test -z "$model_name" ; then
  95. model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
  96. fi
  97. # fallback: get CPU model from uname output
  98. if test -z "$model_name" ; then
  99. model_name=`uname -m`
  100. fi
  101. # parse CPU flags
  102. for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //' -e 's/[^a-zA-Z0-9_ ]/_/g'`; do
  103. eval cpu_flag_$flag=yes
  104. done
  105. else
  106. # Fallback when there is no /proc/cpuinfo
  107. CPUINFO=" "
  108. case "`uname -s`" in
  109. FreeBSD|OpenBSD)
  110. cpu_family=`uname -m`;
  111. model_name=`sysctl -n hw.model`
  112. ;;
  113. Darwin)
  114. cpu_family=`sysctl -n machdep.cpu.vendor`
  115. model_name=`sysctl -n machdep.cpu.brand_string`
  116. if [ -z "$cpu_family" -o -z "$model_name" ]
  117. then
  118. cpu_family=`uname -p`
  119. model_name=`machine`
  120. fi
  121. ;;
  122. *)
  123. cpu_family=`uname -p`;
  124. model_name=`uname -m`;
  125. ;;
  126. esac
  127. fi
  128. # detect CPU shortname as used by gcc options
  129. # this list is not complete, feel free to add further entries
  130. cpu_arg=""
  131. low_cpu_arg=""
  132. case "$cpu_vendor--$cpu_family--$model_name--$spu_arch" in
  133. # DEC Alpha
  134. *Alpha*EV6*)
  135. cpu_arg="ev6";
  136. ;;
  137. #Core 2 Duo
  138. *Intel*Core\(TM\)2*)
  139. cpu_arg="nocona"
  140. core2="yes"
  141. ;;
  142. # Intel ia32
  143. *Intel*Core*|*X[eE][oO][nN]*)
  144. # a Xeon is just another pentium4 ...
  145. # ... unless it has the "lm" (long-mode) flag set,
  146. # in that case it's a Xeon with EM64T support
  147. # If SSE3 support exists it is a Core2 Duo or newer
  148. # So is Intel Core.
  149. if [ -z "$cpu_flag_lm" ]; then
  150. cpu_arg="pentium4"
  151. else
  152. cpu_arg="nocona"
  153. fi
  154. if test -z "$cpu_flag_ssse3" ; then
  155. core2="no"
  156. else
  157. core2="yes"
  158. fi
  159. ;;
  160. *Pentium*4*Mobile*)
  161. cpu_arg="pentium4m"
  162. ;;
  163. *Pentium\(R\)*\ M*)
  164. cpu_arg="pentium-m"
  165. low_cpu_arg="pentium3"
  166. ;;
  167. *Pentium\(R\)*\ D*)
  168. cpu_arg="prescott"
  169. ;;
  170. *Pentium*4*)
  171. cpu_arg="pentium4"
  172. ;;
  173. *Pentium*III*Mobile*)
  174. cpu_arg="pentium3m"
  175. ;;
  176. *Pentium*III*)
  177. cpu_arg="pentium3"
  178. ;;
  179. *Pentium*M*pro*)
  180. cpu_arg="pentium-m"
  181. ;;
  182. *Celeron\(R\)*\ M*)
  183. cpu_arg="pentium-m"
  184. ;;
  185. *Celeron*Coppermine*)
  186. cpu_arg="pentium3"
  187. ;;
  188. *Celeron\(R\)*)
  189. cpu_arg="pentium4"
  190. ;;
  191. *Celeron*)
  192. cpu_arg="pentium2"
  193. ;;
  194. *Atom*)
  195. cpu_arg="prescott"
  196. ;;
  197. *GenuineIntel*)
  198. cpu_arg="pentium"
  199. ;;
  200. *Turion*)
  201. cpu_arg="athlon64"
  202. ;;
  203. *Athlon*64*)
  204. cpu_arg="athlon64"
  205. ;;
  206. *Athlon*)
  207. cpu_arg="athlon"
  208. ;;
  209. *AMD-K7*)
  210. cpu_arg="athlon"
  211. ;;
  212. *Athlon*XP\ *)
  213. cpu_arg="athlon-xp"
  214. ;;
  215. *AMD*Sempron\(tm\)*)
  216. cpu_arg="athlon-mp"
  217. ;;
  218. *AMD*Athlon\(tm\)\ 64*)
  219. cpu_arg="k8"
  220. ;;
  221. *Opteron*)
  222. cpu_arg="opteron"
  223. ;;
  224. *Phenom*)
  225. cpu_arg="k8"
  226. ;;
  227. *AuthenticAMD*)
  228. cpu_arg="k6"
  229. ;;
  230. *VIA\ *)
  231. cpu_arg="i686"
  232. ;;
  233. # MacOSX / Intel
  234. *i386*i486*)
  235. cpu_arg="pentium-m"
  236. ;;
  237. *i386*)
  238. cpu_arg="i386"
  239. ;;
  240. # Intel ia64
  241. *Itanium*)
  242. cpu_arg="itanium"
  243. ;;
  244. *IA-64*)
  245. cpu_arg="itanium"
  246. ;;
  247. # Solaris Sparc
  248. *sparc*sun4[uv]*)
  249. cpu_arg="sparc"
  250. ;;
  251. # Power PC
  252. *ppc*)
  253. cpu_arg="powerpc"
  254. ;;
  255. *powerpc*)
  256. cpu_arg="powerpc"
  257. ;;
  258. # unknown
  259. *)
  260. cpu_arg=""
  261. ;;
  262. esac
  263. if test "x$low_cpu_arg" = "x" ; then
  264. low_cpu_arg="$cpu_arg"
  265. fi
  266. if test -z "$cpu_arg" ; then
  267. if test "$CPUINFO" != " " ; then
  268. # fallback to uname if necessary
  269. TEST_CPUINFO=" "
  270. check_cpu_cflags=""
  271. check_cpu
  272. return
  273. fi
  274. echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
  275. check_cpu_cflags=""
  276. return
  277. fi
  278. if test "x$compiler" = "x" ; then
  279. check_compiler_cpu_flags
  280. fi
  281. if test "x$core2" = "xyes" ; then
  282. cpu_arg="core2"
  283. fi
  284. return 0
  285. }
  286. check_cpu