Skip to content

Commit

Permalink
fix some compiler warnings pt1 (bloomberg#1112)
Browse files Browse the repository at this point in the history
* fix some compiler warnings
  • Loading branch information
adizaimi authored Sep 13, 2018
1 parent c29df69 commit 8518b1d
Show file tree
Hide file tree
Showing 72 changed files with 91 additions and 206 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=return-type")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread -lrt")
if (${CMAKE_C_COMPILER_ID} STREQUAL Clang)
Expand Down
2 changes: 0 additions & 2 deletions bdb/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

#include "genid.h"
#include "logmsg.h"

Expand Down
1 change: 0 additions & 1 deletion bdb/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */
#include <logmsg.h>

static void bdb_attr_set_int(bdb_state_type *bdb_state, bdb_attr_type *bdb_attr,
Expand Down
1 change: 0 additions & 1 deletion bdb/bdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */
#include <segstring.h>
#include "nodemap.h"
#include <logmsg.h>
Expand Down
11 changes: 0 additions & 11 deletions bdb/bdb_osqllog.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <strings.h>

#include <list.h>
#include <plbitlib.h>
#include <fsnap.h>
#include <bdb_osqllog.h>
#include <bdb_osqltrn.h>
Expand Down Expand Up @@ -61,18 +60,8 @@
#include <util.h>
#endif

#define MAXTABLENAME 128
#define LOG_DTA_PTR_BIT 1

static int log_repo_lsns = 0;

static char hex(unsigned char a)
{
if (a < 10)
return '0' + a;
return 'a' + (a - 10);
}

#include "bdb_osql_log_rec.h"
/**
* Log of undo-s
Expand Down
1 change: 0 additions & 1 deletion bdb/bdb_schemachange.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "llog_ext.h"
#include "llog_handlers.h"

#include <plbitlib.h> /* for bset/btst */
#include <ctrace.h>
#include <alloca.h>
#include "bdb_schemachange.h"
Expand Down
2 changes: 0 additions & 2 deletions bdb/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

bdb_callback_type *bdb_callback_create(void)
{
bdb_callback_type *bdb_callback;
Expand Down
2 changes: 0 additions & 2 deletions bdb/compact.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
#include <net.h>
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */
#include <logmsg.h>

#ifdef BERKDB_46
Expand Down
2 changes: 0 additions & 2 deletions bdb/count.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

/* returns -1 on error, 0 on empy table, >0 for number of recs found */
int bdb_count_int(bdb_state_type *bdb_state, int *bdberr)
{
Expand Down
1 change: 0 additions & 1 deletion bdb/custom_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include "dbinc/db_swap.h"
#endif

#include <plbitlib.h> /* for bset/btst */
#include <ctrace.h>
#include <logmsg.h>

Expand Down
4 changes: 0 additions & 4 deletions bdb/del.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
#include <net.h>
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

#include "genid.h"

#include "logmsg.h"

static int bdb_prim_delkey_int(bdb_state_type *bdb_state, tran_type *tran,
Expand Down
3 changes: 0 additions & 3 deletions bdb/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
#include "bdb_int.h"
#include "bdb_cursor.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

#include "genid.h"
#include "bdb_fetch.h"
#include "logmsg.h"
Expand Down
3 changes: 0 additions & 3 deletions bdb/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@
#include "bdb_int.h"
#include "locks.h"
#include <time.h>

#include <plbitlib.h> /* for bset/btst */
#include <ctrace.h>

#include <list.h>
#include "nodemap.h"
#include "intern_strings.h"
Expand Down
1 change: 0 additions & 1 deletion bdb/genid.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <build/db.h>
#include <epochlib.h>
#include <ctrace.h>
#include <plbitlib.h>
#include <plhash.h>
#include <list.h>

Expand Down
2 changes: 0 additions & 2 deletions bdb/lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
#include <net.h>
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */
#include <logmsg.h>

static int bdb_lite_exact_fetch_int(bdb_state_type *bdb_state, tran_type *tran,
Expand Down
2 changes: 0 additions & 2 deletions bdb/ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
#include "locks.h"
#include "llog_auto.h"
#include "missing.h"

#include <plbitlib.h> /* for bset/btst */
#include <list.h>
#include <lockmacro.h>

Expand Down
2 changes: 0 additions & 2 deletions bdb/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
#include "dbinc/hmac.h"
#include "genid.h"
#include "crc32c.h"

#include <plbitlib.h> /* for bset/btst */
#include <logmsg.h>

extern int __dbreg_get_name(DB_ENV *, u_int8_t *, char **);
Expand Down
2 changes: 0 additions & 2 deletions bdb/phys.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ Add the key ll_key_add (same call)
#include "bdb_int.h"
#include "locks.h"
#include <dbinc/db_swap.h>
#include "plbitlib.h" /* for bset/btst */

#include "logmsg.h"

/* There are two problems that berkeley solves for us that we need to
Expand Down
4 changes: 0 additions & 4 deletions bdb/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
#include <net.h>
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

#include "genid.h"

#include "bdb_api.h"

static int bdb_fetch_next_genids_int(bdb_state_type *bdb_state, int ixnum,
Expand Down
1 change: 0 additions & 1 deletion bdb/rep.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "bdb_int.h"
#include "locks.h"
#include "list.h"
#include <plbitlib.h> /* for bset/btst */
#include <endian_core.h>

#include <time.h>
Expand Down
1 change: 0 additions & 1 deletion bdb/serializable.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <strings.h>

#include <list.h>
#include <plbitlib.h>
#include <fsnap.h>

#include <bdb_osqllog.h>
Expand Down
1 change: 0 additions & 1 deletion bdb/summarize.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
#include <dbinc/btree.h>
#include "dbinc/db_swap.h"
#include "dbinc/hmac.h"
#include <plbitlib.h> /* for bset/btst */

#include <dbinc/crypto.h>
#include <btree/bt_prefix.h>
Expand Down
1 change: 0 additions & 1 deletion bdb/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "locks.h"

#include <memory_sync.h>
#include <plbitlib.h> /* for bset/btst */
#include <autoanalyze.h>
#include <logmsg.h>

Expand Down
1 change: 0 additions & 1 deletion bdb/tran.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

#include <build/db.h>
#include <epochlib.h>
#include <plbitlib.h> /* for bset/btst */
#include <lockmacro.h>

#include <ctrace.h>
Expand Down
2 changes: 0 additions & 2 deletions bdb/tranread.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
#include <net.h>
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */
#include <logmsg.h>

/* this is used only for comdbg2 stuff, will not work with rowlocks for now */
Expand Down
4 changes: 0 additions & 4 deletions bdb/upd.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@
#include <net.h>
#include "bdb_int.h"
#include "locks.h"

#include <plbitlib.h> /* for bset/btst */

#include "genid.h"

#include "logmsg.h"

int ll_dta_upd(bdb_state_type *bdb_state, int rrn, unsigned long long oldgenid,
Expand Down
2 changes: 0 additions & 2 deletions bdb/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
#include "bdb_int.h"
#include "locks.h"
#include "list.h"
#include <plbitlib.h> /* for bset/btst */

#include <memory_sync.h>
#include <logmsg.h>

Expand Down
15 changes: 8 additions & 7 deletions cdb2api/cdb2api.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ static int cdb2_cache_ssl_sess = CDB2_CACHE_SSL_SESS_DEFAULT;
static pthread_mutex_t cdb2_ssl_sess_lock = PTHREAD_MUTEX_INITIALIZER;

typedef struct cdb2_ssl_sess_list cdb2_ssl_sess_list;
#if 0
static void cdb2_free_ssl_sessions(cdb2_ssl_sess_list *sessions);
#endif
static cdb2_ssl_sess_list *cdb2_get_ssl_sessions(cdb2_hndl_tp *hndl);
static int cdb2_set_ssl_sessions(cdb2_hndl_tp *hndl,
cdb2_ssl_sess_list *sessions);
Expand Down Expand Up @@ -4198,7 +4200,7 @@ static int cdb2_run_statement_typed_int(cdb2_hndl_tp *hndl, const char *sql,
}

if ((hndl->firstresponse->error_code == CDB2__ERROR_CODE__MASTER_TIMEOUT ||
hndl->firstresponse->error_code == CDB2ERR_CHANGENODE) &&
hndl->firstresponse->error_code == CDB2__ERROR_CODE__CHANGENODE) &&
(hndl->snapshot_file || (!hndl->in_trans && !is_commit) ||
commit_file)) {
newsql_disconnect(hndl, hndl->sb, __LINE__);
Expand Down Expand Up @@ -4454,8 +4456,6 @@ const char *cdb2_column_name(cdb2_hndl_tp *hndl, int col)
int cdb2_snapshot_file(cdb2_hndl_tp *hndl, int *snapshot_file,
int *snapshot_offset)
{
char *ret;

if (hndl == NULL) {
(*snapshot_file) = -1;
(*snapshot_offset) = -1;
Expand Down Expand Up @@ -4504,8 +4504,6 @@ void cdb2_cluster_info(cdb2_hndl_tp *hndl, char **cluster, int *ports, int max,

const char *cdb2_cnonce(cdb2_hndl_tp *hndl)
{
char *ret;

if (hndl == NULL)
return "unallocated cdb2 handle";

Expand Down Expand Up @@ -4834,7 +4832,8 @@ static int comdb2db_get_dbhosts(cdb2_hndl_tp *hndl, const char *comdb2db_name,
}
if (num_same_room && sqlresponse->value[2]->value.data &&
strcasecmp(cdb2_machine_room,
sqlresponse->value[2]->value.data) == 0) {
(const char *)sqlresponse->value[2]->value.data) ==
0) {
(*num_same_room)++;
}
(*num_hosts)++;
Expand Down Expand Up @@ -5251,7 +5250,7 @@ static int configure_from_literal(cdb2_hndl_tp *hndl, const char *type)
{
char *type_copy = strdup(cdb2_skipws(type));
char *eomachine;
char *eooptions;
char *eooptions = NULL;
int rc = 0;
int port;
char *dc;
Expand Down Expand Up @@ -5532,6 +5531,7 @@ static int cdb2_set_ssl_sessions(cdb2_hndl_tp *hndl, cdb2_ssl_sess_list *arg)
return 0;
}

#if 0
static void cdb2_free_ssl_sessions(cdb2_ssl_sess_list *p)
{
int i, rc;
Expand Down Expand Up @@ -5565,6 +5565,7 @@ static void cdb2_free_ssl_sessions(cdb2_ssl_sess_list *p)
free(p->list);
free(p);
}
#endif
#else /* WITH_SSL */
int cdb2_init_ssl(int init_libssl, int init_libcrypto)
{
Expand Down
2 changes: 1 addition & 1 deletion comdb2rle/comdb2rle.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# error "BYTE_ORDER not defined"
#endif

#ifdef CRLE_VERBOSE
static void print_hex(uint8_t *b, unsigned l)
{
static char map[] = "0123456789abcdef";
Expand All @@ -35,7 +36,6 @@ static void print_hex(uint8_t *b, unsigned l)
fprintf(stderr, "\n");
}

#ifdef CRLE_VERBOSE
static int doprint = 0;
#endif

Expand Down
Loading

0 comments on commit 8518b1d

Please sign in to comment.