diff mbox

[FFmpeg-devel] lsws/utils: Split "emms_c(); " call in two lines

Message ID CAB0OVGr7bOQR6Tssxqx4dARi6R+P0QASFzg9vT+UwrWMxzz6sA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Dec. 17, 2018, 7:43 p.m. UTC
2018-12-17 16:45 GMT+01:00, Nicolas George <george@nsup.org>:
> Carl Eugen Hoyos (2018-12-17):
>>  #ifndef emms_c
>> -#   define emms_c() while(0)
>> +#   define emms_c() while(0){}
>>  #endif
>
> That feels really wrong, or at least completely unusual. But not the
> change you made, the original code: the usual statement is:
> "do { statement } while (0)"
>
> And if you make that change, you will get a warning about a semicolon
> after a braced block.
>
> I suggest to change the definition to
>
> #define emms_c() do { } while (0)

New patch attached.

Thank you, Carl Eugen

Comments

Carl Eugen Hoyos Dec. 19, 2018, 2:55 p.m. UTC | #1
2018-12-17 20:43 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 2018-12-17 16:45 GMT+01:00, Nicolas George <george@nsup.org>:
>> Carl Eugen Hoyos (2018-12-17):
>>>  #ifndef emms_c
>>> -#   define emms_c() while(0)
>>> +#   define emms_c() while(0){}
>>>  #endif
>>
>> That feels really wrong, or at least completely unusual. But not the
>> change you made, the original code: the usual statement is:
>> "do { statement } while (0)"
>>
>> And if you make that change, you will get a warning about a semicolon
>> after a braced block.
>>
>> I suggest to change the definition to
>>
>> #define emms_c() do { } while (0)
>
> New patch attached.

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From 651baa2d7ec1a163dc00adf1885146b0938745e3 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Mon, 17 Dec 2018 20:33:24 +0100
Subject: [PATCH] lavu/internal: Replace an empty loop with "do {}".

Silences a clang warning when not compiling for x86:
libswscale/utils.c:345:13: warning: while loop has empty body

Suggested-by: Nicolas George
---
 libavutil/internal.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 06bd561..4acbcf5 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -52,7 +52,7 @@ 
 #endif
 
 #ifndef emms_c
-#   define emms_c() while(0)
+#   define emms_c() do {} while(0)
 #endif
 
 #ifndef attribute_align_arg
-- 
1.7.10.4