mdbx: -Wextra and fixes.

Change-Id: I9f373e66f8f5f7cf3b29b5246eb2c67e4a49a460
This commit is contained in:
Leo Yuriev 2016-04-15 22:11:40 +03:00
parent 9871e24670
commit 3a8db9fed3
14 changed files with 38 additions and 6 deletions

View File

@ -18,8 +18,8 @@ prefix ?= /usr/local
mandir ?= $(prefix)/man
CC ?= gcc
XCFLAGS ?=
CFLAGS ?= -O2 -ggdb3 -Wall -Werror -DNDEBUG=1
XCFLAGS ?= -DNDEBUG=1 -DMDB_DEBUG=0
CFLAGS ?= -O2 -g -Wall -Werror -Wextra
CFLAGS += -pthread $(XCFLAGS)
IOARENA ?= ../ioarena.git/@BUILD/src/ioarena

View File

@ -50,6 +50,7 @@ flagbit dbflags[] = {
static volatile sig_atomic_t gotsignal;
static void signal_hanlder( int sig ) {
(void) sig;
gotsignal = 1;
}
@ -228,6 +229,8 @@ static size_t problems_pop(struct problem* list) {
static int pgvisitor(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi,
const char* type, int nentries, int payload_bytes, int header_bytes, int unused_bytes)
{
(void) ctx;
if (type) {
size_t page_bytes = payload_bytes + header_bytes + unused_bytes;
size_t page_size = pgnumber * stat.base.ms_psize;
@ -250,14 +253,14 @@ static int pgvisitor(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi,
problem_add("page", pgno, "illegal unused-bytes", "%zu < %i < %zu",
0, unused_bytes, stat.base.ms_psize);
if (header_bytes < sizeof(long) || header_bytes >= stat.base.ms_psize - sizeof(long))
if (header_bytes < (int) sizeof(long) || (size_t) header_bytes >= stat.base.ms_psize - sizeof(long))
problem_add("page", pgno, "illegal header-length", "%zu < %i < %zu",
sizeof(long), header_bytes, stat.base.ms_psize - sizeof(long));
if (payload_bytes < 1) {
if (nentries > 0) {
problem_add("page", pgno, "zero size-of-entry", "payload %i bytes, %i entries",
payload_bytes, nentries);
if (header_bytes + unused_bytes < page_size) {
if ((size_t) header_bytes + unused_bytes < page_size) {
/* LY: hush a misuse error */
page_bytes = page_size;
}
@ -302,6 +305,9 @@ typedef int (visitor)(size_t record_number, MDB_val *key, MDB_val* data);
static int process_db(MDB_dbi dbi, char *name, visitor *handler, int silent);
static int handle_userdb(size_t record_number, MDB_val *key, MDB_val* data) {
(void) record_number;
(void) key;
(void) data;
return MDB_SUCCESS;
}
@ -366,7 +372,8 @@ static int handle_freedb(size_t record_number, MDB_val *key, MDB_val* data) {
static int handle_maindb(size_t record_number, MDB_val *key, MDB_val* data) {
char *name;
int i, rc;
int rc;
size_t i;
name = key->mv_data;
for(i = 0; i < key->mv_size; ++i) {

View File

@ -25,6 +25,7 @@
static void
sighandle(int sig)
{
(void) sig;
}
int main(int argc,char * argv[])

View File

@ -48,7 +48,8 @@ static volatile sig_atomic_t gotsig;
static void dumpsig( int sig )
{
gotsig=1;
(void) sig;
gotsig = 1;
}
static const char hexc[] = "0123456789abcdef";

View File

@ -44,6 +44,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
srand(time(NULL));
count = (rand()%384) + 64;

View File

@ -52,6 +52,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
srand(time(NULL));
count = (rand()%384) + 64;

View File

@ -46,6 +46,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
srand(time(NULL));
count = (rand()%384) + 64;

View File

@ -47,6 +47,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
srand(time(NULL));
memset(sval, 0, sizeof(sval));

View File

@ -47,6 +47,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
memset(sval, 0, sizeof(sval));
count = 510;

View File

@ -47,6 +47,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
srand(time(NULL));
memset(sval, 0, sizeof(sval));

View File

@ -47,6 +47,8 @@ int main(int argc,char * argv[])
int env_oflags;
struct stat db_stat, exe_stat;
(void) argc;
(void) argv;
srand(time(NULL));
E(mdb_env_create(&env));

View File

@ -205,6 +205,9 @@ static void wbench(int flags, int mb, int count, int salt)
int main(int argc,char * argv[])
{
(void) argc;
(void) argv;
#define SALT 1
#define COUNT 10000
#define SIZE 12

View File

@ -217,6 +217,9 @@ static void periodic_add_rec() {
}
int main(int argc, char** argv) {
(void) argc;
(void) argv;
char filename[PATH_MAX];
mkdir(opt_db_path, 0775);

View File

@ -240,6 +240,9 @@ static void periodic_stat(void) {
//}
int main(int argc, char** argv) {
(void) argc;
(void) argv;
char filename[PATH_MAX];
int i;
int64_t t;