Changeset: 00dc62cbadf4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=00dc62cbadf4 Modified Files: clients/mapiclient/tomograph.c clients/odbc/driver/ODBCConvert.c configure.ag monetdb5/optimizer/opt_pushselect.c sql/server/Makefile.ag sql/server/rel_optimizer.c sql/storage/bat/bat_storage.c testing/Mtimeout.c Branch: Jul2017 Log Message:
Enable -Wunreachable-code and -Wdeprecated-declarations also on Clang. We need some /* DISABLED CODE */ ( ) comments with extra parenteses for this, and we need to disable the unreachable-code warning for bison-generated code. diffs (228 lines): diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c --- a/clients/mapiclient/tomograph.c +++ b/clients/mapiclient/tomograph.c @@ -1395,7 +1395,7 @@ update(char *line, EventRecord *ev) if (ev->state >= MDB_PING ) { if (cpus == 0 && ev->state == MDB_PING) { char *s; - if( (s= ev->stmt,'[')) + if( (s= strchr(ev->stmt,'[')) != NULL) s++; else s = ev->stmt; while (s && isspace((int) *s)) diff --git a/clients/odbc/driver/ODBCConvert.c b/clients/odbc/driver/ODBCConvert.c --- a/clients/odbc/driver/ODBCConvert.c +++ b/clients/odbc/driver/ODBCConvert.c @@ -1215,6 +1215,7 @@ ODBCFetch(ODBCStmt *stmt, SQLPOINTER origptr; SQLLEN origbuflen; SQLLEN *origlenp; + SQLLEN sz; if (buflen < 0) { /* Invalid string or buffer length */ @@ -1251,8 +1252,6 @@ ODBCFetch(ODBCStmt *stmt, lenp = NULL; } switch (sql_type) { - SQLLEN sz; - default: case SQL_CHAR: case SQL_VARCHAR: diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -636,10 +636,7 @@ AS_VAR_IF([enable_strict], [yes], [ # "-Wunreachable-code" with clang and gcc < 4.5 . # At the same time, Apple deprecated OpenSSL in favour of # their own CommonCrypto API. We don't mind about that. - AS_CASE([$CC_ver], - [clang-*|gcc-[[0-3]].*|gcc-4.[[0-4]].*], - [MCHECK_ADD_FLAG([-Wno-deprecated-declarations])], - [MCHECK_ADD_FLAG([-Wunreachable-code])]) + MCHECK_ADD_FLAG([-Wunreachable-code]) dnl Our code is not (yet?) up to these: dnl MCHECK_ADD_FLAG([-pedantic-errors]) diff --git a/monetdb5/optimizer/opt_pushselect.c b/monetdb5/optimizer/opt_pushselect.c --- a/monetdb5/optimizer/opt_pushselect.c +++ b/monetdb5/optimizer/opt_pushselect.c @@ -190,7 +190,7 @@ OPTpushselectImplementation(Client cntxt if (no_updates(old, vars, getArg(q,1), getArg(p,1)) && ((sname == Qsname && tname == Qtname) || - (0 && strcmp(getVarConstant(mb, sname).val.sval, getVarConstant(mb, Qsname).val.sval) == 0 && + (/* DISABLES CODE */ (0) && strcmp(getVarConstant(mb, sname).val.sval, getVarConstant(mb, Qsname).val.sval) == 0 && strcmp(getVarConstant(mb, tname).val.sval, getVarConstant(mb, Qtname).val.sval) == 0))) { clrFunction(p); p->retc = 1; diff --git a/sql/server/Makefile.ag b/sql/server/Makefile.ag --- a/sql/server/Makefile.ag +++ b/sql/server/Makefile.ag @@ -16,6 +16,7 @@ INCLUDES = ../include ../common ../stora ../../gdk AM_YFLAGS = -d -p sql -r all +sql_parser.tab_CFLAGS = -Wno-unreachable-code lib_sqlserver = { NOINST diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5398,7 +5398,7 @@ rel_remove_join(int *changes, mvc *sql, list_merge(rel->exps, r->exps, (fdup)NULL); } } - if (is_join(rel->op) && 0) { + if (is_join(rel->op) && /* DISABLES CODE */ (0)) { sql_rel *l = rel->l; sql_rel *r = rel->r; int ldict = 0, rdict = 0; diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -27,7 +27,7 @@ timestamp_delta( sql_delta *d, int ts) { while (d->next && d->wtime > ts) d = d->next; - if (0 && d && d->cached) { + if (/* DISABLES CODE */ (0) && d && d->cached) { bat_destroy(d->cached); d->cached = NULL; } @@ -39,7 +39,7 @@ timestamp_dbat( sql_dbat *d, int ts) { while (d->next && d->wtime > ts) d = d->next; - if (0 && d && d->cached) { + if (/* DISABLES CODE */ (0) && d && d->cached) { bat_destroy(d->cached); d->cached = NULL; } @@ -2436,7 +2436,7 @@ update_table(sql_trans *tr, sql_table *f } while (b && b->wtime >= oldest->stime) b = b->next; - if (0 && b && b->wtime < oldest->stime) { + if (/* DISABLES CODE */ (0) && b && b->wtime < oldest->stime) { /* anything older can go */ destroy_dbat(tr, b->next); b->next = NULL; @@ -2482,7 +2482,7 @@ update_table(sql_trans *tr, sql_table *f } while (b && b->wtime >= oldest->stime) b = b->next; - if (0 && b && b->wtime < oldest->stime) { + if (/* DISABLES CODE */ (0) && b && b->wtime < oldest->stime) { /* anything older can go */ destroy_bat(tr, b->next); b->next = NULL; @@ -2547,7 +2547,7 @@ update_table(sql_trans *tr, sql_table *f } while (b && b->wtime >= oldest->stime) b = b->next; - if (0 && b && b->wtime < oldest->stime) { + if (/* DISABLES CODE */ (0) && b && b->wtime < oldest->stime) { /* anything older can go */ destroy_bat(tr, b->next); b->next = NULL; diff --git a/testing/Mtimeout.c b/testing/Mtimeout.c --- a/testing/Mtimeout.c +++ b/testing/Mtimeout.c @@ -89,57 +89,57 @@ limit(char **argv) perror("exec"); exit(EXIT_FAILURE); /* could not exec binary */ - } else { - if (timeout) { - /* We register the alarm handler in the parent process. If - * we would put the alarm in the child process, the child - * process could overrule it. - */ - action.sa_handler = alarm_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = 0; - sigaction(SIGALRM, &action, 0); - alarm(timeout); - } + } + + /* parent */ - while (waitpid(exec_pid, &status, 0) != exec_pid) ; + if (timeout) { + /* We register the alarm handler in the parent process. If + * we would put the alarm in the child process, the child + * process could overrule it. + */ + action.sa_handler = alarm_handler; + sigemptyset(&action.sa_mask); + action.sa_flags = 0; + sigaction(SIGALRM, &action, 0); + alarm(timeout); + } - if (WIFEXITED(status)) { /* Terminated normally */ - return WEXITSTATUS(status); - } else if (WIFSIGNALED(status)) { /* Got a signal */ - if (exec_timeout) { - if (quiet) { - char *cp[1]; + while (waitpid(exec_pid, &status, 0) != exec_pid) + ; + + if (WIFEXITED(status)) { /* Terminated normally */ + return WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { /* Got a signal */ + if (exec_timeout) { + if (quiet) { + char *cp[1]; - cp[0] = argv[9]; /* hardwired: the test output file */ - invocation(stderr, "!Timeout: ", cp); - } else { - invocation(stderr, "Timeout: ", argv); - } - return 1; + cp[0] = argv[9]; /* hardwired: the test output file */ + invocation(stderr, "!Timeout: ", cp); } else { - int wts = WTERMSIG(status); - char msg[1024]; + invocation(stderr, "Timeout: ", argv); + } + return 1; + } else { + int wts = WTERMSIG(status); + char msg[1024]; #ifdef HAVE_STRSIGNAL - snprintf(msg, 1022, "%s (%d): ", strsignal(wts), wts); + snprintf(msg, 1022, "%s (%d): ", strsignal(wts), wts); #else #ifdef HAVE__SYS_SIGLIST - snprintf(msg, 1022, "%s (%d): ", _sys_siglist[wts], wts); + snprintf(msg, 1022, "%s (%d): ", _sys_siglist[wts], wts); #else - snprintf(msg, 1022, "signal %d: ", wts); + snprintf(msg, 1022, "signal %d: ", wts); #endif #endif - invocation(stderr, msg, argv); - return ((wts > 0) ? wts : 1); - } + invocation(stderr, msg, argv); + return ((wts > 0) ? wts : 1); } - - abort(); } - abort(); - return 0; /* to silence some compilers */ + return 0; /* shouldn't get here */ } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list