summaryrefslogtreecommitdiff
path: root/src/support/err.c
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-08-12 02:49:03 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2016-08-12 16:49:03 +1000
commitf69bbc18148c6fced50b01e04d552f0053fce20c (patch)
treea6d4f7250d32505ea9e0c94ceca4a98ce7416cb4 /src/support/err.c
parenta044bf81ace95df8fd9a5fd85fcf2c15f898cbd8 (diff)
downloadmongo-f69bbc18148c6fced50b01e04d552f0053fce20c.tar.gz
WT-2820 add gcc warn_unused_result attribute (#2938)
* Add the gcc "cold" attribute to the verbose, message, and assorted error functions (informs the compiler that the function is unlikely to be executed). * Add the WT_IGNORE_RET() macro that ignores return values in the handfull of places we want to ignore return values. * Replace calls to fprintf() in the utility with calls to util_err(), replace local variable names in error messages with class names.
Diffstat (limited to 'src/support/err.c')
-rw-r--r--src/support/err.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/support/err.c b/src/support/err.c
index 60fc53cecd0..0be428602bc 100644
--- a/src/support/err.c
+++ b/src/support/err.c
@@ -314,6 +314,7 @@ __wt_eventv(WT_SESSION_IMPL *session, bool msg_event, int error,
*/
void
__wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4)))
{
va_list ap;
@@ -323,7 +324,7 @@ __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...)
* an error value to return.
*/
va_start(ap, fmt);
- (void)__wt_eventv(session, false, error, NULL, 0, fmt, ap);
+ WT_IGNORE_RET(__wt_eventv(session, false, error, NULL, 0, fmt, ap));
va_end(ap);
}
@@ -333,6 +334,7 @@ __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...)
*/
void
__wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
WT_GCC_FUNC_ATTRIBUTE((format (printf, 2, 3)))
{
va_list ap;
@@ -342,7 +344,7 @@ __wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...)
* an error value to return.
*/
va_start(ap, fmt);
- (void)__wt_eventv(session, false, 0, NULL, 0, fmt, ap);
+ WT_IGNORE_RET(__wt_eventv(session, false, 0, NULL, 0, fmt, ap));
va_end(ap);
}
@@ -398,6 +400,7 @@ info_msg(WT_SESSION_IMPL *session, const char *fmt, va_list ap)
*/
int
__wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
WT_GCC_FUNC_ATTRIBUTE((format (printf, 2, 3)))
{
WT_DECL_RET;
@@ -474,6 +477,7 @@ __wt_progress(WT_SESSION_IMPL *session, const char *s, uint64_t v)
void
__wt_assert(WT_SESSION_IMPL *session,
int error, const char *file_name, int line_number, const char *fmt, ...)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
WT_GCC_FUNC_ATTRIBUTE((format (printf, 5, 6)))
#ifdef HAVE_DIAGNOSTIC
WT_GCC_FUNC_ATTRIBUTE((noreturn))
@@ -482,8 +486,8 @@ __wt_assert(WT_SESSION_IMPL *session,
va_list ap;
va_start(ap, fmt);
- (void)__wt_eventv(
- session, false, error, file_name, line_number, fmt, ap);
+ WT_IGNORE_RET(__wt_eventv(
+ session, false, error, file_name, line_number, fmt, ap));
va_end(ap);
#ifdef HAVE_DIAGNOSTIC
@@ -498,6 +502,7 @@ __wt_assert(WT_SESSION_IMPL *session,
*/
int
__wt_panic(WT_SESSION_IMPL *session)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
{
F_SET(S2C(session), WT_CONN_PANIC);
__wt_err(session, WT_PANIC, "the process must exit and restart");
@@ -521,6 +526,7 @@ __wt_panic(WT_SESSION_IMPL *session)
*/
int
__wt_illegal_value(WT_SESSION_IMPL *session, const char *name)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
{
__wt_errx(session, "%s%s%s",
name == NULL ? "" : name, name == NULL ? "" : ": ",
@@ -541,6 +547,7 @@ __wt_illegal_value(WT_SESSION_IMPL *session, const char *name)
*/
int
__wt_object_unsupported(WT_SESSION_IMPL *session, const char *uri)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
{
WT_RET_MSG(session, ENOTSUP, "unsupported object operation: %s", uri);
}
@@ -552,6 +559,7 @@ __wt_object_unsupported(WT_SESSION_IMPL *session, const char *uri)
*/
int
__wt_bad_object_type(WT_SESSION_IMPL *session, const char *uri)
+ WT_GCC_FUNC_ATTRIBUTE((cold))
{
if (WT_PREFIX_MATCH(uri, "backup:") ||
WT_PREFIX_MATCH(uri, "colgroup:") ||