From 0b8bd2920890de0de3573446aa7321b431ade2d1 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 10 Oct 2012 02:57:07 +0000 Subject: [PATCH] Single-statement macros should not use do { } while (0) From: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4557 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/param.c | 6 ++-- scst/include/scst_debug.h | 61 ++++++++++----------------------------- 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/iscsi-scst/kernel/param.c b/iscsi-scst/kernel/param.c index ea0318bb8..3089c7f93 100644 --- a/iscsi-scst/kernel/param.c +++ b/iscsi-scst/kernel/param.c @@ -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) { diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index b7d7fcf58..6b4057507 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -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 */