diff options
author | Michael Widenius <monty@askmonty.org> | 2009-11-30 01:08:56 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2009-11-30 01:08:56 +0200 |
commit | d13c54351dd7ec5c538ff746704c6a8096b25776 (patch) | |
tree | 29515d03576ab3021ec5a7e5e353d68f782ffd91 /sql | |
parent | d210df50a21d82a1f20c6bc786149478801e91c6 (diff) | |
download | mariadb-git-d13c54351dd7ec5c538ff746704c6a8096b25776.tar.gz |
Remove compiler warnings (Including some warnings from -Wstrict-aliasing)
Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available
Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t.
One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h
This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default
BUILD/compile-pentium:
Don't use static link by default as some new systems doesn't have all static libraries available
client/mysql_upgrade.c:
Remove not used variable
cmd-line-utils/readline/config_readline.h:
Define some constants to get rid of compiler warnings on Linux
cmd-line-utils/readline/display.c:
Get rid of compiler warnings
cmd-line-utils/readline/history.c:
Got rid of compiler warnings:
- Defining some strings as const
- Added cast
cmd-line-utils/readline/rlmbutil.h:
Added cast to get rid of compiler warnings
cmd-line-utils/readline/text.c:
Remove not needed initialization to get rid of compiler warnings
cmd-line-utils/readline/xmalloc.c:
Changed types to 'const char* to get rid of compiler warnings
configure.in:
Ensure that we use MariaDB as suffix
include/mysql/plugin.h:
Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code)
Change length for not \0 terminated string to size_t
include/mysql/plugin.h.pp:
Update related to plugin.h
libmysql/libmysql.c:
Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off
mysql-test/t/information_schema.test:
Test is depending on innodb
mysql-test/t/not_partition.test:
Fixed wrong directory name
(Not noticed before as we don't ususally run this test)
mysys/lf_hash.c:
Got rid of compiler warnings from -Wstrict-aliasing
mysys/my_redel.c:
Removed not used variable
regex/engine.c:
Changed types to 'const char* to get rid of compiler warnings
regex/engine.ih:
Changed types to 'const char* to get rid of compiler warnings
sql/sp_head.cc:
Got rid of compiler warning from -Wstrict-aliasing
sql/sql_base.cc:
Got rid of compiler warnings from -Wstrict-aliasing
(The original code was probably wrong as nj_col->table_field was
sql/sql_builtin.cc.in:
plugin.h needs to have size_t defined
sql/sql_parse.cc:
Remove used variable
sql/sql_select.cc:
Got rid of compiler warnings from -Wstrict-aliasing
sql/sql_show.cc:
Added #ifdef to get rid of compiler warning when not using partition engine
sql/table.cc:
Got rid of compiler warning from -Wstrict-aliasing
storage/maria/ha_maria.cc:
Got rid of compiler warnings from -Wstrict-aliasing:
- Use the thd_killed() API function
storage/maria/lockman.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/ma_check.c:
Got rid of compiler warnings from -Wstrict-aliasing
Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_check_standalone.h:
Update to compatible _ma_killed_ptr() from ha_maria.cc
storage/maria/ma_ft_boolean_search.c:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ft_nlq_search.c:
Got rid of compiler warnings from -Wstrict-aliasing
Ensure that 'subkeys' is 32 bit
storage/maria/ma_ft_parser.c:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ftdefs.h:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_sort.c:
Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_state.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/maria_def.h:
Redefine ma_killed_ptr()
storage/maria/maria_ftdump.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/trnman.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_boolean_search.c:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_nlq_search.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_parser.c:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_stopwords.c:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ftdefs.h:
Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ha_myisam.cc:
Got rid of compiler warnings from -Wstrict-aliasing:
- Use the thd_killed() API function
storage/myisam/mi_check.c:
Use new killed_ptr() function
storage/myisam/myisam_ftdump.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/myisamchk.c:
Update to compatible killed_ptr() from ha_myisam.cc
storage/myisam/myisamdef.h:
Redefine killed_ptr()
storage/myisam/myisamlog.c:
Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/sort.c:
Change to use new version of killed_ptr; Don't call it as often as before
storage/xtradb/fil/fil0fil.c:
Fixedc ompiler warning
storage/xtradb/trx/trx0i_s.c:
Include mysql_plugin.h later to ensure that size_t is defined
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sp_head.cc | 3 | ||||
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_builtin.cc.in | 1 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 9 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/table.cc | 3 |
7 files changed, 18 insertions, 6 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index e7310787a35..ead4a1bfe58 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1924,9 +1924,10 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) if (spvar->mode == sp_param_out) { Item_null *null_item= new Item_null(); + Item *tmp_item= (Item*) null_item; if (!null_item || - nctx->set_variable(thd, i, (Item **)&null_item)) + nctx->set_variable(thd, i, &tmp_item)) { err_status= TRUE; break; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9fd47a655e0..0594dcf31c0 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -5823,6 +5823,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name, { /* This is a base table. */ DBUG_ASSERT(nj_col->view_field == NULL); + Item *ref= 0; /* This fix_fields is not necessary (initially this item is fixed by the Item_field constructor; after reopen_tables the Item_func_eq @@ -5830,12 +5831,13 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name, reopening for columns that was dropped by the concurrent connection. */ if (!nj_col->table_field->fixed && - nj_col->table_field->fix_fields(thd, (Item **)&nj_col->table_field)) + nj_col->table_field->fix_fields(thd, &ref)) { DBUG_PRINT("info", ("column '%s' was dropped by the concurrent connection", nj_col->table_field->name)); DBUG_RETURN(NULL); } + DBUG_ASSERT(ref == 0); // Should not have changed DBUG_ASSERT(nj_col->table_ref->table == nj_col->table_field->field->table); found_field= nj_col->table_field->field; update_field_dependencies(thd, found_field, nj_col->table_ref->table); diff --git a/sql/sql_builtin.cc.in b/sql/sql_builtin.cc.in index 3becdbaccfe..7ecd4918d7b 100644 --- a/sql/sql_builtin.cc.in +++ b/sql/sql_builtin.cc.in @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <my_global.h> #include <mysql/plugin.h> typedef struct st_mysql_plugin builtin_plugin[]; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index df8d131df59..a0a14e3af19 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -464,7 +464,7 @@ pthread_handler_t handle_bootstrap(void *arg) thd->init_for_queries(); while (fgets(buff, thd->net.max_packet, file)) { - char *query, *res; + char *query; /* strlen() can't be deleted because fgets() doesn't return length */ ulong length= (ulong) strlen(buff); while (buff[length-1] != '\n' && !feof(file)) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 47af428ed56..b44accd1123 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3586,8 +3586,9 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, { if (!field->eq(item->field)) { + Item *tmp_item= (Item*) item; add_key_field(key_fields, *and_level, cond_func, field, - TRUE, (Item **) &item, 1, usable_tables, + TRUE, &tmp_item, 1, usable_tables, sargables); } } @@ -15748,7 +15749,11 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab) DBUG_RETURN(TRUE); if (!cond->fixed) - cond->fix_fields(thd, (Item**)&cond); + { + Item *tmp_item= (Item*) cond; + cond->fix_fields(thd, &tmp_item); + DBUG_ASSERT(cond == tmp_item); + } if (join_tab->select) { error=(int) cond->add(join_tab->select->cond); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 918227122ed..a1ee50f426f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3551,7 +3551,9 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, TABLE_SHARE *share= show_table->s; handler *file= show_table->file; handlerton *tmp_db_type= share->db_type(); +#ifdef WITH_PARTITION_STORAGE_ENGINE bool is_partitioned= FALSE; +#endif if (share->tmp_table == SYSTEM_TMP_TABLE) table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs); else if (share->tmp_table) diff --git a/sql/table.cc b/sql/table.cc index 2c45dc800f5..fa1f215d7b5 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2077,8 +2077,9 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names) else { char *str; + const char **tmp = (const char**) (char*) buf; str=(char *) (buf+a_length); - fix_type_pointers((const char ***) &buf,save_names,1,&str); + fix_type_pointers(&tmp, save_names, 1, &str); } DBUG_RETURN(ret_value); } |