Commit graph

57 commits

Author SHA1 Message Date
Kent Boortz
1400d7a2cc Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
e5ce023f57 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Davi Arnaut
c96b249fc3 Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix warnings flagged by the new warning option -Wunused-but-set-variable
that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The
option causes a warning whenever a local variable is assigned to but is
later unused. It also warns about meaningless pointer dereferences.
2010-07-20 15:07:36 -03:00
Davi Arnaut
93fb8bb235 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.
2010-07-02 15:30:47 -03:00
Davi Arnaut
bb036c93b4 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Essentially, the problem is that large parts of the server were
developed in simpler times (last decades, pre C99 standard) when
strict aliasing and compilers supporting such optimizations were
rare to non-existent. Thus, when compiling the server with a modern
compiler that uses strict aliasing rules to perform optimizations,
there are several places in the code that might trigger undefined
behavior.

As evinced by some recent bugs, GCC does a somewhat good of job
misoptimizing such code, but on the other hand also gives warnings
about suspicious code. One problem is that the warnings aren't
always accurate, yet we can't afford to just shut them off as we
might miss real cases. False-positive cases are aggravated mostly
by casts that are likely to trigger undefined behavior.

The solution is to start a cleanup process focused on fixing and
reducing the amount of strict-aliasing related warnings produced
by GCC and others compilers. A good deal of noise reduction can
be achieved by just removing useless casts that are product of
historical cruft and are likely to trigger undefined behavior if
dereferenced.
2010-06-10 17:16:43 -03:00
Georgi Kodinov
2942ace6bb merge 2009-11-20 12:11:31 +02:00
Georgi Kodinov
6b3b2c0cd4 Bug#48864: MySQL fails to compile on 64 bit Fedora 12
Fixed 2 errors in comp_err executable : 
1. Wrong (off by 1) length passed to my_checksum()
2. strmov() was used on overlapping strings. This is
 not legal according to the docs in stpcpy(). Used 
the overlap safe memmove() instead.
2009-11-18 17:24:10 +02:00
Ignacio Galarza
2d9421c3bb Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Ignacio Galarza
2b85c64d65 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
msvensson@pilot.mysql.com
f0fa6936c7 Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.0-maint
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-new-maint
2007-10-05 19:58:20 +02:00
msvensson@pilot.mysql.com
0a07b64d8a Fixed Bug #27789 "Wrong permissions of sql/share/language directories" 2007-10-05 19:55:00 +02:00
jani@a88-113-38-195.elisa-laajakaista.fi
fc3b3a0a86 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-05-24 13:24:36 +03:00
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
serg@janus.mylan
00479a441d wl#2936 post-merge fixes 2007-04-16 18:16:17 +02:00
tsmith@quadxeon.mysql.com
0303429257 Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/51
2007-03-08 08:17:12 +01:00
tsmith@quadxeon.mysql.com
fee7ab58c6 comp_err.c: return ha_checksum from checksum_format_specifier() - more correct, avoid a compiler warning 2007-03-08 08:15:30 +01:00
msvensson@pilot.blaudden
f5778fc73e Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
2007-03-01 18:12:56 +01:00
msvensson@pilot.blaudden
51a71fb667 Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.1
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
2007-03-01 14:53:32 +01:00
monty@mysql.com/narttu.mysql.fi
f0ae3ce9b9 Fixed compiler warnings
Fixed compile-pentium64 scripts
Fixed wrong estimate of update_with_key_prefix in sql-bench
Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1
Fixed unsafe define of uint4korr()
Fixed that --extern works with mysql-test-run.pl
Small trivial cleanups
This also fixes a bug in counting number of rows that are updated when we have many simultanous queries
Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc
Split handle_one_connection() into reusable sub functions.
Split create_new_thread() into reusable sub functions.
Added thread_scheduler; Preliminary interface code for future thread_handling code.

