All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] Re: GCC4 warning: no return statement in function returning
@ 2005-07-01 22:15 Domen Puncer
  2005-07-01 22:22 ` Domen Puncer
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Domen Puncer @ 2005-07-01 22:15 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

On 01/07/05 11:19 -0700, Jesse Millan wrote:
> 

> 
> 
> Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>
> 
> The function kauditd_thread() does not return an integer as the declaration
> says it should. There is no return statement in the body whatsoever and looks
> like the function should have been declared as returning void.
> ---

Can you put Signed-off-by at end of description, I don't think I've
seen it elsewhere often. And please try to make Subjects that are
different for every patch.

> 
> 
> diff -puN kernel/audit.c~audit-patch kernel/audit.c
> --- linux-2.6.13-rc1.kj.jm.gcc4/kernel/audit.c~audit-patch	2005-07-01 10:59:36.417950168 -0700
> +++ linux-2.6.13-rc1.kj.jm.gcc4-jessem/kernel/audit.c	2005-07-01 11:00:52.979311072 -0700
> @@ -275,7 +275,7 @@ static int audit_set_failure(int state, 
>  	return old;
>  }
>  
> -int kauditd_thread(void *dummy)
> +void kauditd_thread(void *dummy)

This should warn too, as kthread_create() (kthread_run()) accepts
int (*threadfn)(void *data)

I think kauditd_thread() should be fixed here to return something...
"The return value should be zero or a negative error number:
 it will be passed to kthread_stop()."

>  {
>  	struct sk_buff *skb;
>  
> _

> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] Re: GCC4 warning: no return statement in function returning
  2005-07-01 22:15 [KJ] Re: GCC4 warning: no return statement in function returning Domen Puncer
@ 2005-07-01 22:22 ` Domen Puncer
  2005-07-01 22:42 ` [KJ] Re: GCC4 warning: no return statement in function randy_dunlap
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Domen Puncer @ 2005-07-01 22:22 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

On 02/07/05 00:15 +0200, Domen Puncer wrote:
> On 01/07/05 11:19 -0700, Jesse Millan wrote:
> > -int kauditd_thread(void *dummy)
> > +void kauditd_thread(void *dummy)
> 
> This should warn too, as kthread_create() (kthread_run()) accepts
> int (*threadfn)(void *data)
> 
> I think kauditd_thread() should be fixed here to return something...
> "The return value should be zero or a negative error number:
>  it will be passed to kthread_stop()."

But it doesn't return at all (d'oh, should have seen this before).
Still... there's a warning if it returns void, right?


	Domen

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] Re: GCC4 warning: no return statement in function
  2005-07-01 22:15 [KJ] Re: GCC4 warning: no return statement in function returning Domen Puncer
  2005-07-01 22:22 ` Domen Puncer
@ 2005-07-01 22:42 ` randy_dunlap
  2005-07-01 22:59 ` [KJ] Re: GCC4 warning: no return statement in function returning Jesse Millan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: randy_dunlap @ 2005-07-01 22:42 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

On Sat, 2 Jul 2005 00:22:51 +0200 Domen Puncer wrote:

| On 02/07/05 00:15 +0200, Domen Puncer wrote:
| > On 01/07/05 11:19 -0700, Jesse Millan wrote:
| > > -int kauditd_thread(void *dummy)
| > > +void kauditd_thread(void *dummy)
| > 
| > This should warn too, as kthread_create() (kthread_run()) accepts
| > int (*threadfn)(void *data)
| > 
| > I think kauditd_thread() should be fixed here to return something...
| > "The return value should be zero or a negative error number:
| >  it will be passed to kthread_stop()."
| 
| But it doesn't return at all (d'oh, should have seen this before).
| Still... there's a warning if it returns void, right?

so it needs 
  __attribute__((noreturn))
added to the function?
(or ATTRIB_NORET)

---
~Randy

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] Re: GCC4 warning: no return statement in function returning
  2005-07-01 22:15 [KJ] Re: GCC4 warning: no return statement in function returning Domen Puncer
  2005-07-01 22:22 ` Domen Puncer
  2005-07-01 22:42 ` [KJ] Re: GCC4 warning: no return statement in function randy_dunlap
