[lkml]   [2002]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Modern C standard (C99) defines __FUNCTION__ as if immediately after
function open brace string with function name is declared. Thus, it's
invalid to use string concatenations like __FILE__ ":" __FUNCTION__.

Gcc 3.03 gives warning for such use of __FUNCTION__. Before this
warnings become error, it's worth to fix this in the kernel source.

I found tons of improper __FUNCTION__ usage in USB drivers. I am not to
say, USB is the only place, I just started with it. In USB, typical use
is with dbg() and alike macros. dbg() defined in usb.h as follows:

#define dbg(format, arg...) printk(KERN_DEBUG __FILE__ ": " format "\n"
, ## arg)

In source it is usually used like

dbg(__FUNCTION__ " endpoint %d\n", usb_pipeendpoint(this_urb->pipe));

I propose modification for dbg() and friends like

#define dbg(format, arg...) printk(KERN_DEBUG __FILE__ ":%s - " format
"\n", __FUNCTION__, ## arg)

This will enable the same usage, but will incorporate __FUNCTION__ in
the common message prefix. This centralization will force function name
in all messages, and make it easy to fix code. Code will be shorter and
cleaner. It may be worth to (#ifdef MODULE) add module name to message

Any comments?

Please, when replying, CC me:

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:15    [W:0.080 / U:39.856 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site