summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-01-18 16:25:58 -0500
committerEric Milkie <milkie@10gen.com>2012-01-18 16:37:45 -0500
commit7015b211d931cd6d456094e1abe3b68cc28c6e46 (patch)
treefe53e55007223594ee7933fd2f9f03398ca7d65d
parent6f3be45ecda2601b4e53ccca6fa95df7d07835bf (diff)
downloadmongo-7015b211d931cd6d456094e1abe3b68cc28c6e46.tar.gz
avoid "unused local variable" warnings from g++
-rw-r--r--src/mongo/util/scopeguard.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/util/scopeguard.h b/src/mongo/util/scopeguard.h
index b87a4b51871..8ced04f47fc 100644
--- a/src/mongo/util/scopeguard.h
+++ b/src/mongo/util/scopeguard.h
@@ -421,7 +421,12 @@ namespace mongo
#define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2)
#define LOKI_ANONYMOUS_VARIABLE(str) LOKI_CONCATENATE(str, __LINE__)
-#define ON_BLOCK_EXIT ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = MakeGuard
-#define ON_BLOCK_EXIT_OBJ ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = MakeObjGuard
+#ifdef __GNUC__
+#define ON_BLOCK_EXIT ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) __attribute__ ((unused)) = MakeGuard
+#define ON_BLOCK_EXIT_OBJ ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) __attribute__ ((unused)) = MakeObjGuard
+#else
+#define ON_BLOCK_EXIT ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = MakeGuard
+#define ON_BLOCK_EXIT_OBJ ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = MakeObjGuard
+#endif
#endif //LOKI_SCOPEGUARD_H_