@ 2005-07-01 22:59 ` Jesse Millan
  2005-07-07 21:14 ` Jesse Millan
  2005-07-08 18:21 ` [KJ] Re: GCC4 warning: no return statement in function randy_dunlap
  4 siblings, 0 replies; 6+ messages in thread
From: Jesse Millan @ 2005-07-01 22:59 UTC (permalink / raw)
  To: kernel-janitors


Domen Puncer wrote:
> On 02/07/05 00:15 +0200, Domen Puncer wrote:
> 
>>On 01/07/05 11:19 -0700, Jesse Millan wrote:
>>
>>>-int kauditd_thread(void *dummy)
>>>+void kauditd_thread(void *dummy)
>>
>>This should warn too, as kthread_create() (kthread_run()) accepts
>>int (*threadfn)(void *data)
>>
>>I think kauditd_thread() should be fixed here to return something...
>>"The return value should be zero or a negative error number:
>> it will be passed to kthread_stop()."
> 
> 
> But it doesn't return at all (d'oh, should have seen this before).
> Still... there's a warning if it returns void, right?
> 
> 
> 	Domen
> 


Yes, missed that. Chaning the return type removes one warning and adds
another:

kernel/audit.c:386: warning: passing argument 1 of 'kthread_create' from
incompatible pointer type

-- 
Jesse Millan
CNS Unix Team
Portland State University
Phone: (503) 725-9151
Mobile: (503) 453-0748
GPG key: www.system-calls.com/gpg.php

grep --recursive --ignore-case 'SHOULD WORK' /usr/src/linux/* | wc
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] Re: GCC4 warning: no return statement in function returning
  2005-07-01 22:15 [KJ] Re: GCC4 warning: no return statement in function returning Domen Puncer
                   ` (2 preceding siblings ...)
  2005-07-01 22:59 ` [KJ] Re: GCC4 warning: no return statement in function returning Jesse Millan
@ 2005-07-07 21:14 ` Jesse Millan
  2005-07-08 18:21 ` [KJ] Re: GCC4 warning: no return statement in function randy_dunlap
  4 siblings, 0 replies; 6+ messages in thread
From: Jesse Millan @ 2005-07-07 21:14 UTC (permalink / raw)
  To: kernel-janitors



randy_dunlap wrote:
> On Sat, 2 Jul 2005 00:22:51 +0200 Domen Puncer wrote:
> 
> | On 02/07/05 00:15 +0200, Domen Puncer wrote:
> | > On 01/07/05 11:19 -0700, Jesse Millan wrote:
> | > > -int kauditd_thread(void *dummy)
> | > > +void kauditd_thread(void *dummy)
> | > 
> | > This should warn too, as kthread_create() (kthread_run()) accepts
> | > int (*threadfn)(void *data)
> | > 
> | > I think kauditd_thread() should be fixed here to return something...
> | > "The return value should be zero or a negative error number:
> | >  it will be passed to kthread_stop()."
> | 
> | But it doesn't return at all (d'oh, should have seen this before).
> | Still... there's a warning if it returns void, right?
> 
> so it needs 
>   __attribute__((noreturn))
> added to the function?
> (or ATTRIB_NORET)
> 
> ---
> ~Randy
> 

Using the noreturn attribute implies to me that the return type should
be void. That can't be because kthread_run() expects a pointer to a
function that returns an int. Any return statement after the while(1) is
unreacable as Domen pointed out...

Could you clarify what needs to be done?

-- 
Jesse Millan
CNS Unix Team
Portland State University
Phone: (503) 725-9151
Mobile: (503) 453-0748
GPG key: www.system-calls.com/gpg.php

grep --recursive --ignore-case 'SHOULD WORK' /usr/src/linux/* | wc
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] Re: GCC4 warning: no return statement in function
  2005-07-01 22:15 [KJ] Re: GCC4 warning: no return statement in function returning Domen Puncer
                   ` (3 preceding siblings ...)
  2005-07-07 21:14 ` Jesse Millan
@ 2005-07-08 18:21 ` randy_dunlap
  4 siblings, 0 replies; 6+ messages in thread
From: randy_dunlap @ 2005-07-08 18:21 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]

On Thu, 07 Jul 2005 14:14:13 -0700 Jesse Millan wrote:

| randy_dunlap wrote:
| > On Sat, 2 Jul 2005 00:22:51 +0200 Domen Puncer wrote:
| > 
| > | On 02/07/05 00:15 +0200, Domen Puncer wrote:
| > | > On 01/07/05 11:19 -0700, Jesse Millan wrote:
| > | > > -int kauditd_thread(void *dummy)
| > | > > +void kauditd_thread(void *dummy)
| > | > 
| > | > This should warn too, as kthread_create() (kthread_run()) accepts
| > | > int (*threadfn)(void *data)
| > | > 
| > | > I think kauditd_thread() should be fixed here to return something...
| > | > "The return value should be zero or a negative error number:
| > | >  it will be passed to kthread_stop()."
| > | 
| > | But it doesn't return at all (d'oh, should have seen this before).
| > | Still... there's a warning if it returns void, right?
| > 
| > so it needs 
| >   __attribute__((noreturn))
| > added to the function?
| > (or ATTRIB_NORET)
| > 
| > ---
| > ~Randy
| > 
| 
| Using the noreturn attribute implies to me that the return type should
| be void. That can't be because kthread_run() expects a pointer to a
| function that returns an int. Any return statement after the while(1) is
| unreacable as Domen pointed out...
| 
| Could you clarify what needs to be done?

Not really.  and your summary above is correct, including that the
return type for noreturn should be void.  (see GCC 4.0.1 manual:

http://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Function-Attributes.html#Function-Attributes

"It does not make sense for a noreturn function to have a return type other than void."

I suppose you could try asking on the
gcc-help@gcc.gnu.org  mailing list.

---
~Randy

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-07-08 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-01 22:15 [KJ] Re: GCC4 warning: no return statement in function returning Domen Puncer
2005-07-01 22:22 ` Domen Puncer
2005-07-01 22:42 ` [KJ] Re: GCC4 warning: no return statement in function randy_dunlap
2005-07-01 22:59 ` [KJ] Re: GCC4 warning: no return statement in function returning Jesse Millan
2005-07-07 21:14 ` Jesse Millan
2005-07-08 18:21 ` [KJ] Re: GCC4 warning: no return statement in function randy_dunlap

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.