stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r516221 - /incubator/stdcxx/trunk/tests/self/0.printf.cpp
Date Thu, 08 Mar 2007 23:22:41 GMT
Author: sebor
Date: Thu Mar  8 15:22:38 2007
New Revision: 516221

URL: http://svn.apache.org/viewvc?view=rev&rev=516221
Log:
2007-03-08  Martin Sebor  <sebor@roguewave.com>

	* 0.printf.cpp (TEST_SPEC): Introduced a local variable to silence
	compiler warnings about controlling expression being constant.

Modified:
    incubator/stdcxx/trunk/tests/self/0.printf.cpp

Modified: incubator/stdcxx/trunk/tests/self/0.printf.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/self/0.printf.cpp?view=diff&rev=516221&r1=516220&r2=516221
==============================================================================
--- incubator/stdcxx/trunk/tests/self/0.printf.cpp (original)
+++ incubator/stdcxx/trunk/tests/self/0.printf.cpp Thu Mar  8 15:22:38 2007
@@ -126,10 +126,13 @@
         sprintf (fmt, "%s%c", pfx, spec);                               \
         char* const s0 = rw_sprintfa (fmt, a1, a2, a3);                 \
         char buf [256];                                                 \
-        if (!(expect))                                                  \
-            sprintf (buf, fmt, a1, a2, a3);                             \
+        /* variable below avoids warnings about controlling */          \
+        /* expression being constant */                                 \
+        const char* const expect_var = (expect);                        \
+        if (expect_var)                                                 \
+            strcpy (buf, expect_var ? expect_var : "");                 \
         else                                                            \
-            strcpy (buf, (expect) ? (expect) : "");                     \
+            sprintf (buf, fmt, a1, a2, a3);                             \
         const int result = memcmp (buf, s0, strlen (buf) + 1);          \
         if (result) {                                                   \
            ++nfailures;                                                 \



Mime
View raw message