public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
To: linux-kernel@vger.kernel.org
Subject: __FUNCTION__
Date: Tue, 08 Jan 2002 23:36:11 +0200	[thread overview]
Message-ID: <3C3B664B.3060103@intel.com> (raw)

Hello,
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 
prefix.

Any comments?

Please, when replying, CC me: mailto:vladimir.kondratiev@intel.com




             reply	other threads:[~2002-01-08 21:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-08 21:36 Vladimir Kondratiev [this message]
2002-01-08 21:59 ` __FUNCTION__ Ian S. Nelson
2002-01-08 22:17   ` __FUNCTION__ Greg KH
2002-01-08 23:09   ` __FUNCTION__ Vladimir Kondratiev
2002-01-08 22:01 ` __FUNCTION__ Greg KH
2002-01-08 22:56   ` __FUNCTION__ jtv
2002-01-08 23:11     ` __FUNCTION__ Greg KH
2002-01-08 23:39       ` __FUNCTION__ David Weinehall
2002-01-08 23:51         ` __FUNCTION__ Andrew Morton
2002-01-09  0:04           ` __FUNCTION__ David Weinehall
2002-01-09  0:14             ` __FUNCTION__ Andrew Morton
2002-01-09  0:23           ` __FUNCTION__ Anton Altaparmakov
2002-01-08 23:42       ` __FUNCTION__ jtv
2002-01-09  2:12       ` __FUNCTION__ Richard Henderson
2002-01-09  7:23         ` __FUNCTION__ Greg KH
2002-01-09  7:32           ` __FUNCTION__ Neil Booth
2002-01-09 22:35           ` __FUNCTION__ Richard Henderson
2002-01-09  9:05       ` __FUNCTION__ Martin Dalecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C3B664B.3060103@intel.com \
    --to=vladimir.kondratiev@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox