summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2013-11-01 16:18:48 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2013-11-01 16:18:48 +1100
commit1e9c8b91d1f49563003b9fc0ed7778f7f122d77d (patch)
tree3de019755d24c75b4d2afc2e7ad632dd716f6976
parente37cb6128fc61010a27b65271a32cd6cfe7157f1 (diff)
downloadmongo-1e9c8b91d1f49563003b9fc0ed7778f7f122d77d.tar.gz
Fix compiler warnings with GCC 4.7.2 on Ubuntu.
-rw-r--r--dist/s_define2
-rw-r--r--src/include/misc.h6
-rw-r--r--src/include/txn.i9
-rw-r--r--src/txn/txn.c4
-rw-r--r--test/bloom/test_bloom.c2
-rw-r--r--test/fops/t.c2
-rw-r--r--test/fops/thread.h5
-rw-r--r--test/format/backup.c2
-rw-r--r--test/format/format.h5
-rw-r--r--test/format/t.c4
-rw-r--r--test/salvage/salvage.c3
-rw-r--r--test/thread/t.c2
-rw-r--r--test/thread/thread.h5
13 files changed, 38 insertions, 13 deletions
diff --git a/dist/s_define b/dist/s_define
index a03021ba711..7809bf14918 100644
--- a/dist/s_define
+++ b/dist/s_define
@@ -6,7 +6,7 @@ trap 'rm -f $t; exit 0' 0 1 2 3 13 15
# List of files to search.
l=`sed -e 's,#.*,,' -e '/^$/d' -e 's,^,../,' filelist`
-l="$l `echo ../src/include/*.i ../src/utilities/*.c `"
+l="$l `echo ../src/include/*.i ../src/utilities/*.c ../test/*/*.c`"
(
# Copy out the list of #defines we don't use, but it's OK.
diff --git a/src/include/misc.h b/src/include/misc.h
index 03435c63297..99e496d5440 100644
--- a/src/include/misc.h
+++ b/src/include/misc.h
@@ -71,6 +71,12 @@
*/
#define WT_UNUSED(var) (void)(var)
+/*
+ * Quiet compiler warning for unused result.
+ */
+#define WT_UNUSED_RET(var) \
+ ({ __typeof__(var) __ret = var; (void)sizeof __ret; })
+
/* Add GCC-specific attributes to types and function declarations. */
#ifdef __GNUC__
#define WT_GCC_ATTRIBUTE(x) __attribute__(x)
diff --git a/src/include/txn.i b/src/include/txn.i
index 35710e3df3d..5f2d60f85ae 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -211,16 +211,21 @@ static inline void
__wt_txn_read_first(WT_SESSION_IMPL *session)
{
WT_TXN *txn;
- WT_TXN_GLOBAL *txn_global;
- WT_TXN_STATE *txn_state;
txn = &session->txn;
+
+#ifdef HAVE_DIAGNOSTIC
+ {
+ WT_TXN_GLOBAL *txn_global;
+ WT_TXN_STATE *txn_state;
txn_global = &S2C(session)->txn_global;
txn_state = &txn_global->states[session->id];
WT_ASSERT(session, F_ISSET(txn, TXN_RUNNING) ||
(txn_state->id == WT_TXN_NONE &&
txn_state->snap_min == WT_TXN_NONE));
+ }
+#endif
if (txn->isolation == TXN_ISO_READ_COMMITTED ||
(!F_ISSET(txn, TXN_RUNNING) &&
diff --git a/src/txn/txn.c b/src/txn/txn.c
index df8191f554f..6590e32331e 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -62,12 +62,10 @@ __wt_txn_release_evict_snapshot(WT_SESSION_IMPL *session)
void
__wt_txn_release_snapshot(WT_SESSION_IMPL *session)
{
- WT_TXN *txn;
WT_TXN_STATE *txn_state;
- txn = &session->txn;
txn_state = &S2C(session)->txn_global.states[session->id];
- WT_ASSERT(session, txn->isolation == TXN_ISO_READ_UNCOMMITTED ||
+ WT_ASSERT(session, session->txn.isolation == TXN_ISO_READ_UNCOMMITTED ||
txn_state->snap_min == WT_TXN_NONE ||
!__wt_txn_visible_all(session, txn_state->snap_min));
txn_state->snap_min = WT_TXN_NONE;
diff --git a/test/bloom/test_bloom.c b/test/bloom/test_bloom.c
index 685d7897b54..af168c3cd3c 100644
--- a/test/bloom/test_bloom.c
+++ b/test/bloom/test_bloom.c
@@ -128,7 +128,7 @@ int setup(void)
int ret;
char config[512];
- (void)system("rm -f WiredTiger* *.bf");
+ WT_UNUSED_RET(system("rm -f WiredTiger* *.bf"));
/*
* This test doesn't test public Wired Tiger functionality, it still
diff --git a/test/fops/t.c b/test/fops/t.c
index 65ef38ae08b..6a43583177d 100644
--- a/test/fops/t.c
+++ b/test/fops/t.c
@@ -178,7 +178,7 @@ wt_shutdown(void)
static void
shutdown(void)
{
- (void)system("rm -f WiredTiger* __wt*");
+ UNUSED_RET(system("rm -f WiredTiger* __wt*"));
}
static int
diff --git a/test/fops/thread.h b/test/fops/thread.h
index 4d118efa4de..09c54e13eab 100644
--- a/test/fops/thread.h
+++ b/test/fops/thread.h
@@ -40,6 +40,11 @@
#include <wiredtiger.h>
#define UNUSED(v) (void)(v) /* Quiet unused var warnings */
+/*
+ * Quiet compiler warning for unused result.
+ */
+#define UNUSED_RET(var) \
+ ({ __typeof__(var) __ret = var; (void)sizeof __ret; })
extern WT_CONNECTION *conn; /* WiredTiger connection */
diff --git a/test/format/backup.c b/test/format/backup.c
index fbfff943b8d..d735649b8fb 100644
--- a/test/format/backup.c
+++ b/test/format/backup.c
@@ -125,7 +125,7 @@ hot_backup(void *arg)
die(ret, "pthread_rwlock_wrlock: hot-backup lock");
/* Re-create the backup directory. */
- (void)system("cd RUNDIR && rm -rf BACKUP");
+ UNUSED_RET(system("cd RUNDIR && rm -rf BACKUP"));
if (mkdir(RUNDIR_BACKUP, 0777) != 0)
die(errno, "mkdir: %s", RUNDIR_BACKUP);
diff --git a/test/format/format.h b/test/format/format.h
index 1a1963b8712..522e792635f 100644
--- a/test/format/format.h
+++ b/test/format/format.h
@@ -70,6 +70,11 @@ extern WT_EXTENSION_API *wt_api;
#define M(v) ((v) * 1000000) /* Million */
#define UNUSED(var) (void)(var) /* Quiet unused var warnings */
+/*
+ * Quiet compiler warning for unused result.
+ */
+#define UNUSED_RET(var) \
+ ({ __typeof__(var) __ret = var; (void)sizeof __ret; })
/* Get a random value between a min/max pair. */
#define MMRAND(min, max) (wts_rand() % (((max) + 1) - (min)) + (min))
diff --git a/test/format/t.c b/test/format/t.c
index 2c56d91ebcb..ba4087cd424 100644
--- a/test/format/t.c
+++ b/test/format/t.c
@@ -249,7 +249,7 @@ startup(void)
die(errno, "mkdir: %s", RUNDIR);
/* Remove the run's files except for rand. */
- (void)system("cd RUNDIR && rm -rf `ls | sed /rand/d`");
+ UNUSED_RET(system("cd RUNDIR && rm -rf `ls | sed /rand/d`"));
/* Create the data-source directory. */
if (mkdir(RUNDIR_KVS, 0777) != 0)
@@ -273,7 +273,7 @@ onint(int signo)
UNUSED(signo);
/* Remove the run's files except for rand. */
- (void)system("cd RUNDIR && rm -rf `ls | sed /rand/d`");
+ UNUSED_RET(system("cd RUNDIR && rm -rf `ls | sed /rand/d`"));
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
diff --git a/test/salvage/salvage.c b/test/salvage/salvage.c
index 2486d18e439..9d6eee1c59f 100644
--- a/test/salvage/salvage.c
+++ b/test/salvage/salvage.c
@@ -157,7 +157,8 @@ run(int r)
printf("\t%s: run %d\n", __wt_page_type_string(page_type), r);
- (void)system("rm -f WiredTiger WiredTiger.* __slvg.* __schema.*");
+ WT_UNUSED_RET(system(
+ "rm -f WiredTiger WiredTiger.* __slvg.* __schema.*"));
assert((res_fp = fopen(RSLT, "w")) != NULL);
/*
diff --git a/test/thread/t.c b/test/thread/t.c
index 6df8fc6115b..7be961a4e5e 100644
--- a/test/thread/t.c
+++ b/test/thread/t.c
@@ -203,7 +203,7 @@ wt_shutdown(void)
static void
shutdown(void)
{
- (void)system("rm -f WiredTiger.* __wt*");
+ UNUSED_RET(system("rm -f WiredTiger.* __wt*"));
}
static int
diff --git a/test/thread/thread.h b/test/thread/thread.h
index feac7e15eb6..c09bada629d 100644
--- a/test/thread/thread.h
+++ b/test/thread/thread.h
@@ -43,6 +43,11 @@
#define FNAME_STAT "__stats" /* File name for statistics */
#define UNUSED(v) (void)(v) /* Quiet unused var warnings */
+/*
+ * Quiet compiler warning for unused result.
+ */
+#define UNUSED_RET(var) \
+ ({ __typeof__(var) __ret = var; (void)sizeof __ret; })
extern WT_CONNECTION *conn; /* WiredTiger connection */