LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fs/coda: remove static inline forward declarations
@ 2008-02-13 12:22 Ilpo Järvinen
  2008-02-13 13:43 ` linux-os (Dick Johnson)
  2008-02-13 14:24 ` Jan Harkes
  0 siblings, 2 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2008-02-13 12:22 UTC (permalink / raw)
  To: jaharkes; +Cc: Andrew Morton, LKML

[-- Attachment #1: Type: TEXT/PLAIN, Size: 890 bytes --]

They're defined later on in the same file with bodies and
nothingin between needs them.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 include/linux/coda_linux.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 1c47a34..31b7531 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 int coda_setattr(struct dentry *, struct iattr *);
 
 /* this file:  heloers */
-static __inline__ struct CodaFid *coda_i2f(struct inode *);
-static __inline__ char *coda_i2s(struct inode *);
-static __inline__ void coda_flag_inode(struct inode *, int flag);
 char *coda_f2s(struct CodaFid *f);
 int coda_isroot(struct inode *i);
 int coda_iscontrol(const char *name, size_t length);
-- 
1.5.2.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fs/coda: remove static inline forward declarations
  2008-02-13 12:22 [PATCH] fs/coda: remove static inline forward declarations Ilpo Järvinen
@ 2008-02-13 13:43 ` linux-os (Dick Johnson)
  2008-02-13 14:15   ` Ilpo Järvinen
  2008-02-13 14:54   ` Pekka Enberg
  2008-02-13 14:24 ` Jan Harkes
  1 sibling, 2 replies; 6+ messages in thread
From: linux-os (Dick Johnson) @ 2008-02-13 13:43 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: jaharkes, Andrew Morton, LKML


On Wed, 13 Feb 2008, [iso-8859-1] Ilpo Järvinen wrote:

> They're defined later on in the same file with bodies and
> nothingin between needs them.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> ---
> include/linux/coda_linux.h |    3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
> index 1c47a34..31b7531 100644
> --- a/include/linux/coda_linux.h
> +++ b/include/linux/coda_linux.h
> @@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
> int coda_setattr(struct dentry *, struct iattr *);
>
> /* this file:  heloers */
> -static __inline__ struct CodaFid *coda_i2f(struct inode *);
> -static __inline__ char *coda_i2s(struct inode *);
> -static __inline__ void coda_flag_inode(struct inode *, int flag);
> char *coda_f2s(struct CodaFid *f);
> int coda_isroot(struct inode *i);
> int coda_iscontrol(const char *name, size_t length);
> -- 
> 1.5.2.2
>

I was taught formally that all procedures must be declared
before they are encountered in a file. This constitutes what
is generally known as "good standards of engineering practice."
It also guarantees a compiler diagnostic if the declaration and
the function doesn't match.

You should not remove things just because you don't think they
are necessary. They do no harm and removing them can cause
code checking tools to issue diagnostic messages.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.22.1 on an i686 machine (5588.28 BogoMips).
My book : http://www.AbominableFirebug.com/
_

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fs/coda: remove static inline forward declarations
  2008-02-13 13:43 ` linux-os (Dick Johnson)
@ 2008-02-13 14:15   ` Ilpo Järvinen
  2008-02-13 15:55     ` linux-os (Dick Johnson)
  2008-02-13 14:54   ` Pekka Enberg
  1 sibling, 1 reply; 6+ messages in thread
From: Ilpo Järvinen @ 2008-02-13 14:15 UTC (permalink / raw)
  To: linux-os (Dick Johnson); +Cc: jaharkes, Andrew Morton, LKML

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2771 bytes --]

On Wed, 13 Feb 2008, linux-os (Dick Johnson) wrote:
> 
> On Wed, 13 Feb 2008, [iso-8859-1] Ilpo Järvinen wrote:
> 
> > They're defined later on in the same file with bodies and
> > nothingin between needs them.
> >
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> > ---
> > include/linux/coda_linux.h |    3 ---
> > 1 files changed, 0 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
> > index 1c47a34..31b7531 100644
> > --- a/include/linux/coda_linux.h
> > +++ b/include/linux/coda_linux.h
> > @@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
> > int coda_setattr(struct dentry *, struct iattr *);
> >
> > /* this file:  heloers */
> > -static __inline__ struct CodaFid *coda_i2f(struct inode *);
> > -static __inline__ char *coda_i2s(struct inode *);
> > -static __inline__ void coda_flag_inode(struct inode *, int flag);
> > char *coda_f2s(struct CodaFid *f);
> > int coda_isroot(struct inode *i);
> > int coda_iscontrol(const char *name, size_t length);
> > -- 
> > 1.5.2.2
> >
> 
> I was taught formally that all procedures must be declared
> before they are encountered in a file. This constitutes what
> is generally known as "good standards of engineering practice."
> It also guarantees a compiler diagnostic if the declaration and
> the function doesn't match.

They still are declared before they are used (the other two functions are 
similar to this randomly picked example):

$ grep "coda_i2f" include/linux/coda_linux.h 
static __inline__ struct CodaFid *coda_i2f(struct inode *);
static __inline__ struct CodaFid *coda_i2f(struct inode *inode)

I removed the first one of these. The latter is followed by the body of 
the function.

By using some fuzzy word like "encountered" you just make your point 
obscure enough so that I cannot follow what you're trying to say. If you 
refer to use of the function by "encountering", then that property is 
still maintained and we still get all the type-checking and so on (even 
after this removal). 

> You should not remove things just because you don't think they
> are necessary. They do no harm and removing them can cause
> code checking tools to issue diagnostic messages.

