* Re: PCI: Remove "extern" from function declarations
@ 2013-04-17 23:24 Stephen Rothwell
2013-04-17 23:57 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2013-04-17 23:24 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, LKML
[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]
Hi Bjorn,
I just noticed this commit (f39d5b72913e "PCI: Remove "extern" from
function declarations") in the pci next branch. Just wondering why you
would do such a thing. It is a lot of churn in quite a few header files
and (in my opinion) goes the wrong way anyway.
It may not actually make any difference to the compiler for functions, but
for variables, it does. A variable declared in a header file without
"extern" will effectively define it in every compilation that includes
the header file, one with "extern" will only produce references.
So, since, the global variables really should have the "extern", the
functions are now inconsistent with that.
It also means that when someone copies a function declaration to make a
"static inline" stub, the "extern" is a big hint for them to remember to
make the stub "static" - I have seen several occasions when this was not
done and that causes compilation failures (but usually only in the
configuration that the author did not bother to test).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PCI: Remove "extern" from function declarations
2013-04-17 23:24 PCI: Remove "extern" from function declarations Stephen Rothwell
@ 2013-04-17 23:57 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2013-04-17 23:57 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-pci@vger.kernel.org, LKML
On Wed, Apr 17, 2013 at 5:24 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi Bjorn,
>
> I just noticed this commit (f39d5b72913e "PCI: Remove "extern" from
> function declarations") in the pci next branch. Just wondering why you
> would do such a thing. It is a lot of churn in quite a few header files
> and (in my opinion) goes the wrong way anyway.
>
> It may not actually make any difference to the compiler for functions, but
> for variables, it does. A variable declared in a header file without
> "extern" will effectively define it in every compilation that includes
> the header file, one with "extern" will only produce references.
>
> So, since, the global variables really should have the "extern", the
> functions are now inconsistent with that.
>
> It also means that when someone copies a function declaration to make a
> "static inline" stub, the "extern" is a big hint for them to remember to
> make the stub "static" - I have seen several occasions when this was not
> done and that causes compilation failures (but usually only in the
> configuration that the author did not bother to test).
Good points. The fact that some function declarations use "extern"
and some don't is just an annoying inconsistency. I prefer fewer
words to read, so I removed them, but that's just a personal
preference, and I'd be OK it were always present, too. I suppose if
anybody but me actually cared very much, we'd have checkpatch complain
about one way or the other, but I don't think it does.
Bjorn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-17 23:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-17 23:24 PCI: Remove "extern" from function declarations Stephen Rothwell
2013-04-17 23:57 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).