Single-statement macros should not use do { } while (0)

From: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4557 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-10-10 02:57:07 +00:00
parent 73c992f7dd
commit 0b8bd29208
2 changed files with 17 additions and 50 deletions

View File

@@ -50,10 +50,8 @@ do { \
changed; \
})
#define GET_PARAM(params, info, iparams, word) \
do { \
(iparams)[key_##word] = (params)->word; \
} while (0)
#define GET_PARAM(params, info, iparams, word) \
(iparams)[key_##word] = (params)->word
const char *iscsi_get_bool_value(int val)
{

View File

@@ -220,34 +220,24 @@ do { \
} while (0)
#define PRINT_LOG_FLAG(log_flag, format, args...) \
do { \
debug_print_with_prefix(trace_flag, KERN_INFO, __LOG_PREFIX, \
__func__, __LINE__, format, ## args); \
} while (0)
__func__, __LINE__, format, ## args)
#define PRINT_WARNING(format, args...) \
do { \
debug_print_with_prefix(trace_flag, KERN_WARNING, __LOG_PREFIX, \
__func__, __LINE__, "***WARNING***: " format, ## args); \
} while (0)
__func__, __LINE__, "***WARNING***: " format, ## args)
#define PRINT_ERROR(format, args...) \
do { \
debug_print_with_prefix(trace_flag, KERN_ERR, __LOG_PREFIX, \
__func__, __LINE__, "***ERROR***: " format, ## args); \
} while (0)
__func__, __LINE__, "***ERROR***: " format, ## args)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
debug_print_with_prefix(trace_flag, KERN_CRIT, __LOG_PREFIX, \
__func__, __LINE__, "***CRITICAL ERROR***: " format, ## args); \
} while (0)
__func__, __LINE__, "***CRITICAL ERROR***: " format, ## args)
#define PRINT_INFO(format, args...) \
do { \
debug_print_with_prefix(trace_flag, KERN_INFO, __LOG_PREFIX, \
__func__, __LINE__, format, ## args); \
} while (0)
__func__, __LINE__, format, ## args)
#ifndef GENERATING_UPSTREAM_PATCH
#define TRACE_ENTRY() \
@@ -328,52 +318,31 @@ do { \
#ifdef LOG_PREFIX
#define PRINT_INFO(format, args...) \
do { \
PRINT(KERN_INFO, "%s: " format, LOG_PREFIX, ## args); \
} while (0)
PRINT(KERN_INFO, "%s: " format, LOG_PREFIX, ## args)
#define PRINT_WARNING(format, args...) \
do { \
PRINT(KERN_WARNING, "%s: ***WARNING***: " \
format, LOG_PREFIX, ## args); \
} while (0)
#define PRINT_WARNING(format, args...) \
PRINT(KERN_WARNING, "%s: ***WARNING***: " format, LOG_PREFIX, ## args)
#define PRINT_ERROR(format, args...) \
do { \
PRINT(KERN_ERR, "%s: ***ERROR***: " \
format, LOG_PREFIX, ## args); \
} while (0)
#define PRINT_ERROR(format, args...) \
PRINT(KERN_ERR, "%s: ***ERROR***: " format, LOG_PREFIX, ## args)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
PRINT(KERN_CRIT, "%s: ***CRITICAL ERROR***: " \
format, LOG_PREFIX, ## args); \
} while (0)
format, LOG_PREFIX, ## args)
#else
#define PRINT_INFO(format, args...) \
do { \
PRINT(KERN_INFO, format, ## args); \
} while (0)
PRINT(KERN_INFO, format, ## args)
#define PRINT_WARNING(format, args...) \
do { \
PRINT(KERN_WARNING, "***WARNING***: " \
format, ## args); \
} while (0)
PRINT(KERN_WARNING, "***WARNING***: " format, ## args)
#define PRINT_ERROR(format, args...) \
do { \
PRINT(KERN_ERR, "***ERROR***: " \
format, ## args); \
} while (0)
PRINT(KERN_ERR, "***ERROR***: " format, ## args)
#define PRINT_CRIT_ERROR(format, args...) \
do { \
PRINT(KERN_CRIT, "***CRITICAL ERROR***: " \
format, ## args); \
} while (0)
PRINT(KERN_CRIT, "***CRITICAL ERROR***: " format, ## args)
#endif /* LOG_PREFIX */