[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting EBADF on MSVC
From: |
Bruno Haible |
Subject: |
Re: getting EBADF on MSVC |
Date: |
Mon, 19 Sep 2011 23:30:14 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
> The approach has the big advantage that you can step through the code in a
> debugger,
And that syntax coloring editors (like vim, emacs, kate) don't get confused.
> and that the entire block expands into a single statement.
I need to realize this promise:
2011-09-19 Bruno Haible <address@hidden>
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.
--- lib/msvc-inval.h.orig Mon Sep 19 23:26:51 2011
+++ lib/msvc-inval.h Mon Sep 19 23:23:05 2011
@@ -29,14 +29,16 @@
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
@@ -77,13 +79,15 @@
# 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.
@@ -140,10 +144,13 @@
# 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
--
In memoriam James A. Garfield <http://en.wikipedia.org/wiki/James_A._Garfield>
- Re: getting EBADF on MSVC, (continued)
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/19
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/20
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/24
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/24
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/25
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/24
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/25
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/25
- Re: getting EBADF on MSVC, Paul Eggert, 2011/09/25
- Re: getting EBADF on MSVC, Bruno Haible, 2011/09/19
- Re: getting EBADF on MSVC,
Bruno Haible <=
Re: getting EBADF on MSVC, Bruno Haible, 2011/09/18
Re: getting EBADF on MSVC, Bruno Haible, 2011/09/23