[PATCH] Properly encapsulate multi-statement macro.

Hans-Bernhard Bröker HBBroeker@t-online.de
Thu Feb 27 19:47:00 GMT 2020


  winsup/cygwin/fhandler_console.cc | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc 
b/winsup/cygwin/fhandler_console.cc
index 4ab9bcab8..353abd197 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -63,10 +63,11 @@ static struct fhandler_base::rabuf_t con_ra;
  static unsigned char wpbuf[WPBUF_LEN];
  static int wpixput;
  static unsigned char last_char;
-#define wpbuf_put(x) \
+#define wpbuf_put(x) do { \
    wpbuf[wpixput++] = x; \
    if (wpixput > WPBUF_LEN) \
-    wpixput--;
+    wpixput--; \
+} while(0)

  static void
  beep ()
--
2.21.0



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list