fixed some compiling warning

This commit is contained in:
zsx 2018-08-08 11:45:37 +08:00
parent 76b6bd1086
commit e8fad9062a
10 changed files with 49 additions and 30 deletions

View File

@ -12,4 +12,15 @@ struct user
double n2;
double n3;
double n4;
user(void)
{
age = 0;
male = false;
n0 = 0;
n1 = 2;
n2 = 0;
n3 = 0;
n4 = 0;
}
};

View File

@ -2,4 +2,5 @@ include ../Makefile.in
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
EXTLIBS += -L/usr/local/lib -liconv
endif
CFLAGS += -std=c++11
PROG = test

View File

@ -2,4 +2,5 @@ include ../Makefile.in
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
EXTLIBS += -L/usr/local/lib -liconv
endif
CFLAGS += -std=c++11
PROG = test

View File

@ -2,4 +2,5 @@ include ../Makefile.in
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
EXTLIBS += -L/usr/local/lib -liconv
endif
CFLAGS += -std=c++11
PROG = test

View File

@ -33,6 +33,7 @@ CFLAGS = -c -g -W \
-Winvalid-pch \
-DACL_PREPARE_COMPILE \
-DUSE_REUSEPORT \
#-Wno-implicit-fallthrough \
#-fstack-protector-all \
#-DDEBUG_MEM
#-DUSE_EPOLL \

View File

@ -684,6 +684,7 @@ bool db_mysql::sane_mysql_query(const char* sql)
logger_error("open mysql error, db=%s", dbname_);
return false;
}
if (__mysql_query(conn_, sql) == 0)
return true;
@ -712,12 +713,6 @@ bool db_mysql::sane_mysql_query(const char* sql)
bool db_mysql::tbl_exists(const char* tbl_name)
{
if (conn_ == NULL)
{
logger_error("db(%s) not opened yet", dbname_);
return false;
}
char sql[256];
safe_snprintf(sql, sizeof(sql), "show tables like '%s'", tbl_name);

View File

@ -1367,48 +1367,57 @@ void gsoner::parse_code()
break;
char ch = codes_[pos_];
switch(ch)
if (ch == ';')
{
case ';':
pos_++;
continue;
case '/':
if(check_comment())
}
if (ch == '/')
{
if (check_comment())
continue;
case '}':
}
if (ch == '}')
{
if(check_struct_end())
continue;
if(check_namespace_end())
continue;
case 'n':
}
if (ch == 'n')
{
if(check_namespace())
continue;
case '#':
}
if (ch == '#')
{
if(check_include())
continue;
if(check_define())
continue;
if(check_pragma())
continue;
case 's':
}
if (ch == 's')
{
if(check_struct_begin())
continue;
case 'u':
}
if (ch == 'u')
{
if (check_use_namespace())
continue;
default:
if(check_function())
continue;
if(check_member())
{
required_ = default_;
continue;
}
printf("%c", codes_[pos_]);
pos_++;
}
if(check_function())
continue;
if(check_member())
{
required_ = default_;
continue;
}
printf("%c", codes_[pos_]);
pos_++;
} while (pos_ < max_pos_);
}
catch (syntax_error &e)

View File

@ -220,7 +220,7 @@ DNS_PRAGMA_PUSH
#endif
#endif
#if HAVE_STATIC_ASSERT
#ifdef HAVE_STATIC_ASSERT
#define dns_static_assert(cond, msg) static_assert(cond, msg)
#elif HAVE__STATIC_ASSERT
#define dns_static_assert(cond, msg) _Static_assert(cond, msg)

View File

@ -111,7 +111,7 @@ static struct pollfd *pfds_create(int *nfds, fd_set *readfds,
}
#else
static struct pollfd *pfds_create(int *nfds, fd_set *readfds,
fd_set *writefds, fd_set *exceptfds)
fd_set *writefds, fd_set *exceptfds fiber_unused)
{
int fd;
struct pollfd *fds;

View File

@ -45,10 +45,10 @@
#include <sys/resource.h>
#include <ucontext.h>
#if defined(__APPLE__)
//#if defined(__APPLE__)
# include <sys/types.h>
# include <sys/uio.h>
#endif
//#endif
#define STRDUP strdup
#define GETPID getpid