gnutls-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Small issue on GnuTLS 2.10.2


From: Simon Josefsson
Subject: Re: Small issue on GnuTLS 2.10.2
Date: Fri, 01 Oct 2010 08:35:16 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Sam Varshavchik <address@hidden> writes:

> Vivek Dasmohapatra writes:
>
>> On Thu, 30 Sep 2010, Vivek Dasmohapatra wrote:
>>
>>> On Thu, 30 Sep 2010, Dr. David Kirkby wrote:
>>>
>>>>> Thanks, fixed.  I wish we could catch these with a GCC warning so you
>>>>> don't have to run into them all the time...
>>>
>>> make sizeof
>>> cc     sizeof.c   -o sizeof
>>> sizeof.c: In function ‘wfm’:
>>> sizeof.c:11: warning: ‘return’ with a value, in function returning void
>>>
>>> tested wiith: gcc (Debian 4.4.3-3) 4.4.3
>>>              gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
>>>
>>> Seems to warn just fine.

And sizeof.c looks how?  I don't think you tested our situation:

address@hidden:~$ cat foo.c
void foo (void)
{
  return;
}

void bar (void)
{
  return foo ();
}

int main (void)
{
  bar ();
  return 0;
}
address@hidden:~$ gcc -o foo foo.c -Wall -Wextra
address@hidden:~$ gcc --version
gcc (Debian 4.4.4-8) 4.4.5 20100728 (prerelease)
address@hidden:~$ 

>> And you can crank up the pedantry even further with --pedantic,
>> which will warn of a void expression return in a function
>> with a void return signature.
>
> And -Werror, which will make any warning fail the build.

I already build with -Werror together with the following warnings:

-Wall -W -Wframe-larger-than=2100 -Wformat-security -Winit-self 
-Wmissing-include-dirs -Wunused -Wunknown-pragmas -Wstrict-aliasing 
-Wfloat-equal -Wdeclaration-after-statement -Wpointer-arith -Wbad-function-cast 
-Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Wmissing-format-attribute -Wpacked -Wredundant-decls 
-Wnested-externs -Winline -Winvalid-pch -Wlong-long -Wvla 
-Wvolatile-register-var -Wdisabled-optimization -Wstack-protector 
-Woverlength-strings -Wbuiltin-macro-redefined -Wmudflap 
-Wpacked-bitfield-compat -Wsync-nand -Wattributes -Wcoverage-mismatch 
-Wmultichar -Wunused-macros -Wno-missing-field-initializers -Wno-sign-compare 
-Wno-pointer-sign -Wno-unused-parameter -Wno-unused-parameter 
-Wno-stack-protector -Wno-int-to-pointer-cast -fdiagnostics-show-option

However none of those warnings catches a return void situation.

Yes, --pedantic catches this problem, but it also triggers on many other
constructs that we haven't fixed, and some of the --pedantic warnings
doesn't make sense.

So it would be great if there were a single gcc warning flag to enable
this particular warning, rather than the heavy handed --pedantic.

/Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]