Use 'my_thread_id' for internal thread id's
Make thr_alarm_kill() to depend on thread_id instead of thread
Make thr_abort_locks_for_thread() depend on thread_id instead of thread
In store_globals(), set my_thread_var->id to be thd->thread_id.
Use my_thread_var->id as basis for my_thread_name()
The above changes makes the connection we have between THD and threads more soft.

Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions
Fixed compiler warnings
Fixed core dumps when running with --debug
Removed setting of signal masks (was never used)
Made event code call pthread_exit() (portability fix)
Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called.
Made handling of thread_id and thd->variables.pseudo_thread_id uniform.
Removed one common 'not freed memory' warning from mysqltest
Fixed a couple of usage of not initialized warnings (unlikely cases)
Suppress compiler warnings from bdb and (for the moment) warnings from ndb
2007-02-23 13:13:55 +02:00
msvensson@pilot.blaudden
4702ad54e5 Merge pilot.blaudden:/home/msvensson/mysql/comp_err_checksum/my50-comp_err_checksum
into  pilot.blaudden:/home/msvensson/mysql/comp_err_checksum/my51-comp_err_checksum
2007-02-22 16:44:37 +01:00
msvensson@pilot.blaudden
05305f462b Bug #26571 Different format specifiers in errmsg.txt
- Add check of format specifiers in error message strings
- Update error message text accordingly to be equal between all translations
2007-02-22 16:41:51 +01:00
monty@mysql.com/narttu.mysql.fi
e5cc397f33 Fixed compiler warnings (for linux and win32 and win64)
Fixed a couple of usage of not initialized warnings (unlikely cases)
2007-02-22 16:59:57 +02:00
msvensson@pilot.mysql.com
13f25e80c3 Merge pilot.mysql.com:/home/msvensson/mysql/comp_err_checksum/my50-comp_err_checksum
into  pilot.mysql.com:/home/msvensson/mysql/comp_err_checksum/my51-comp_err_checksum
2007-02-14 19:34:22 +01:00
msvensson@pilot.mysql.com
67cc343c34 Add check of format specifiers in error message strings
Update error message text accordingly to be equal between all translations
2007-02-14 19:31:06 +01:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
georg@lmy002.wdf.sap.corp
5686da41ac Fixes for crashes and test failures 2006-09-01 14:34:37 +02:00
knielsen@mysql.com
9c84881310 Define USE_TLS when compiling libmysql.dll, to avoid crashing when
loaded at runtime.
2006-03-22 09:55:26 +01:00
brian@zim.tangent.org
570bffe8c7 Rename of my_strdup_with_lenght to match the more common "strndup" method. Soo its now my_strndup().
my_stat() gettinng the correct parameter list may be next :)
2006-01-25 19:54:42 -08:00
joerg@mysql.com
5da306b57e extra/comp_err.c : Fix a merge error. 2006-01-16 17:23:39 +01:00
joerg@mysql.com
fa91e05bf5 Manual merge of the fix for bug#16106.
Currently failing tests (for me) in non-debug build:
blackhole fulltext fulltext_cache fulltext_left_join fulltext_multi
2006-01-16 16:48:05 +01:00
joerg@mysql.com
1155bf20d9 Merge mysql.com:/M40/push-4.0 into mysql.com:/M41/merge-4.1 2006-01-13 17:45:01 +01:00
joerg@mysql.com
9d4562e5fe extra/comp_err.c + scripts/mysqld_multi.sh :
Copyright string fixes (bug#16106)
2006-01-13 16:25:20 +01:00
jimw@mysql.com
6b476cf5cd Fail when two messages exist for the same language for an error in the
server error messages file. (Bug #13071)
2005-10-05 10:06:31 -07:00
paul@snake-hub.snake.net
7331526a62 comp_err.c:
Fix some comments.
2005-09-10 12:31:57 -05:00
monty@mysql.com
0a6b7aedb2 Remove compiler warnings and remove not used variables
(Found during build process)
2005-02-25 16:53:22 +02:00
georg@beethoven.site
3b2bf2f512 Fixes for windows compilation bugs
(After review of cs georg:1.1800 by Monty)
2005-01-26 15:19:20 +01:00
ram@gw.mysql.r18.ru
92545cb3a9 ER_WARN_DATA_TRUNCATED replaced with WARN_DATA_TRUNCATED. 2005-01-19 16:24:06 +04:00
anjuta@arthur.local
224fcd4717 Merge 2005-01-13 19:14:10 +02:00
anjuta@arthur.local
f23cdbcd4a Bug in InnoDB;
file closing in extra/comp_err.c
2005-01-13 19:03:46 +02:00
anjuta@arthur.local
e52dce98da Added creation of mysqld_ername.h 2005-01-04 15:49:51 +02:00
ingo@mysql.com
c39be2d0e7 WL#1895 - Print message to error log in case of detected MyISAM corruption
Changed my_error() to print error messages, which come from
arbitrary registered ranges of error messages. Messages can
be unregistered (and should be at end of the program).
Added registration of handler error messages.
Added a new mi_print_error() macro and a new 
mi_report_error() function, which supply error
messages with a table name.
Added calls to mi_print_error() or mi_report_error()
at all places in MyISAM, where table corruption is detected.
2004-12-23 20:11:38 +01:00
pem@mysql.comhem.se
6461d209a5 Fixed compile error in extra/comp_err.c with -debug for some compilers. 2004-12-14 17:02:24 +01:00
anjuta@arthur.local
a045161e5b Added pathes to mysqld_error.h and sql_state.h; fixed segfault bug; 2004-12-14 01:54:16 +02:00
anjuta@arthur.local
f9451974be WL#1051, more maintanable error messages. 2004-12-13 22:51:54 +02:00
monty@narttu.mysql.fi
6056cfadfc Merge with 4.0.16 2003-10-07 15:42:26 +03:00
monty@narttu.mysql.fi
5f164e2f70 Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
2003-09-23 13:36:25 +03:00
monty@narttu.mysql.fi
f05a1c8394 Block SIGPIPE also for not threaded client programs.
Added --include and --libs_r options to mysql_config.
Added mysql_get_client_version() to client library
Fixed some minor benchmark issues
2003-09-23 13:36:01 +03:00
bar@bar.mysql.r18.ru
99e2a82168 Bug 1350 fix 2003-09-22 11:11:36 +05:00
lenz@mysql.com
40cabaa773 - fixed several typos ("uppdate"->"update" and "tryed"->"tried") 2003-09-19 18:34:57 +02:00