ib_srp: Let compiler ignore the useless debug code
Subsystems (2)
PATCH 1/1 ib_srp: Let compiler ignore the useless debug code
"if (0)" is used to make this block of debug code not be executed. There is a more elegant way to let compiler ignore this code, using "#if 0 .. #endif" instead.
Although it may be optimised by some compilers with specified parameter, just for readable.
--- drivers/infiniband/ulp/srp/ib_srp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +6 -6
@@ -2023,12 +2023,12 @@ static void srp_recv_done(struct ib_cq *cq, struct ib_wc *wc) opcode = *(u8 *) iu->buf; -if (0 ) { -shost_printk (KERN_ERR , target->scsi_host, -PFX "recv completion, opcode 0x%02x\n" , opcode); -print_hex_dump (KERN_ERR ,"" ,DUMP_PREFIX_OFFSET ,8 ,1 , - iu->buf, wc->byte_len, true); - } +#if 0 +shost_printk (KERN_ERR , target->scsi_host, +PFX "recv completion, opcode 0x%02x\n" , opcode); +print_hex_dump (KERN_ERR ,"" ,DUMP_PREFIX_OFFSET ,8 ,1 , + iu->buf, wc->byte_len, true); +#endif switch (opcode) {case SRP_RSP :
Signature · 1 line
2.10.1 (Apple Git-78)
Quoted 6 lines · Minfei Huang
"if (0)" is used to make this block of debug code not be executed. There is a more elegant way to let compiler ignore this code, using "#if 0 .. #endif" instead.
Although it may be optimised by some compilers with specified parameter, just for readable.
#if 0 / #endif prevents the compiler from checking the syntax of the code. Such code tends to grow syntax errors. So I'm not sure this patch is an improvement.
Bart.
Quoted 11 lines · Bart Van Assche
Quoted 6 lines · Minfei Huang
"if (0)" is used to make this block of debug code not be executed. There is a more elegant way to let compiler ignore this code, using "#if 0 .. #endif" instead.
Although it may be optimised by some compilers with specified parameter, just for readable.
#if 0 / #endif prevents the compiler from checking the syntax of the code. Such code tends to grow syntax errors. So I'm not sure this patch is an improvement.
Agree and especially without support of bloat-o-meter, all these talks about dumb compiler are not informative.
Quoted 2 lines
Bart.