Do you really think so? I mean in this specific case, did you even 
bothered to check the file before hitting the send button? ...I just fail 
to see what is your point in keeping these three because they're declared
later on in the same file, though with the body at that time. Do you also 
claim that all the other ~5000+ static inlines with body in kernel headers 
(but not forward declared) are not following those "good standards" you're 
asking for (they certainly won't issue extra diagnostic messages)?


-- 
 i.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fs/coda: remove static inline forward declarations
  2008-02-13 12:22 [PATCH] fs/coda: remove static inline forward declarations Ilpo Järvinen
  2008-02-13 13:43 ` linux-os (Dick Johnson)
@ 2008-02-13 14:24 ` Jan Harkes
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Harkes @ 2008-02-13 14:24 UTC (permalink / raw)
  To: Ilpo J?rvinen; +Cc: Andrew Morton, LKML

On Wed, Feb 13, 2008 at 02:22:43PM +0200, Ilpo J?rvinen wrote:
> They're defined later on in the same file with bodies and
> nothingin between needs them.
> 
> Signed-off-by: Ilpo J?rvinen <ilpo.jarvinen@helsinki.fi>
Acked-by: Jan Harkes <jaharkes@cs.cmu.edu>

Looks good, getting rid of such cruft is always useful.

Jan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fs/coda: remove static inline forward declarations
  2008-02-13 13:43 ` linux-os (Dick Johnson)
  2008-02-13 14:15   ` Ilpo Järvinen
@ 2008-02-13 14:54   ` Pekka Enberg
  1 sibling, 0 replies; 6+ messages in thread
From: Pekka Enberg @ 2008-02-13 14:54 UTC (permalink / raw)
  To: linux-os (Dick Johnson); +Cc: Ilpo Järvinen, jaharkes, Andrew Morton, LKML

On Feb 13, 2008 3:43 PM, linux-os (Dick Johnson) <linux-os@analogic.com> wrote:
> You should not remove things just because you don't think they
> are necessary. They do no harm and removing them can cause
> code checking tools to issue diagnostic messages.

Err, no, Ilpo's patch looks good and the redundant declarations should
be removed. Andrew, please queue up this patch.

Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fs/coda: remove static inline forward declarations
  2008-02-13 14:15   ` Ilpo Järvinen
@ 2008-02-13 15:55     ` linux-os (Dick Johnson)
  0 siblings, 0 replies; 6+ messages in thread
From: linux-os (Dick Johnson) @ 2008-02-13 15:55 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: jaharkes, Andrew Morton, LKML


On Wed, 13 Feb 2008, [iso-8859-1] Ilpo Järvinen wrote:

> On Wed, 13 Feb 2008, linux-os (Dick Johnson) wrote:
>>
>> On Wed, 13 Feb 2008, [iso-8859-1] Ilpo Järvinen wrote:
>>
>>> They're defined later on in the same file with bodies and
>>> nothingin between needs them.
>>>
>>> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
>>> ---
>>> include/linux/coda_linux.h |    3 ---
>>> 1 files changed, 0 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
>>> index 1c47a34..31b7531 100644
>>> --- a/include/linux/coda_linux.h
>>> +++ b/include/linux/coda_linux.h
>>> @@ -43,9 +43,6 @@ int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
>>> int coda_setattr(struct dentry *, struct iattr *);
>>>
>>> /* this file:  heloers */
>>> -static __inline__ struct CodaFid *coda_i2f(struct inode *);
>>> -static __inline__ char *coda_i2s(struct inode *);
>>> -static __inline__ void coda_flag_inode(struct inode *, int flag);
>>> char *coda_f2s(struct CodaFid *f);
>>> int coda_isroot(struct inode *i);
>>> int coda_iscontrol(const char *name, size_t length);
>>> --
>>> 1.5.2.2
>>>
>>
>> I was taught formally that all procedures must be declared
>> before they are encountered in a file. This constitutes what
>> is generally known as "good standards of engineering practice."
>> It also guarantees a compiler diagnostic if the declaration and
>> the function doesn't match.
>
> They still are declared before they are used (the other two functions are
> similar to this randomly picked example):
>
> $ grep "coda_i2f" include/linux/coda_linux.h
> static __inline__ struct CodaFid *coda_i2f(struct inode *);
> static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
>
> I removed the first one of these. The latter is followed by the body of
> the function.
>
> By using some fuzzy word like "encountered" you just make your point
> obscure enough so that I cannot follow what you're trying to say. If you
> refer to use of the function by "encountering", then that property is
> still maintained and we still get all the type-checking and so on (even
> after this removal).
>
>> You should not remove things just because you don't think they
>> are necessary. They do no harm and removing them can cause
>> code checking tools to issue diagnostic messages.
>
> Do you really think so? I mean in this specific case, did you even
> bothered to check the file before hitting the send button? ...I just fail
> to see what is your point in keeping these three because they're declared
> later on in the same file, though with the body at that time. Do you also
> claim that all the other ~5000+ static inlines with body in kernel headers
> (but not forward declared) are not following those "good standards" you're
> asking for (they certainly won't issue extra diagnostic messages)?
>
>
> -- 
> i.
>

Have you EVER seen the diagnostic message, "function is not a prototype?"

It's rhetorical. You don't have to answer. Furthermore "encountered" is
not fuzzy.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.22.1 on an i686 machine (5588.28 BogoMips).
My book : http://www.AbominableFirebug.com/
_

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-13 15:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-13 12:22 [PATCH] fs/coda: remove static inline forward declarations Ilpo Järvinen
2008-02-13 13:43 ` linux-os (Dick Johnson)
2008-02-13 14:15   ` Ilpo Järvinen
2008-02-13 15:55     ` linux-os (Dick Johnson)
2008-02-13 14:54   ` Pekka Enberg
2008-02-13 14:24 ` Jan Harkes

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).