From 91cdaf7ccae1fc5cb637659b47aa4330fabfbd81 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 4 Jan 2008 21:32:19 +0000 Subject: [PATCH] Fixed warnings on 64-bit platforms. --- src/libCom/test/epicsExceptionTest.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libCom/test/epicsExceptionTest.cpp b/src/libCom/test/epicsExceptionTest.cpp index a8425a9a3..c87fd65d9 100644 --- a/src/libCom/test/epicsExceptionTest.cpp +++ b/src/libCom/test/epicsExceptionTest.cpp @@ -40,11 +40,15 @@ const nothrow_t nothrow ; # else static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max () - 100; # endif + // passing a size_t to printf() needs "%zu" on some platforms +# define Z_MODIFIER "" #elif defined(vxWorks) // Neither vxWorks 5 or 6 supply true ANSI C++ static const size_t unsuccessfulNewSize = UINT_MAX - 15u; +# define Z_MODIFIER "" #else static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); +# define Z_MODIFIER "z" #endif class exThread : public epicsThreadRunable { @@ -61,10 +65,10 @@ static void epicsExceptionTestPrivate () { try { char * p = new char [unsuccessfulNewSize]; - testFail("new char[%u] returned %p", unsuccessfulNewSize, p); + testFail("new char[%" Z_MODIFIER "u] returned %p", unsuccessfulNewSize, p); } catch ( const bad_alloc & ) { - testPass("new char[%u] threw", unsuccessfulNewSize); + testPass("new char[%" Z_MODIFIER "u] threw", unsuccessfulNewSize); } catch ( ... ) { testFail("new: threw wrong type");