+2011-09-19 Bruno Haible <bruno@clisp.org>
+
+ msvc-inval: Ensure the entire expansion is a single statement.
+ * lib/msvc-inval.h (TRY_MSVC_INVAL, DONE_MSVC_INVAL): Add an extra pair
+ of braces.
+
2011-09-19 Jim Meyering <meyering@redhat.com>
tests: use printf, not echo in init.sh's warn_ function
TRY_MSVC_INVAL
{
<Code that can trigger an invalid parameter notification
- but does not do 'return', 'break', nor 'goto'.>
+ but does not do 'return', 'break', 'continue', nor 'goto'.>
}
CATCH_MSVC_INVAL
{
<Code that handles an invalid parameter notification
- but does not do 'return', 'break', nor 'goto'.>
+ but does not do 'return', 'break', 'continue', nor 'goto'.>
}
DONE_MSVC_INVAL
+
+ This entire block expands to a single statement.
*/
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
# endif
# define TRY_MSVC_INVAL \
- gl_msvc_inval_ensure_handler (); \
- __try
+ { \
+ gl_msvc_inval_ensure_handler (); \
+ __try
# define CATCH_MSVC_INVAL \
- __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
- ? EXCEPTION_EXECUTE_HANDLER \
- : EXCEPTION_CONTINUE_SEARCH)
-# define DONE_MSVC_INVAL
+ __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
+ ? EXCEPTION_EXECUTE_HANDLER \
+ : EXCEPTION_CONTINUE_SEARCH)
+# define DONE_MSVC_INVAL \
+ }
# else
/* Any compiler.
# endif
#else
+/* A platform that does not need to the invalid parameter handler. */
-# define TRY_MSVC_INVAL if (1)
+/* The braces here avoid GCC warnings like
+ "warning: suggest explicit braces to avoid ambiguous `else'". */
+# define TRY_MSVC_INVAL { if (1)
# define CATCH_MSVC_INVAL else
-# define DONE_MSVC_INVAL
+# define DONE_MSVC_INVAL }
#endif