summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-08-29 21:55:28 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-08-30 11:55:28 +1000
commitd7873056f92e5055695bf4e9c03a29d9462527f9 (patch)
tree792a086e7c699c603cde6d05407ce080596ff0c9 /src
parent499ab821ea6bd8db5369d9951be9b4f372e2c89e (diff)
downloadmongo-d7873056f92e5055695bf4e9c03a29d9462527f9.tar.gz
WT-2871 __wt_verbose has the wrong GCC format attributes (#2995)
Fix the __wt_verbose() attributes specfically (the argument numbering was wrong) Fix setting GCC attributes in inline function include files in general: we don't parse the included inline function files to create prototypes, additionally, add a specific function prototype with the correct form of the GCC attribute. Fix a few problems that have crept in over time.
Diffstat (limited to 'src')
-rw-r--r--src/btree/bt_slvg.c4
-rw-r--r--src/include/misc.i14
-rw-r--r--src/include/os_fhandle.i4
-rw-r--r--src/include/os_fs.i2
-rw-r--r--src/include/os_fstream.i12
5 files changed, 28 insertions, 8 deletions
diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c
index 831e58b91bd..fec78ee272d 100644
--- a/src/btree/bt_slvg.c
+++ b/src/btree/bt_slvg.c
@@ -1943,7 +1943,7 @@ __slvg_row_build_leaf(
if (cmp >= 0)
break;
__wt_verbose(session, WT_VERB_SALVAGE,
- "%s merge discarding leading key %.*s",
+ "%s merge discarding leading key %s",
__wt_addr_string(session,
trk->trk_addr, trk->trk_addr_size, ss->tmp1),
__wt_buf_set_printable(
@@ -1963,7 +1963,7 @@ __slvg_row_build_leaf(
if (cmp < 0)
break;
__wt_verbose(session, WT_VERB_SALVAGE,
- "%s merge discarding trailing key %.*s",
+ "%s merge discarding trailing key %s",
__wt_addr_string(session,
trk->trk_addr, trk->trk_addr_size, ss->tmp1),
__wt_buf_set_printable(
diff --git a/src/include/misc.i b/src/include/misc.i
index e1b882388e7..9eab7c5d7c1 100644
--- a/src/include/misc.i
+++ b/src/include/misc.i
@@ -48,11 +48,21 @@ __wt_seconds(WT_SESSION_IMPL *session, time_t *timep)
/*
* __wt_verbose --
* Verbose message.
+ *
+ * Inline functions are not parsed for external prototypes, so in cases where we
+ * want GCC attributes attached to the functions, we have to do so explicitly.
+ */
+static inline void
+__wt_verbose(WT_SESSION_IMPL *session, int flag, const char *fmt, ...)
+WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4)))
+WT_GCC_FUNC_DECL_ATTRIBUTE((cold));
+
+/*
+ * __wt_verbose --
+ * Verbose message.
*/
static inline void
__wt_verbose(WT_SESSION_IMPL *session, int flag, const char *fmt, ...)
- WT_GCC_FUNC_ATTRIBUTE((format (printf, 2, 3)))
- WT_GCC_FUNC_ATTRIBUTE((cold))
{
#ifdef HAVE_VERBOSE
va_list ap;
diff --git a/src/include/os_fhandle.i b/src/include/os_fhandle.i
index 78d25969508..a9150279a85 100644
--- a/src/include/os_fhandle.i
+++ b/src/include/os_fhandle.i
@@ -51,7 +51,7 @@ __wt_fextend(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset)
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_IN_MEMORY));
__wt_verbose(session, WT_VERB_HANDLEOPS,
- "%s: handle-extend: %" PRIuMAX " at %" PRIuMAX,
+ "%s: handle-extend: to %" PRIuMAX,
fh->handle->name, (uintmax_t)offset);
/*
@@ -134,7 +134,7 @@ __wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset)
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY));
__wt_verbose(session, WT_VERB_HANDLEOPS,
- "%s: handle-truncate: %" PRIuMAX " at %" PRIuMAX,
+ "%s: handle-truncate: to %" PRIuMAX,
fh->handle->name, (uintmax_t)offset);
/*
diff --git a/src/include/os_fs.i b/src/include/os_fs.i
index 3012422f33a..4cf1128280e 100644
--- a/src/include/os_fs.i
+++ b/src/include/os_fs.i
@@ -23,7 +23,7 @@ __wt_fs_directory_list(WT_SESSION_IMPL *session,
*countp = 0;
__wt_verbose(session, WT_VERB_FILEOPS,
- "%s: directory-list: %s prefix %s",
+ "%s: directory-list: prefix %s",
dir, prefix == NULL ? "all" : prefix);
WT_RET(__wt_filename(session, dir, &path));
diff --git a/src/include/os_fstream.i b/src/include/os_fstream.i
index a0ac4ef8b6a..c606a6f75c7 100644
--- a/src/include/os_fstream.i
+++ b/src/include/os_fstream.i
@@ -58,10 +58,20 @@ __wt_vfprintf(
/*
* __wt_fprintf --
* ANSI C fprintf.
+ *
+ * Inline functions are not parsed for external prototypes, so in cases where we
+ * want GCC attributes attached to the functions, we have to do so explicitly.
+ */
+static inline int
+__wt_fprintf(WT_SESSION_IMPL *session, WT_FSTREAM *fstr, const char *fmt, ...)
+ WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4)));
+
+/*
+ * __wt_fprintf --
+ * ANSI C fprintf.
*/
static inline int
__wt_fprintf(WT_SESSION_IMPL *session, WT_FSTREAM *fstr, const char *fmt, ...)
- WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
{
WT_DECL_RET;
va_list ap;