Small issue on GnuTLS 2.10.2
Simon Josefsson
simon at josefsson.org
Fri Oct 1 08:35:16 CEST 2010
Sam Varshavchik <mrsam at courier-mta.com> 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:
jas at mocca:~$ cat foo.c
void foo (void)
{
return;
}
void bar (void)
{
return foo ();
}
int main (void)
{
bar ();
return 0;
}
jas at mocca:~$ gcc -o foo foo.c -Wall -Wextra
jas at mocca:~$ gcc --version
gcc (Debian 4.4.4-8) 4.4.5 20100728 (prerelease)
jas at mocca:~$
>> 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
More information about the Gnutls-devel
mailing list