2011-09-19 Bruno Haible <bruno@clisp.org>
+ msvc-inval: Require a semicolon after DONE_MSVC_INVAL.
+ * lib/msvc-inval.h (TRY_MSVC_INVAL, DONE_MSVC_INVAL): Wrap in a
+ do...while(0).
+ * lib/dup2.c (rpl_dup2): Add a semicolon after DONE_MSVC_INVAL.
+ Suggested by Paul Eggert.
+
+2011-09-19 Bruno Haible <bruno@clisp.org>
+
sched: Ensure pid_t is defined.
* m4/sched_h.m4 (gl_SCHED_H): Arrange to override <sched.h> if it does
not define pid_t.
<Code that handles an invalid parameter notification
but does not do 'return', 'break', 'continue', nor 'goto'.>
}
- DONE_MSVC_INVAL
+ DONE_MSVC_INVAL;
This entire block expands to a single statement.
*/
# endif
# define TRY_MSVC_INVAL \
- { \
- gl_msvc_inval_ensure_handler (); \
- __try
+ do \
+ { \
+ gl_msvc_inval_ensure_handler (); \
+ __try
# define CATCH_MSVC_INVAL \
- __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
- ? EXCEPTION_EXECUTE_HANDLER \
- : EXCEPTION_CONTINUE_SEARCH)
+ __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
+ ? EXCEPTION_EXECUTE_HANDLER \
+ : EXCEPTION_CONTINUE_SEARCH)
# define DONE_MSVC_INVAL \
- }
+ } \
+ while (0)
# else
/* Any compiler.
# endif
# define TRY_MSVC_INVAL \
- { \
- _invalid_parameter_handler orig_handler; \
- /* First, initialize gl_msvc_inval_restart. */ \
- if (setjmp (gl_msvc_inval_restart) == 0) \
- { \
- /* Then, enable gl_msvc_invalid_parameter_handler. */ \
- orig_handler = \
- _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
+ do \
+ { \
+ _invalid_parameter_handler orig_handler; \
+ /* First, initialize gl_msvc_inval_restart. */ \
+ if (setjmp (gl_msvc_inval_restart) == 0) \
+ { \
+ /* Then, enable gl_msvc_invalid_parameter_handler. */ \
+ orig_handler = \
+ _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
# define CATCH_MSVC_INVAL \
- /* Execution completed. \
- Disable gl_msvc_invalid_parameter_handler. */ \
- _set_invalid_parameter_handler (orig_handler); \
- } \
- else \
- { \
- /* Execution triggered an invalid parameter notification. \
- Disable gl_msvc_invalid_parameter_handler. */ \
- _set_invalid_parameter_handler (orig_handler);
+ /* Execution completed. \
+ Disable gl_msvc_invalid_parameter_handler. */ \
+ _set_invalid_parameter_handler (orig_handler); \
+ } \
+ else \
+ { \
+ /* Execution triggered an invalid parameter notification. \
+ Disable gl_msvc_invalid_parameter_handler. */ \
+ _set_invalid_parameter_handler (orig_handler);
# define DONE_MSVC_INVAL \
- } \
- }
+ } \
+ } \
+ while (0)
# endif
/* 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 TRY_MSVC_INVAL \
+ do \
+ { \
+ if (1)
+# define CATCH_MSVC_INVAL \
+ else
+# define DONE_MSVC_INVAL \
+ } \
+ while (0)
#endif