diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | build_posix/aclocal/strict.m4 | 7 | ||||
-rw-r--r-- | dist/s_copyright.list | 1 | ||||
-rw-r--r-- | src/block/block_compact.c | 6 | ||||
-rw-r--r-- | src/block/block_ext.c | 2 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 2 | ||||
-rw-r--r-- | src/include/error.h | 2 | ||||
-rw-r--r-- | src/include/os_windows.h | 4 | ||||
-rw-r--r-- | src/log/log.c | 18 | ||||
-rw-r--r-- | src/reconcile/rec_write.c | 4 | ||||
-rw-r--r-- | src/support/huffman.c | 2 | ||||
-rw-r--r-- | test/format/wts.c | 50 | ||||
-rw-r--r-- | test/utility/test_util.h | 20 | ||||
-rw-r--r-- | test/windows/windows_shim.h | 52 |
14 files changed, 92 insertions, 83 deletions
diff --git a/.gitignore b/.gitignore index 4611f2aa98c..cc2aad047be 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,11 @@ tags WT_HOME/ WT_TEST/ +# Bench/workgen +/bench/workgen/_workgen.so +/bench/workgen/workgen/workgen.py +/bench/workgen/workgen_wrap.cxx + # Python /lang/python/_wiredtiger.so /lang/python/wiredtiger.py diff --git a/build_posix/aclocal/strict.m4 b/build_posix/aclocal/strict.m4 index 659867fa69e..8c15a22d575 100644 --- a/build_posix/aclocal/strict.m4 +++ b/build_posix/aclocal/strict.m4 @@ -41,7 +41,14 @@ AC_DEFUN([AM_GCC_WARNINGS], [ w="$w -Wno-error=inline" w="$w -Wno-error=unsafe-loop-optimizations" + # GCC 4.7 + # WiredTiger uses anonymous structures/unions, a C11 extension, + # turn off those warnings. + # GCC 6.X + # Additional warning messages. case "$1" in + [*4.7.[0-9]*]) # gcc4.7 + w="$w -Wno-c11-extensions";; [*6.[0-9].[0-9]*]) # gcc6.X w="$w -Wduplicated-cond" w="$w -Wmisleading-indentation";; diff --git a/dist/s_copyright.list b/dist/s_copyright.list index ba5e7c6ff3e..2ac63bcb159 100644 --- a/dist/s_copyright.list +++ b/dist/s_copyright.list @@ -1,6 +1,5 @@ skip api/leveldb/leveldb_wt_config.h skip api/leveldb/leveldb_wt_config.in -skip bench/workgen/workgen.py skip bench/workgen/workgen/workgen.py skip bench/workgen/workgen_wrap.cxx skip build_win/wiredtiger_config.h diff --git a/src/block/block_compact.c b/src/block/block_compact.c index 2ca167f97a4..e7b9beafb01 100644 --- a/src/block/block_compact.c +++ b/src/block/block_compact.c @@ -242,8 +242,10 @@ __block_dump_avail(WT_SESSION_IMPL *session, WT_BLOCK *block, bool start) memset(percentile, 0, sizeof(percentile)); WT_EXT_FOREACH(ext, el->off) for (i = 0; i < ext->size / 512; ++i) { - ++decile[((ext->off + i * 512) * 10) / size]; - ++percentile[((ext->off + i * 512) * 100) / size]; + ++decile[ + ((ext->off + (wt_off_t)i * 512) * 10) / size]; + ++percentile[ + ((ext->off + (wt_off_t)i * 512) * 100) / size]; } #ifdef __VERBOSE_OUTPUT_PERCENTILE diff --git a/src/block/block_ext.c b/src/block/block_ext.c index 0382e6b92aa..6ef861b59c9 100644 --- a/src/block/block_ext.c +++ b/src/block/block_ext.c @@ -1272,7 +1272,7 @@ __wt_block_extlist_write(WT_SESSION_IMPL *session, * entries: the initial WT_BLOCK_EXTLIST_MAGIC/0 pair and the list- * terminating WT_BLOCK_INVALID_OFFSET/0 pair. */ - size = (entries + 2) * 2 * WT_INTPACK64_MAXSIZE; + size = ((size_t)entries + 2) * 2 * WT_INTPACK64_MAXSIZE; WT_RET(__wt_block_write_size(session, block, &size)); WT_RET(__wt_scr_alloc(session, size, &tmp)); dsk = tmp->mem; diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 97b96788831..b5dd3837531 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -1706,7 +1706,7 @@ __evict_walk_file(WT_SESSION_IMPL *session, * whether to give up. When we are only looking for dirty pages, * search the tree for longer. */ - min_pages = 10 * target_pages; + min_pages = 10 * (uint64_t)target_pages; if (F_ISSET(cache, WT_CACHE_EVICT_DIRTY) && !F_ISSET(cache, WT_CACHE_EVICT_CLEAN)) min_pages *= 10; diff --git a/src/include/error.h b/src/include/error.h index 16f916586cc..465ab4fa859 100644 --- a/src/include/error.h +++ b/src/include/error.h @@ -6,7 +6,7 @@ * See the file LICENSE for redistribution information. */ -#define WT_DEBUG_POINT ((void *)0xdeadbeef) +#define WT_DEBUG_POINT ((void *)(uintptr_t)0xdeadbeef) #define WT_DEBUG_BYTE (0xab) /* In DIAGNOSTIC mode, yield in places where we want to encourage races. */ diff --git a/src/include/os_windows.h b/src/include/os_windows.h index 78a359e65fd..ea54d00af1f 100644 --- a/src/include/os_windows.h +++ b/src/include/os_windows.h @@ -42,9 +42,9 @@ struct timespec { * These are POSIX types which Windows lacks * Eventually WiredTiger will migrate away from these types */ -typedef uint32_t u_int; +typedef unsigned int u_int; typedef unsigned char u_char; -typedef uint64_t u_long; +typedef unsigned long u_long; /* * Windows does have ssize_t diff --git a/src/log/log.c b/src/log/log.c index 0de881660b2..960b87106cc 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -472,14 +472,12 @@ __wt_log_reset(WT_SESSION_IMPL *session, uint32_t lognum) * system. */ WT_RET(__wt_close(session, &log->log_fh)); - WT_RET(__log_get_files(session, - WT_LOG_FILENAME, &logfiles, &logcount)); + WT_RET(__log_get_files(session, WT_LOG_FILENAME, &logfiles, &logcount)); for (i = 0; i < logcount; i++) { WT_ERR(__wt_log_extract_lognum( session, logfiles[i], &old_lognum)); WT_ASSERT(session, old_lognum < lognum); - WT_ERR(__wt_log_remove( - session, WT_LOG_FILENAME, old_lognum)); + WT_ERR(__wt_log_remove(session, WT_LOG_FILENAME, old_lognum)); } log->fileid = lognum; @@ -487,8 +485,7 @@ __wt_log_reset(WT_SESSION_IMPL *session, uint32_t lognum) WT_WITH_SLOT_LOCK(session, log, ret = __log_newfile(session, true, NULL)); WT_ERR(__wt_log_slot_init(session, false)); -err: WT_TRET( - __wt_fs_directory_list_free(session, &logfiles, logcount)); +err: WT_TRET(__wt_fs_directory_list_free(session, &logfiles, logcount)); return (ret); } @@ -1150,8 +1147,7 @@ __log_truncate(WT_SESSION_IMPL *session, WT_ERR(__log_get_files(session, WT_LOG_FILENAME, &logfiles, &logcount)); for (i = 0; i < logcount; i++) { WT_ERR(__wt_log_extract_lognum(session, logfiles[i], &lognum)); - if (lognum > lsn->l.file && - lognum < log->trunc_lsn.l.file) { + if (lognum > lsn->l.file && lognum < log->trunc_lsn.l.file) { WT_ERR(__log_openfile(session, &log_fh, file_prefix, lognum, 0)); /* @@ -1951,8 +1947,7 @@ advance: /* Truncate if we're in recovery. */ if (LF_ISSET(WT_LOGSCAN_RECOVER) && __wt_log_cmp(&rd_lsn, &log->trunc_lsn) < 0) - WT_ERR(__log_truncate(session, - &rd_lsn, WT_LOG_FILENAME, 0)); + WT_ERR(__log_truncate(session, &rd_lsn, WT_LOG_FILENAME, 0)); err: WT_STAT_CONN_INCR(session, log_scans); /* @@ -2086,8 +2081,7 @@ __wt_log_write(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp, if (compression_failed || result_len / log->allocsize >= record->size / log->allocsize) - WT_STAT_CONN_INCR(session, - log_compress_write_fails); + WT_STAT_CONN_INCR(session, log_compress_write_fails); else { WT_STAT_CONN_INCR(session, log_compress_writes); WT_STAT_CONN_INCRV(session, log_compress_mem, diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 7b1a51da0a0..1e76f0d84d0 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -2149,8 +2149,8 @@ __rec_split_init(WT_SESSION_IMPL *session, r->page_size = r->page_size_orig = max; if (r->raw_compression) r->max_raw_page_size = r->page_size = - (uint32_t)WT_MIN(r->page_size * 10, - WT_MAX(r->page_size, btree->maxmempage / 2)); + (uint32_t)WT_MIN((uint64_t)r->page_size * 10, + WT_MAX((uint64_t)r->page_size, btree->maxmempage / 2)); /* * If we have to split, we want to choose a smaller page size for the * split pages, because otherwise we could end up splitting one large diff --git a/src/support/huffman.c b/src/support/huffman.c index 83d1e790ce7..17342c53ced 100644 --- a/src/support/huffman.c +++ b/src/support/huffman.c @@ -483,7 +483,7 @@ __wt_huffman_open(WT_SESSION_IMPL *session, set_codes(node, huffman->codes, 0, 0); WT_ERR(__wt_calloc_def( - session, 1U << huffman->max_depth, &huffman->code2symbol)); + session, (size_t)1U << huffman->max_depth, &huffman->code2symbol)); make_table(session, huffman->code2symbol, huffman->max_depth, huffman->codes, huffman->numSymbols); diff --git a/test/format/wts.c b/test/format/wts.c index 2a8c6f54b06..673b65794f5 100644 --- a/test/format/wts.c +++ b/test/format/wts.c @@ -35,28 +35,40 @@ static const char * compressor(uint32_t compress_flag) { + const char *p; + + p = "unrecognized compressor flag"; switch (compress_flag) { case COMPRESS_NONE: - return ("none"); + p ="none"; + break; case COMPRESS_LZ4: - return ("lz4"); + p ="lz4"; + break; case COMPRESS_LZ4_NO_RAW: - return ("lz4-noraw"); + p ="lz4-noraw"; + break; case COMPRESS_LZO: - return ("LZO1B-6"); + p ="LZO1B-6"; + break; case COMPRESS_SNAPPY: - return ("snappy"); + p ="snappy"; + break; case COMPRESS_ZLIB: - return ("zlib"); + p ="zlib"; + break; case COMPRESS_ZLIB_NO_RAW: - return ("zlib-noraw"); + p ="zlib-noraw"; + break; case COMPRESS_ZSTD: - return ("zstd"); - default: + p ="zstd"; break; + default: + testutil_die(EINVAL, + "illegal compression flag: %#" PRIx32, compress_flag); + /* NOTREACHED */ } - testutil_die(EINVAL, - "illegal compression flag: %#" PRIx32, compress_flag); + return (p); } /* @@ -66,16 +78,22 @@ compressor(uint32_t compress_flag) static const char * encryptor(uint32_t encrypt_flag) { + const char *p; + + p = "unrecognized encryptor flag"; switch (encrypt_flag) { case ENCRYPT_NONE: - return ("none"); + p = "none"; + break; case ENCRYPT_ROTN_7: - return ("rotn,keyid=7"); - default: + p = "rotn,keyid=7"; break; + default: + testutil_die(EINVAL, + "illegal encryption flag: %#" PRIx32, encrypt_flag); + /* NOTREACHED */ } - testutil_die(EINVAL, - "illegal encryption flag: %#" PRIx32, encrypt_flag); + return (p); } static int diff --git a/test/utility/test_util.h b/test/utility/test_util.h index 66746c794e8..9c67bde2457 100644 --- a/test/utility/test_util.h +++ b/test/utility/test_util.h @@ -25,21 +25,21 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -#include "wt_internal.h" /* For __wt_XXX */ +#include "wt_internal.h" #ifdef _WIN32 - #define DIR_DELIM '\\' - #define DIR_DELIM_STR "\\" - #define DIR_EXISTS_COMMAND "IF EXIST " - #define RM_COMMAND "rd /s /q " +#define DIR_DELIM '\\' +#define DIR_DELIM_STR "\\" +#define DIR_EXISTS_COMMAND "IF EXIST " +#define RM_COMMAND "rd /s /q " #else - #define DIR_DELIM '/' - #define DIR_DELIM_STR "/" - #define RM_COMMAND "rm -rf " +#define DIR_DELIM '/' +#define DIR_DELIM_STR "/" +#define RM_COMMAND "rm -rf " #endif -#define DEFAULT_DIR "WT_TEST" -#define MKDIR_COMMAND "mkdir " +#define DEFAULT_DIR "WT_TEST" +#define MKDIR_COMMAND "mkdir " #ifdef _WIN32 #include "windows_shim.h" diff --git a/test/windows/windows_shim.h b/test/windows/windows_shim.h index d3950ba9a18..88b707f9ad9 100644 --- a/test/windows/windows_shim.h +++ b/test/windows/windows_shim.h @@ -25,27 +25,13 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef _WIN32 - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <errno.h> -#include <stdint.h> -#include <direct.h> -#include <io.h> -#include <process.h> - #include "wt_internal.h" -#define inline __inline - -/* Define some POSIX types */ -typedef int u_int; +#include <direct.h> /* _mkdir */ /* Windows does not define constants for access() */ -#define R_OK 04 -#define X_OK R_OK +#define R_OK 04 +#define X_OK R_OK /* MSVC Doesn't provide __func__, it has __FUNCTION__ */ #ifdef _MSC_VER @@ -77,11 +63,13 @@ int gettimeofday(struct timeval* tp, void* tzp); */ typedef uint32_t useconds_t; -int -sleep(int seconds); +int sleep(int seconds); +int usleep(useconds_t useconds); -int -usleep(useconds_t useconds); +#define lseek(fd, offset, origin) \ + _lseek(fd, (long)(offset), origin) +#define write(fd, buffer, count) \ + _write(fd, buffer, (unsigned int)(count)) /* * Emulate the <pthread.h> support we need for tests and example code. @@ -102,16 +90,12 @@ typedef HANDLE pthread_t; typedef int pthread_rwlockattr_t; typedef int pthread_attr_t; -int pthread_rwlock_destroy(pthread_rwlock_t *); -int pthread_rwlock_init(pthread_rwlock_t *, - const pthread_rwlockattr_t *); -int pthread_rwlock_rdlock(pthread_rwlock_t *); -int pthread_rwlock_unlock(pthread_rwlock_t *); -int pthread_rwlock_trywrlock(pthread_rwlock_t *); -int pthread_rwlock_wrlock(pthread_rwlock_t *); - -int pthread_create(pthread_t *, const pthread_attr_t *, - void *(*)(void *), void *); -int pthread_join(pthread_t, void **); - -#endif +int pthread_create( + pthread_t *, const pthread_attr_t *, void *(*)(void *), void *); +int pthread_join(pthread_t, void **); +int pthread_rwlock_destroy(pthread_rwlock_t *); +int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *); +int pthread_rwlock_rdlock(pthread_rwlock_t *); +int pthread_rwlock_trywrlock(pthread_rwlock_t *); +int pthread_rwlock_unlock(pthread_rwlock_t *); +int pthread_rwlock_wrlock(pthread_rwlock_t *); |