Avoid that compiler warnings depend on the build mode

It is annoying that some warnings are only reported in release mode.
Modify scst_debug.h such that the compiler does not report variables
that are only used in debug builds as unused.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6315 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-06-15 22:15:07 +00:00
parent 15535bf648
commit 7566e2ed71
5 changed files with 31 additions and 18 deletions

View File

@@ -280,9 +280,7 @@ struct iscsi_conn {
struct list_head rd_list_entry;
#ifdef CONFIG_SCST_EXTRACHECKS
struct task_struct *rd_task;
#endif
unsigned long last_rcv_time;

View File

@@ -52,7 +52,7 @@ extern unsigned long iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(
struct iscsi_cmnd *cmnd);
#else
#define iscsi_dump_pdu(x) do {} while (0)
#define iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(x) do {} while (0)
#define iscsi_get_flow_ctrl_or_mgmt_dbg_log_flag(x) 0
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)

View File

@@ -247,6 +247,16 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6)
/*
* See also patch "Add a dummy printk function for the maintenance of unused
* printks" (commit 12fdff3fc2483f906ae6404a6e8dcf2550310b6f).
*/
static inline __attribute__ ((format (printf, 1, 2)))
int no_printk(const char *s, ...) { return 0; }
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
/*
* See also patch "sched: Fix softirq time accounting" (commit ID

View File

@@ -224,9 +224,12 @@ do { \
#define TRACING_MINOR() (false)
#define TRACE(trace, format, args...) do {} while (0)
#define PRINT_BUFFER(message, buff, len) do {} while (0)
#define PRINT_BUFF_FLAG(flag, message, buff, len) do {} while (0)
#define TRACE(trace, format, args...) \
((void)(trace), no_printk(format, ##args))
#define PRINT_BUFFER(message, buff, len) \
((void)(message), (void)(buff), (void)(len))
#define PRINT_BUFF_FLAG(flag, message, buff, len) \
((void)(flag), (void)(message), (void)(buff), (void)(len))
#endif /* CONFIG_SCST_DEBUG || CONFIG_SCST_TRACING */
@@ -353,17 +356,20 @@ do { \
#else /* CONFIG_SCST_DEBUG */
#define TRACE_MEM(format, args...) do {} while (0)
#define TRACE_SG(format, args...) do {} while (0)
#define TRACE_DBG(format, args...) do {} while (0)
#define TRACE_DBG_FLAG(format, args...) do {} while (0)
#define TRACE_DBG_SPECIAL(format, args...) do {} while (0)
#define TRACE_MGMT_DBG(format, args...) do {} while (0)
#define TRACE_MGMT_DBG_SPECIAL(format, args...) do {} while (0)
#define TRACE_MEM(format, args...) no_printk(format, ##args)
#define TRACE_SG(format, args...) no_printk(format, ##args)
#define TRACE_DBG(format, args...) no_printk(format, ##args)
#define TRACE_DBG_FLAG(flag, format, args...) \
((void)(flag), no_printk(format, ##args))
#define TRACE_DBG_SPECIAL(format, args...) no_printk(format, ##args)
#define TRACE_MGMT_DBG(format, args...) no_printk(format, ##args)
#define TRACE_MGMT_DBG_SPECIAL(format, args...) no_printk(format, ##args)
#define TRACE_PR(format, args...) do {} while (0)
#define TRACE_BLOCK(format, args...) do {} while (0)
#define TRACE_BUFFER(message, buff, len) do {} while (0)
#define TRACE_BUFF_FLAG(flag, message, buff, len) do {} while (0)
#define TRACE_BLOCK(format, args...) no_printk(format, ##args)
#define TRACE_BUFFER(message, buff, len) \
((void)(message), (void)(buff), (void)(len))
#define TRACE_BUFF_FLAG(flag, message, buff, len) \
((void)(flag), (void)(message), (void)(buff), (void)(len))
#ifndef GENERATING_UPSTREAM_PATCH
#define TRACE_ENTRY() do {} while (0)

View File

@@ -60,10 +60,9 @@
#include "scst.h"
#endif
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
#define TRACE_ORDER 0x80000000
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)
static struct scst_trace_log vdisk_local_trace_tbl[] = {
{ TRACE_ORDER, "order" },
{ 0, NULL }