Edward Tomasz Napierala wrote this message on Tue, Mar 25, 2014 at 18:30 +0000:
> Author: trasz
> Date: Tue Mar 25 18:30:57 2014
> New Revision: 263740
> URL: http://svnweb.freebsd.org/changeset/base/263740
>
> Log:
> Use a less unusual syntax in debug printfs.
Just for reference, this is partly a bug fix...
if { xxx } while (0)
is two statements, and if you tried to use the macros as such:
if (something)
MACRO(param)
else
somethingelse;
You would get a compile error:
t.c:11: error: expected expression before 'else'
Now it'll compile properly...
Thanks for the fix!
> @@ -98,29 +98,38 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO
> &maxcmdsn_delta, 256, "Number of commands the initiator can send "
> "without confirmation");
>
> -#define CFISCSI_DEBUG(X, ...) \
> - if (debug > 1) { \
> - printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
> +#define CFISCSI_DEBUG(X, ...)
> \
> + do { \
> + if (debug > 1) { \
> + printf("%s: " X "\n", \
> + __func__, ## __VA_ARGS__); \
> + } \
> } while (0)
>
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"