Commit db40af2a authored by monty@mysql.com's avatar monty@mysql.com

Fix warnings from icc

Added BUILD scripts for icc
Fixed (one time) memory leak in grant handling
parent ca5b291b
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Note that we can't use ccache with icc as the generated .deps file will
# then contain wrong information
CC=icc
CXX=icpc
CXXLD="$CXX -static-libcxa"
export CC CXX
extra_flags="$pentium_cflags $debug_cflags $max_cflags -USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max"
# Disable following warnings as these are generated by header files:
# 161 unrecognized pragma
# 444 destructor for base class xxx is not virtual
# 279 controlling expression is constant
# 810 conversion from ulonglong to ulong with cast
# 981 operands are evaluated in unspecified order
# 1292 warning for unknown 'attribute' options
# 1469 "xxx" clobber ignored
# 1572 floating-point equality and inequality comparisons are unreliable
# In C++
# 869 parameter "xxx" was never referenced
# (Problem with virtual functions)
# 874 support for placement delete is disabled
c_warnings=""
cxx_warnings=""
extra_flags="-O3 -unroll2 -ip -mp -no-gcc -restrict"
base_cxxflags="-fno-exceptions -fno-rtti"
extra_configs="$pentium_configs $static_link"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Note that we can't use ccache with icc as the generated .deps file will
# then contain wrong information
CC=icc
CXX=icpc
export CC CXX
extra_flags="$pentium_cflags $debug_cflags $max_cflags -USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max"
# Disable following warnings as these are generated by header files:
# 161 unrecognized pragma
# 444 destructor for base class xxx is not virtual
# 279 controlling expression is constant
# 810 conversion from ulonglong to ulong with cast
# 981 operands are evaluated in unspecified order
# 1292 warning for unknown 'attribute' options
# 1469 "xxx" clobber ignored
# 1572 floating-point equality and inequality comparisons are unreliable
# In C++
# 869 parameter "xxx" was never referenced
# (Problem with virtual functions)
# 874 support for placement delete is disabled
c_warnings="-Wall -Wcheck -wd161,444,279,810,981,1292,1469,1572"
cxx_warnings="$c_warnings -wd869,874"
base_cxxflags="-fno-exceptions -fno-rtti"
extra_configs="$pentium_configs $debug_configs"
. "$path/FINISH.sh"
......@@ -38,7 +38,7 @@ AC_LANG_PUSH(C++)
if test "$ac_cv_prog_gxx" = "yes"
then
# Add -Werror, remove -fbranch-probabilities (Bug #268)
CXXFLAGS=`echo $CXXFLAGS -Werror | sed 's/-fbranch-probabilities//'`
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
fi
mysql_cv_btype_last_arg_accept=none
[AC_TRY_COMPILE([#if defined(inline)
......@@ -98,7 +98,7 @@ AC_LANG_PUSH(C++)
if test "$ac_cv_prog_gxx" = "yes"
then
# Add -Werror, remove -fbranch-probabilities (Bug #268)
CXXFLAGS=`echo $CXXFLAGS -Werror | sed 's/-fbranch-probabilities//'`
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
fi
mysql_cv_btype_struct_rlimit=none
[AC_TRY_COMPILE([#if defined(inline)
......
......@@ -1965,9 +1965,12 @@ AC_LANG_CPLUSPLUS
# with respect to ANSI C++
# We also remove the -fbranch-probabilities option as this will give warnings
# about not profiled code, which confuses configure
# We also must remove -W and -Wcheck which on icc produces warnings that
# we don't want to catch with -Werror
if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
then
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'`
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
fi
AC_TRY_COMPILE(
......@@ -2002,7 +2005,7 @@ AC_LANG_SAVE
AC_LANG_CPLUSPLUS
if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
then
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'`
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
fi
AC_TRY_COMPILE(
[#undef inline
......@@ -2035,7 +2038,7 @@ AC_LANG_SAVE
AC_LANG_CPLUSPLUS
if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
then
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'`
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
fi
AC_TRY_COMPILE(
[#undef inline
......
......@@ -63,7 +63,7 @@ typedef struct st_pointer_array { /* when using array-strings */
#define LAST_CHAR_CODE 259
typedef struct st_replace {
bool found;
my_bool found;
struct st_replace *next[256];
} REPLACE;
......@@ -80,19 +80,18 @@ typedef struct st_replace_found {
/* functions defined in this file */
extern int main(int argc,char * *argv);
static int static_get_options(int *argc,char * * *argv);
static int get_replace_strings(int *argc,char * * *argv,
POINTER_ARRAY *from_array,
POINTER_ARRAY *to_array);
int insert_pointer_name(POINTER_ARRAY *pa, my_string name);
void free_pointer_array(POINTER_ARRAY *pa);
static int insert_pointer_name(POINTER_ARRAY *pa, my_string name);
static void free_pointer_array(POINTER_ARRAY *pa);
static int convert_pipe(REPLACE *,FILE *,FILE *);
static int convert_file(REPLACE *, my_string);
REPLACE *init_replace(my_string *from, my_string *to,uint count, my_string
word_end_chars);
uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
my_string from);
static REPLACE *init_replace(my_string *from, my_string *to,uint count,
my_string word_end_chars);
static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
my_string from);
static int initialize_buffer(void);
static void reset_buffer(void);
static void free_buffer(void);
......@@ -101,9 +100,7 @@ static int silent=0,verbose=0,updated=0;
/* The main program */
int main(argc,argv)
int argc;
char *argv[];
int main(int argc, char *argv[])
{
int i,error;
char word_end_chars[256],*pos;
......@@ -118,7 +115,7 @@ char *argv[];
for (i=1,pos=word_end_chars ; i < 256 ; i++)
if (my_isspace(&my_charset_latin1,i))
*pos++=i;
*pos++= (char) i;
*pos=0;
if (!(replace=init_replace((char**) from.typelib.type_names,
(char**) to.typelib.type_names,
......@@ -153,7 +150,7 @@ static int static_get_options(argc,argv)
register int *argc;
register char **argv[];
{
int help,version,opt;
int help,version;
char *pos;
silent=verbose=help=0;
......@@ -162,7 +159,7 @@ register char **argv[];
while (*++pos)
{
version=0;
switch((opt= *pos)) {
switch((*pos)) {
case 's':
silent=1;
break;
......@@ -249,7 +246,7 @@ POINTER_ARRAY *from_array,*to_array;
return 0;
}
int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
{
uint i,length,old_count;
byte *new_pos;
......@@ -323,8 +320,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name)
/* free pointer array */
void free_pointer_array(pa)
reg1 POINTER_ARRAY *pa;
static void free_pointer_array(reg1 POINTER_ARRAY *pa)
{
if (pa->typelib.count)
{
......@@ -382,9 +378,9 @@ static void or_bits(REP_SET *to,REP_SET *from);
static void copy_bits(REP_SET *to,REP_SET *from);
static int cmp_bits(REP_SET *set1,REP_SET *set2);
static int get_next_bit(REP_SET *set,uint lastpos);
static int find_set(REP_SETS *sets,REP_SET *find);
static int find_found(FOUND_SET *found_set,uint table_offset,
int found_offset);
static short find_set(REP_SETS *sets,REP_SET *find);
static short find_found(FOUND_SET *found_set,uint table_offset,
int found_offset);
static uint start_at_word(my_string pos);
static uint end_of_word(my_string pos);
static uint replace_len(my_string pos);
......@@ -394,11 +390,12 @@ static uint found_sets=0;
/* Init a replace structure for further calls */
REPLACE *init_replace(my_string *from, my_string *to,uint count,
my_string word_end_chars)
static REPLACE *init_replace(my_string *from, my_string *to,uint count,
my_string word_end_chars)
{
uint i,j,states,set_nr,len,result_len,max_length,found_end,bits_set,bit_nr;
int used_sets,chr,default_state;
int used_sets,chr;
short default_state;
char used_chars[LAST_CHAR_CODE],is_word_end[256];
my_string pos,to_pos,*to_array;
REP_SETS sets;
......@@ -561,7 +558,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
for (chr= 0 ; chr < 256 ; chr++)
{
if (! used_chars[chr])
set->next[chr]= chr ? default_state : -1;
set->next[chr]= (short) (chr ? default_state : -1);
else
{
new_set=make_new_set(&sets);
......@@ -652,7 +649,7 @@ REPLACE *init_replace(my_string *from, my_string *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
rep_str[i].found= !bcmp(pos,"\\^",3) ? 2 : 1;
rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1);
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
......@@ -812,7 +809,7 @@ static int get_next_bit(REP_SET *set,uint lastpos)
free given set, else put in given set in sets and return it's
position */
static int find_set(REP_SETS *sets,REP_SET *find)
static short find_set(REP_SETS *sets,REP_SET *find)
{
uint i;
for (i=0 ; i < sets->count-1 ; i++)
......@@ -820,30 +817,33 @@ static int find_set(REP_SETS *sets,REP_SET *find)
if (!cmp_bits(sets->set+i,find))
{
free_last_set(sets);
return i;
return (short) i;
}
}
return i; /* return new postion */
return (short) i; /* return new postion */
}
/* find if there is a found_set with same table_offset & found_offset
If there is return offset to it, else add new offset and return pos.
Pos returned is -offset-2 in found_set_structure because it's is
saved in set->next and set->next[] >= 0 points to next set and
set->next[] == -1 is reserved for end without replaces.
*/
static int find_found(FOUND_SET *found_set,uint table_offset, int found_offset)
/*
find if there is a found_set with same table_offset & found_offset
If there is return offset to it, else add new offset and return pos.
Pos returned is -offset-2 in found_set_structure because it's is
saved in set->next and set->next[] >= 0 points to next set and
set->next[] == -1 is reserved for end without replaces.
*/
static short find_found(FOUND_SET *found_set,uint table_offset,
int found_offset)
{
int i;
for (i=0 ; (uint) i < found_sets ; i++)
if (found_set[i].table_offset == table_offset &&
found_set[i].found_offset == found_offset)
return -i-2;
return (short) (-i-2);
found_set[i].table_offset=table_offset;
found_set[i].found_offset=found_offset;
found_sets++;
return -i-2; /* return new postion */
return (short) (-i-2); /* return new postion */
}
/* Return 1 if regexp starts with \b or ends with \b*/
......@@ -878,7 +878,8 @@ static uint replace_len(my_string str)
/* The actual loop */
uint replace_strings(REPLACE *rep, my_string *start,uint *max_length, my_string from)
static uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
my_string from)
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
......
......@@ -39,9 +39,9 @@ extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length);
extern void _db_output_();
extern void _db_lock_file();
extern void _db_unlock_file();
extern void _db_output_(void);
extern void _db_lock_file(void);
extern void _db_unlock_file(void);
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
char **_db_framep_; \
......
......@@ -300,7 +300,7 @@ void print_hash_map(const char *name)
char *cur;
int i;
printf("uchar %s[%d]= {\n",name,size_hash_map);
printf("static uchar %s[%d]= {\n",name,size_hash_map);
for (i=0, cur= hash_map; i<size_hash_map; i++, cur++)
{
switch(i%4){
......@@ -459,11 +459,11 @@ int main(int argc,char **argv)
generate_find_structs();
print_find_structs();
printf("\nunsigned int sql_functions_max_len=%d;\n",max_len);
printf("\nunsigned int symbols_max_len=%d;\n\n",max_len2);
printf("\static unsigned int sql_functions_max_len=%d;\n",max_len);
printf("\static unsigned int symbols_max_len=%d;\n\n",max_len2);
printf("\
inline SYMBOL *get_hash_symbol(const char *s,\n \
static inline SYMBOL *get_hash_symbol(const char *s,\n\
unsigned int len,bool function)\n\
{\n\
register uchar *hash_map;\n\
......
......@@ -1113,7 +1113,8 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
LOCK_global_system_variables, LOCK_user_conn;
LOCK_global_system_variables, LOCK_user_conn,
LOCK_bytes_sent, LOCK_bytes_received;
extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
extern pthread_attr_t connection_attrib;
......
This diff is collapsed.
......@@ -173,6 +173,9 @@ public:
static void operator delete(void *ptr, void *buffer)
{}
static void operator delete(void *buffer)
{}
static String bad_geometry_data;
enum wkbType
......
......@@ -3115,6 +3115,7 @@ void grant_free(void)
grant_option = FALSE;
hash_free(&column_priv_hash);
hash_free(&proc_priv_hash);
hash_free(&func_priv_hash);
free_root(&memex,MYF(0));
DBUG_VOID_RETURN;
}
......
......@@ -50,7 +50,8 @@ pthread_key(LEX*,THR_LEX);
used when comparing keywords
*/
uchar to_upper_lex[] = {
static uchar to_upper_lex[]=
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
......@@ -1530,8 +1531,8 @@ void st_select_lex::print_order(String *str, ORDER *order)
if (order->counter_used)
{
char buffer[20];
my_snprintf(buffer, 20, "%u", order->counter);
str->append(buffer);
uint length= my_snprintf(buffer, 20, "%d", order->counter);
str->append(buffer, length);
}
else
(*order->item)->print(str);
......
......@@ -898,10 +898,11 @@ struct st_lex_local: public st_lex
{ /* Never called */ }
};
void lex_init(void);
void lex_free(void);
void lex_start(THD *thd, uchar *buf,uint length);
void lex_end(LEX *lex);
extern void lex_init(void);
extern void lex_free(void);
extern void lex_start(THD *thd, uchar *buf,uint length);
extern void lex_end(LEX *lex);
extern int yylex(void *arg, void *yythd);
extern pthread_key(LEX*,THR_LEX);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment