All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl@pobox.com>
To: Matt Domsch <Matt_Domsch@dell.com>
Cc: "Moore, Eric Dean" <Eric.Moore@lsil.com>,
	Olaf Hering <olh@suse.de>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org,
	James Bottomley <James.Bottomley@SteelEye.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 22/82] remove linux/version.h from drivers/message/fus ion
Date: Wed, 20 Jul 2005 12:54:09 -0500	[thread overview]
Message-ID: <20050720175409.GB1573@otto> (raw)
In-Reply-To: <20050720031249.GA18042@humbolt.us.dell.com>

Matt Domsch wrote:
> On Tue, Jul 19, 2005 at 06:07:41PM -0600, Moore, Eric Dean wrote:
> > On Tuesday, July 12, 2005 8:17 PM, Matt Domsch wrote:
> > > In general, this construct:
> > > 
> > > > > -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6))
> > > > > -static int inline scsi_device_online(struct scsi_device *sdev)
> > > > > -{
> > > > > -	return sdev->online;
> > > > > -}
> > > > > -#endif
> > > 
> > > is better tested as:
> > > 
> > > #ifndef scsi_device_inline
> > > static int inline scsi_device_online(struct scsi_device *sdev)
> > > {
> > >     return sdev->online;
> > > }
> > > #endif
> > > 
> > > when you can.  It cleanly eliminates the version test, and tests for
> > > exactly what you're looking for - is this function defined.
> > > 
> > 
> > What you illustrated above is not going to work.
> > If your doing #ifndef around a function, such as scsi_device_online, it's
> > not going to compile
> > when scsi_device_online is already implemented in the kernel tree.
> > The routine scsi_device_online is a function, not a define.  For a define
> > this would work.
> 
> Sure it does, function names are defined symbols.
> 

$ cat foo.c
static int foo(void) { return 0; }
#ifndef foo
static int foo(void) { return 0; }
#endif

$ gcc -c foo.c
foo.c:3: error: redefinition of 'foo'
foo.c:1: error: previous definition of 'foo' was here

I believe #ifdef/#ifndef can test only preprocessor symbols.

Nathan

  parent reply	other threads:[~2005-07-20 17:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-20  0:07 [PATCH 22/82] remove linux/version.h from drivers/message/fus ion Moore, Eric Dean
2005-07-20  3:12 ` Matt Domsch
2005-07-20  4:28   ` Stephen Rothwell
2005-07-20  5:09   ` Moore, Eric Moore
2005-07-20  5:09     ` Moore, Eric Moore
2005-07-20  8:30   ` Bernd Petrovitsch
2005-07-20 12:48   ` Matthew Wilcox
2005-07-20 17:54   ` Nathan Lynch [this message]
2005-07-20 18:22     ` Matt Domsch
2005-07-20 17:55 ` Nish Aravamudan
  -- strict thread matches above, loose matches on Subject: below --
2005-07-13 15:11 Moore, Eric Dean
2005-07-12 22:34 Moore, Eric Dean
2005-07-12 20:50 Moore, Eric Dean
2005-07-12 20:56 ` Tom Duffy
2005-07-12 22:14 ` David S. Miller
2005-07-11  0:15 Moore, Eric Dean
2005-07-12 20:30 ` Tom Duffy
2005-07-13  2:16 ` Matt Domsch
2005-07-13 14:37   ` Christoph Hellwig

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=20050720175409.GB1573@otto \
    --to=ntl@pobox.com \
    --cc=Eric.Moore@lsil.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=Matt_Domsch@dell.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=olh@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.