Skip to content

Commit

Permalink
Fixed compiler warnings from gcc 7.4.1
Browse files Browse the repository at this point in the history
- Fixed possible error in rocksdb/rdb_datadic.cc
  • Loading branch information
montywi committed Jan 29, 2020
1 parent cd2c0e0 commit 4d61f12
Show file tree
Hide file tree
Showing 47 changed files with 282 additions and 197 deletions.
6 changes: 4 additions & 2 deletions plugin/auth_pam/auth_pam_tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <mysql/plugin_auth_common.h>

struct param {
Expand Down Expand Up @@ -62,15 +63,16 @@ typedef struct st_mysql_server_auth_info
#include "auth_pam_base.c"


int main(int argc, char **argv)
int main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
{
struct param param;
MYSQL_SERVER_AUTH_INFO info;
unsigned char field;
int res;
char a_buf[MYSQL_USERNAME_LENGTH + 1 + 1024];

(void) setreuid(0, 0);
if ((res= setreuid(0, 0)))
fprintf(stderr, "Got error %d from setreuid()\n", (int) errno);

if (read(0, &field, 1) < 1)
return -1;
Expand Down
8 changes: 5 additions & 3 deletions plugin/auth_pam/testing/pam_mariadb_mtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define N 3

int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int pam_sm_authenticate(pam_handle_t *pamh, int flags __attribute__((unused)),
int argc, const char *argv[])
{
struct pam_conv *conv;
Expand Down Expand Up @@ -72,8 +72,10 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
return retval;
}

int pam_sm_setcred(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
int pam_sm_setcred(pam_handle_t *pamh __attribute__((unused)),
int flags __attribute__((unused)),
int argc __attribute__((unused)),
const char *argv[] __attribute__((unused)))
{

return PAM_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6115,7 +6115,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
/* As all updated tables are temporary, nothing will be logged */
set_current_stmt_binlog_format_row();
}
else if (IF_WSREP((!WSREP(this) ||
else if (IF_WSREP((!WSREP_NNULL(this) ||
wsrep_cs().mode() ==
wsrep::client_state::m_local),1))
{
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/colblk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)
htrc(" copying COLBLK %s from %p to %p\n", Name, col1, this);

if (tdbp)
{
// Attach the new column to the table block
if (!tdbp->GetColumns())
tdbp->SetColumns(this);
Expand All @@ -88,7 +89,7 @@ COLBLK::COLBLK(PCOL col1, PTDB tdbp)

colp->Next = this;
} // endelse

}
} // end of COLBLK copy constructor

/***********************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions storage/connect/connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,15 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
// return 0;

if (tdbp->GetKindex())
{
if (((XXBASE*)tdbp->GetKindex())->GetID() == id) {
tdbp->GetKindex()->Reset(); // Same index
return (tdbp->GetKindex()->IsMul()) ? 2 : 1;
} else {
tdbp->GetKindex()->Close();
tdbp->SetKindex(NULL);
} // endif colp
}

for (xdp= dfp->GetIndx(); xdp; xdp= xdp->GetNext())
if (xdp->GetID() == id)
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/filamap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
if ((rc = GetNext(g)) != RC_OK)
return rc;

case RC_NF:
/* falls through */
case RC_NF:
// Skip this record
if ((rc = SkipRecord(g, false)) != RC_OK)
return rc;
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/filamdbf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc)
if (irc == RC_OK) {
// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
{
if (UseTemp) {
if (OpenTempFile(g))
return RC_FX;
Expand All @@ -850,7 +851,7 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc)

} else
T_Stream = Stream;

}
*Tdbp->GetLine() = '*';
Modif++; // Modified line in Delete mode
} // endif irc
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/filamfix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g)
// The buffer must be prepared depending on column types
int n = 0;
bool b = false;
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
PDOSDEF defp __attribute__((unused))= (PDOSDEF)Tdbp->GetDef();
// PCOLDEF cdp;
PBINCOL colp;

Expand Down
7 changes: 4 additions & 3 deletions storage/connect/filamgz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g)
int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
{
if (irc == RC_EF) {
LPCSTR name = Tdbp->GetName();
LPCSTR name __attribute__((unused)) = Tdbp->GetName();
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();

defp->SetBlock(0);
Expand All @@ -673,7 +673,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
int rc = RC_OK;

if (Tdbp->GetMode() == MODE_INSERT) {
LPCSTR name = Tdbp->GetName();
LPCSTR name __attribute__((unused))= Tdbp->GetName();
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();

if (CurNum && !Closing) {
Expand Down Expand Up @@ -1021,6 +1021,7 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g)
#else
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
#endif
/* falls through */
case RC_NF:
return TRUE;
} // endswitch
Expand Down Expand Up @@ -1355,7 +1356,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool)
int rc = RC_OK;

if (Tdbp->GetMode() == MODE_INSERT) {
LPCSTR name = Tdbp->GetName();
LPCSTR name __attribute__((unused))= Tdbp->GetName();
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();

// Closing is True if last Write was in error
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/filamtxt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1547,13 +1547,14 @@ int BLKFAM::WriteBuffer(PGLOBAL g)

// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
{
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
if (OpenTempFile(g))
return RC_FX;

} else
T_Stream = Stream;

}
if (UseTemp) {
/*****************************************************************/
/* We are using a temporary file. Before writing the updated */
Expand Down
5 changes: 3 additions & 2 deletions storage/connect/filamvct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
return 1;

if (Block < 0)
{
if (Split) {
// Separate column files and no pre setting of Block and Last
// This allows to see a table modified externally, but Block
Expand Down Expand Up @@ -347,7 +348,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
return -1; // Error

} // endif split

}
return (Block) ? ((Block - 1) * Nrec + Last) : 0;
} // end of Cardinality

Expand Down Expand Up @@ -1163,7 +1164,7 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last)
if (!Header) {
// Update catalog values for Block and Last
PVCTDEF defp = (PVCTDEF)Tdbp->GetDef();
LPCSTR name = Tdbp->GetName();
LPCSTR name __attribute__((unused))= Tdbp->GetName();

defp->SetBlock(Block);
defp->SetLast(Last);
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/filamzip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf)
static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
{
char filename[_MAX_PATH];
int rc;

/*********************************************************************/
/* pat is a multiple file name with wildcard characters */
Expand All @@ -102,6 +101,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
char drive[_MAX_DRIVE], direc[_MAX_DIR];
WIN32_FIND_DATA FileData;
HANDLE hSearch;
int rc;

_splitpath(filename, drive, direc, NULL, NULL);

Expand Down
6 changes: 5 additions & 1 deletion storage/connect/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,15 +1220,19 @@ bool FILTER::Eval(PGLOBAL g)
int i; // n = 0;
//PSUBQ subp = NULL;
PARRAY ap = NULL;
PDBUSER dup = PlgGetUser(g);
PDBUSER dup __attribute__((unused)) = PlgGetUser(g);

if (Opc <= OP_XX)
{
for (i = 0; i < 2; i++)
{
// Evaluate the object and eventually convert it.
if (Arg(i)->Eval(g))
return TRUE;
else if (Test[i].Conv)
Val(i)->SetValue_pval(Arg(i)->GetValue());
}
}

if (trace(1))
htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n",
Expand Down
14 changes: 9 additions & 5 deletions storage/connect/fmdlex.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,11 @@ YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));

#ifdef NOT_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
static void yy_push_state YY_PROTO(( int new_state ));
static void yy_pop_state YY_PROTO(( void ));
static int yy_top_state YY_PROTO(( void ));
#endif

static void *yy_flex_alloc YY_PROTO(( unsigned int ));
static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
Expand All @@ -267,11 +266,13 @@ extern char *yytext;
static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
#endif

#ifdef NOT_USED
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif

static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
Expand Down Expand Up @@ -1060,6 +1061,8 @@ register char *yy_bp;
}


#ifdef NOT_USED

#ifdef __cplusplus
static int yyinput()
#else
Expand Down Expand Up @@ -1126,7 +1129,7 @@ static int input()

return c;
}

#endif /* NOT_USED */

#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
Expand Down Expand Up @@ -1266,6 +1269,7 @@ FILE *file;
}


#ifdef NOT_USED
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
Expand Down Expand Up @@ -1297,7 +1301,6 @@ int new_state;
BEGIN(new_state);
}


static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
Expand All @@ -1311,6 +1314,7 @@ static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
#endif /* NOT_USED */


#ifdef YY_USE_PROTOS
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ static int connect_init_func(void *p)
@brief
Plugin clean up
*/
static int connect_done_func(void *)
int connect_done_func(void *)
{
int error= 0;
PCONNECT pc, pn;
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/inihandl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,7 @@ BOOL WritePrivateProfileSection(LPCSTR section,
* Note that when the buffer is big enough then the return value may be any
* value between 1 and len-1 (or len in Win95), including len-2.
*/
#ifdef NOT_USED
static DWORD
GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
{
Expand All @@ -1356,7 +1357,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
LeaveCriticalSection(&PROFILE_CritSect);
return ret;
} // end of GetPrivateProfileSectionNames

#endif

/************************************************************************
* Program to test the above
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
b = false;
break;
} // endif b

/* falls through */
default:
if (jsp)
goto tryit;
Expand Down
Loading

0 comments on commit 4d61f12

Please sign in to comment.