summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-09-01 15:03:26 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-09-01 15:03:26 -0400
commit4c63f1e53f0bee562aceb34e05175219fc572051 (patch)
tree722b48fc1504b9c489a02e7ec9710d6efbc078dd /examples
parentaa0b36355c10641422cf65a3feb2c593715bef7a (diff)
downloadmongo-4c63f1e53f0bee562aceb34e05175219fc572051.tar.gz
Minor shuffling to turn on more clang warnings:
- a few more uninitialized variables - make variables local to a single file static - replace use of WT_UNUSED_RET with error checking of the call (the macro was using a GCC extension clang doesn't like) With these changes, clang is mostly silent using the following options: -Weverything -Wno-cast-align -Wno-conversion -Wno-covered-switch-default -Wno-documentation-unknown-command -Wno-format-nonliteral -Wno-language-extension-token -Wno-missing-noreturn -Wno-packed -Wno-padded -Wno-switch-enum -Wno-zero-length-array Also, minor KNF whitespace cleanups.
Diffstat (limited to 'examples')
-rw-r--r--examples/c/ex_access.c5
-rw-r--r--examples/c/ex_all.c4
-rw-r--r--examples/c/ex_async.c4
-rw-r--r--examples/c/ex_call_center.c5
-rw-r--r--examples/c/ex_config.c5
-rw-r--r--examples/c/ex_config_parse.c3
-rw-r--r--examples/c/ex_cursor.c5
-rw-r--r--examples/c/ex_extending.c5
-rw-r--r--examples/c/ex_file.c2
-rw-r--r--examples/c/ex_hello.c5
-rw-r--r--examples/c/ex_log.c6
-rw-r--r--examples/c/ex_pack.c5
-rw-r--r--examples/c/ex_process.c5
-rw-r--r--examples/c/ex_schema.c4
-rw-r--r--examples/c/ex_scope.c2
-rw-r--r--examples/c/ex_stat.c2
-rw-r--r--examples/c/ex_thread.c2
17 files changed, 39 insertions, 30 deletions
diff --git a/examples/c/ex_access.c b/examples/c/ex_access.c
index 98b7c0b32da..522db567d71 100644
--- a/examples/c/ex_access.c
+++ b/examples/c/ex_access.c
@@ -33,9 +33,10 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
-int main(void)
+int
+main(void)
{
/*! [access example connection] */
WT_CONNECTION *conn;
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c
index a612044aeb8..8f9fba093de 100644
--- a/examples/c/ex_all.c
+++ b/examples/c/ex_all.c
@@ -55,8 +55,8 @@ int pack_ops(WT_SESSION *session);
int session_ops(WT_SESSION *session);
int transaction_ops(WT_CONNECTION *conn, WT_SESSION *session);
-const char * const progname = "ex_all";
-const char *home;
+static const char * const progname = "ex_all";
+static const char *home;
int
cursor_ops(WT_SESSION *session)
diff --git a/examples/c/ex_async.c b/examples/c/ex_async.c
index 0498ad3b8d3..fb3c77e9a6d 100644
--- a/examples/c/ex_async.c
+++ b/examples/c/ex_async.c
@@ -41,8 +41,8 @@
#define ATOMIC_ADD(v, val) __sync_add_and_fetch(&(v), val)
#endif
-const char * const home = NULL;
-int global_error = 0;
+static const char * const home = NULL;
+static int global_error = 0;
/*! [async example callback implementation] */
typedef struct {
diff --git a/examples/c/ex_call_center.c b/examples/c/ex_call_center.c
index 5e6e7b62378..14ab8f37f56 100644
--- a/examples/c/ex_call_center.c
+++ b/examples/c/ex_call_center.c
@@ -36,7 +36,7 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
/*! [call-center decl] */
/*
@@ -74,7 +74,8 @@ typedef struct {
} CALL;
/*! [call-center decl] */
-int main(void)
+int
+main(void)
{
int count, exact, ret;
WT_CONNECTION *conn;
diff --git a/examples/c/ex_config.c b/examples/c/ex_config.c
index e2e8808c95c..cb8ab02b393 100644
--- a/examples/c/ex_config.c
+++ b/examples/c/ex_config.c
@@ -35,9 +35,10 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
-int main(void)
+int
+main(void)
{
int ret;
WT_CONNECTION *conn;
diff --git a/examples/c/ex_config_parse.c b/examples/c/ex_config_parse.c
index df16891e7af..543c53f508c 100644
--- a/examples/c/ex_config_parse.c
+++ b/examples/c/ex_config_parse.c
@@ -34,7 +34,8 @@
#include <wiredtiger.h>
-int main(void)
+int
+main(void)
{
int ret;
diff --git a/examples/c/ex_cursor.c b/examples/c/ex_cursor.c
index f7382a5d6c5..e8f9b7fa9e8 100644
--- a/examples/c/ex_cursor.c
+++ b/examples/c/ex_cursor.c
@@ -43,7 +43,7 @@ int cursor_insert(WT_CURSOR *cursor);
int cursor_update(WT_CURSOR *cursor);
int cursor_remove(WT_CURSOR *cursor);
-const char *home;
+static const char *home;
/*! [cursor next] */
int
@@ -158,7 +158,8 @@ cursor_remove(WT_CURSOR *cursor)
}
/*! [cursor remove] */
-int main(void)
+int
+main(void)
{
WT_CONNECTION *conn;
WT_CURSOR *cursor;
diff --git a/examples/c/ex_extending.c b/examples/c/ex_extending.c
index 26dad5bbaba..62abaa09bf8 100644
--- a/examples/c/ex_extending.c
+++ b/examples/c/ex_extending.c
@@ -35,7 +35,7 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
/*! [case insensitive comparator] */
/* A simple case insensitive comparator. */
@@ -83,7 +83,8 @@ __compare_prefixes(WT_COLLATOR *collator, WT_SESSION *session,
static PREFIX_COLLATOR pcoll10 = { {__compare_prefixes, NULL, NULL}, 10 };
/*! [n character comparator] */
-int main(void)
+int
+main(void)
{
int ret;
WT_CONNECTION *conn;
diff --git a/examples/c/ex_file.c b/examples/c/ex_file.c
index 14a9c3061a1..4170d1b099d 100644
--- a/examples/c/ex_file.c
+++ b/examples/c/ex_file.c
@@ -34,7 +34,7 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
int
main(void)
diff --git a/examples/c/ex_hello.c b/examples/c/ex_hello.c
index 6eab603a73a..c94c1072f61 100644
--- a/examples/c/ex_hello.c
+++ b/examples/c/ex_hello.c
@@ -35,9 +35,10 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
-int main(void)
+int
+main(void)
{
WT_CONNECTION *conn;
WT_SESSION *session;
diff --git a/examples/c/ex_log.c b/examples/c/ex_log.c
index 37d1394afff..27e8e810252 100644
--- a/examples/c/ex_log.c
+++ b/examples/c/ex_log.c
@@ -35,10 +35,10 @@
#include <wiredtiger.h>
-const char *home1 = "WT_HOME_LOG_1";
-const char *home2 = "WT_HOME_LOG_2";
+static const char *home1 = "WT_HOME_LOG_1";
+static const char *home2 = "WT_HOME_LOG_2";
-const char * const uri = "table:logtest";
+static const char * const uri = "table:logtest";
#define CONN_CONFIG "create,cache_size=100MB,log=(archive=false,enabled=true)"
#define MAX_KEYS 10
diff --git a/examples/c/ex_pack.c b/examples/c/ex_pack.c
index c412d883485..29d645f6cfc 100644
--- a/examples/c/ex_pack.c
+++ b/examples/c/ex_pack.c
@@ -34,9 +34,10 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
-int main(void)
+int
+main(void)
{
WT_CONNECTION *conn;
WT_SESSION *session;
diff --git a/examples/c/ex_process.c b/examples/c/ex_process.c
index f291f753e80..a25d9084965 100644
--- a/examples/c/ex_process.c
+++ b/examples/c/ex_process.c
@@ -35,9 +35,10 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
-int main(void)
+int
+main(void)
{
int ret;
WT_CONNECTION *conn;
diff --git a/examples/c/ex_schema.c b/examples/c/ex_schema.c
index 6218e2b2e21..bc2f3b6c2d9 100644
--- a/examples/c/ex_schema.c
+++ b/examples/c/ex_schema.c
@@ -36,7 +36,7 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
/*! [schema declaration] */
/* The C struct for the data we are storing in a WiredTiger table. */
@@ -46,7 +46,7 @@ typedef struct {
uint64_t population;
} POP_RECORD;
-POP_RECORD pop_data[] = {
+static POP_RECORD pop_data[] = {
{ "AU", 1900, 4000000 },
{ "AU", 2000, 19053186 },
{ "CAN", 1900, 5500000 },
diff --git a/examples/c/ex_scope.c b/examples/c/ex_scope.c
index 2d24bbf3bf5..8dea4cfc772 100644
--- a/examples/c/ex_scope.c
+++ b/examples/c/ex_scope.c
@@ -34,7 +34,7 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
static int
cursor_scope_ops(WT_CURSOR *cursor)
diff --git a/examples/c/ex_stat.c b/examples/c/ex_stat.c
index c5e821d8620..0614a1de234 100644
--- a/examples/c/ex_stat.c
+++ b/examples/c/ex_stat.c
@@ -41,7 +41,7 @@ int print_overflow_pages(WT_SESSION *);
int get_stat(WT_CURSOR *cursor, int stat_field, uint64_t *valuep);
int print_derived_stats(WT_SESSION *);
-const char *home;
+static const char *home;
/*! [statistics display function] */
int
diff --git a/examples/c/ex_thread.c b/examples/c/ex_thread.c
index 3189d334b4d..05a1fc96d15 100644
--- a/examples/c/ex_thread.c
+++ b/examples/c/ex_thread.c
@@ -36,7 +36,7 @@
#include <wiredtiger.h>
-const char *home;
+static const char *home;
void *scan_thread(void *arg);