[dpdk-dev,1/4] examples/bond: fix compilation with clang

Message ID 1431937081-20083-2-git-send-email-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Olivier Matz May 18, 2015, 8:17 a.m. UTC
  Fix the following compilation error:

examples/bond/main.c:717:1: error: control reaches end of
  non-void function [-Werror,-Wreturn-type]

The prompt() function does not return anything, so fix its prototype
to be void.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 examples/bond/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bruce Richardson May 18, 2015, 1:53 p.m. UTC | #1
On Mon, May 18, 2015 at 10:17:58AM +0200, Olivier Matz wrote:
> Fix the following compilation error:
> 
> examples/bond/main.c:717:1: error: control reaches end of
>   non-void function [-Werror,-Wreturn-type]
> 
> The prompt() function does not return anything, so fix its prototype
> to be void.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Out of interest, what version of clang throws up this error?

/Bruce

> ---
>  examples/bond/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/bond/main.c b/examples/bond/main.c
> index e90dc1d..4622283 100644
> --- a/examples/bond/main.c
> +++ b/examples/bond/main.c
> @@ -705,7 +705,7 @@ cmdline_parse_ctx_t main_ctx[] = {
>  };
>  
>  /* prompt function, called from main on MASTER lcore */
> -static void *prompt(__attribute__((unused)) void *arg1)
> +static void prompt(__attribute__((unused)) void *arg1)
>  {
>  	struct cmdline *cl;
>  
> -- 
> 2.1.4
>
  
Olivier Matz May 18, 2015, 1:57 p.m. UTC | #2
Hi Bruce,

On 05/18/2015 03:53 PM, Bruce Richardson wrote:
> On Mon, May 18, 2015 at 10:17:58AM +0200, Olivier Matz wrote:
>> Fix the following compilation error:
>>
>> examples/bond/main.c:717:1: error: control reaches end of
>>   non-void function [-Werror,-Wreturn-type]
>>
>> The prompt() function does not return anything, so fix its prototype
>> to be void.
>>
>> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Out of interest, what version of clang throws up this error?

$ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

And by the way, the gcc version I used for the other patches of the
series:

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2


Regards,
Olivier

> 
> /Bruce
> 
>> ---
>>  examples/bond/main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/examples/bond/main.c b/examples/bond/main.c
>> index e90dc1d..4622283 100644
>> --- a/examples/bond/main.c
>> +++ b/examples/bond/main.c
>> @@ -705,7 +705,7 @@ cmdline_parse_ctx_t main_ctx[] = {
>>  };
>>  
>>  /* prompt function, called from main on MASTER lcore */
>> -static void *prompt(__attribute__((unused)) void *arg1)
>> +static void prompt(__attribute__((unused)) void *arg1)
>>  {
>>  	struct cmdline *cl;
>>  
>> -- 
>> 2.1.4
>>
  
Bruce Richardson May 18, 2015, 2 p.m. UTC | #3
On Mon, May 18, 2015 at 03:57:00PM +0200, Olivier MATZ wrote:
> Hi Bruce,
> 
> On 05/18/2015 03:53 PM, Bruce Richardson wrote:
> > On Mon, May 18, 2015 at 10:17:58AM +0200, Olivier Matz wrote:
> >> Fix the following compilation error:
> >>
> >> examples/bond/main.c:717:1: error: control reaches end of
> >>   non-void function [-Werror,-Wreturn-type]
> >>
> >> The prompt() function does not return anything, so fix its prototype
> >> to be void.
> >>
> >> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > 
> > Out of interest, what version of clang throws up this error?
> 
> $ clang --version
> Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> 
> And by the way, the gcc version I used for the other patches of the
> series:
> 
> $ gcc --version
> gcc (Debian 4.9.2-10) 4.9.2
> 
> 
> Regards,
> Olivier
> 

Thanks. I was just curious as I wasn't seeing issues with clang 3.6 on Fedora.

/Bruce

> > 
> > /Bruce
> > 
> >> ---
> >>  examples/bond/main.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/examples/bond/main.c b/examples/bond/main.c
> >> index e90dc1d..4622283 100644
> >> --- a/examples/bond/main.c
> >> +++ b/examples/bond/main.c
> >> @@ -705,7 +705,7 @@ cmdline_parse_ctx_t main_ctx[] = {
> >>  };
> >>  
> >>  /* prompt function, called from main on MASTER lcore */
> >> -static void *prompt(__attribute__((unused)) void *arg1)
> >> +static void prompt(__attribute__((unused)) void *arg1)
> >>  {
> >>  	struct cmdline *cl;
> >>  
> >> -- 
> >> 2.1.4
> >>
  

Patch

diff --git a/examples/bond/main.c b/examples/bond/main.c
index e90dc1d..4622283 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -705,7 +705,7 @@  cmdline_parse_ctx_t main_ctx[] = {
 };
 
 /* prompt function, called from main on MASTER lcore */
-static void *prompt(__attribute__((unused)) void *arg1)
+static void prompt(__attribute__((unused)) void *arg1)
 {
 	struct cmdline *cl;