summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-06-15 18:24:18 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-06-15 18:24:18 +0400
commite870802a19c103302aaac993c40419ba34d3ff3d (patch)
tree61b423ea900d9e51c22dfd5f11fa31b24309bbb1 /tests
parentd5a5bbf9e41d22d88f3ac1b2734bc182e1b1974f (diff)
downloadbdwgc-e870802a19c103302aaac993c40419ba34d3ff3d.tar.gz
test_cpp: Suppress GCC warnings in WinMain
* tests/test_cpp.cc (ATTR_UNUSED): New macro. * tests/test_cpp.cc (WinMain): Tag "instance", "prev" and "cmdShow" arguments with ATTR_UNUSED. * tests/test_cpp.cc (WinMain): Explicitly cast "xio", "f", "d", "a" local variables to void (to suppress "variable set but not used" compiler warning).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cpp.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc
index f1393729..597d8088 100644
--- a/tests/test_cpp.cc
+++ b/tests/test_cpp.cc
@@ -70,6 +70,11 @@ extern "C" {
__LINE__ ); \
exit( 1 ); }
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# define ATTR_UNUSED __attribute__((__unused__))
+#else
+# define ATTR_UNUSED /* empty */
+#endif
class A {public:
/* An uncollectable class. */
@@ -187,8 +192,8 @@ void* Undisguise( GC_word i ) {
return (void*) ~ i;}
#ifdef MSWIN32
-int APIENTRY WinMain(
- HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int cmdShow )
+int APIENTRY WinMain( HINSTANCE instance ATTR_UNUSED,
+ HINSTANCE prev ATTR_UNUSED, LPSTR cmd, int cmdShow ATTR_UNUSED )
{
int argc;
char* argv[ 3 ];
@@ -212,6 +217,7 @@ int APIENTRY WinMain(
int *x = gc_allocator<int>().allocate(1);
int *xio;
xio = gc_allocator_ignore_off_page<int>().allocate(1);
+ (void)xio;
int **xptr = traceable_allocator<int *>().allocate(1);
# else
int *x = (int *)gc_alloc::allocate(sizeof(int));
@@ -245,7 +251,9 @@ int APIENTRY WinMain(
D* d;
F* f;
d = ::new (USE_GC, D::CleanUp, (void*)(GC_word)i) D( i );
+ (void)d;
f = new F;
+ (void)f;
if (0 == i % 10) delete c;}
/* Allocate a very large number of collectable As and Bs and
@@ -254,6 +262,7 @@ int APIENTRY WinMain(
for (i = 0; i < 1000000; i++) {
A* a;
a = new (USE_GC) A( i );
+ (void)a;
B* b = new B( i );
b = new (USE_GC) B( i );
if (0 == i % 10) {