[PATCH] debug: Add braces around empty body in an 'if' statement

I have below code in my cc.h:

 #ifdef MYSDK_LWIP_DEBUG
 #define LWIP_PLATFORM_ASSERT(x) MYSDK_ASSERTION_FAIL_ACTION()
 #else
 #define LWIP_PLATFORM_ASSERT(x)
 #endif /* ifdef MYSDK_LWIP_DEBUG */

I got below error when in non-debug build:
src/include/lwip/debug.h:76:32: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
   LWIP_PLATFORM_ASSERT(message); } while(0)
                                ^
Fix the build error by adding braces around empty body in an 'if' statement.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: sg <goldsimon@gmx.de>
This commit is contained in:
Axel Lin 2016-08-09 21:52:13 +02:00 committed by sg
parent 5c0944e01a
commit 18fcc1d504

View File

@ -72,8 +72,8 @@
* -- To disable assertions define LWIP_NOASSERT in arch/cc.h.
*/
#ifndef LWIP_NOASSERT
#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \
LWIP_PLATFORM_ASSERT(message); } while(0)
#define LWIP_ASSERT(message, assertion) do { if (!(assertion)) { \
LWIP_PLATFORM_ASSERT(message); }} while(0)
#ifndef LWIP_PLATFORM_ASSERT
#error "If you want to use LWIP_ASSERT, LWIP_PLATFORM_ASSERT(message) needs to be defined in your arch/cc.h"
#endif