[Privoxy-devel] filters.c: warning: 'xxx' may be used uninitialized in this function [-Wmaybe-uninitialized]
Lee
ler762 at gmail.com
Thu Jun 1 18:04:37 UTC 2017
On 6/1/17, Fabian Keil <fk at fabiankeil.de> wrote:
> Lee <ler762 at gmail.com> wrote:
>
>> before I go making changes to get rid of compiler warnings, is there
>> really a problem with variables being uninitialized in filters.c? I
>> can't tell :(
>>
>> ----------- warnings
>> i686-w64-mingw32-gcc -c -pipe -O2 -DWINVER=0x501 -mwindows -Wall
>> -Ipcre filters.c -o filters.o
>> filters.c: In function 'match_sockaddr':
>> filters.c:214:42: warning: 'address_port' may be used uninitialized in
>> this function [-Wmaybe-uninitialized]
>> if (*netmask_port && *network_port != *address_port)
>> ^
>
> What's the compiler version you're using?
$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> I suspect that it gets confused by the return(-1) blocks in
> sockaddr_storage_to_ip(). At first glance I believe that
> they shouldn't be reachable in which case we should probably
> remove them or make this more obvious.
>
> We could start with something like:
I don't see any [privoxy-commits] messages from sourceforge, so you
want me to manually make those changes & see what happens?
> I would prefer to clarify the code first to see if this is sufficient
> to convince your compiler that the variables are initialised properly.
>
> Simply initialising the variables to 0/NULL is likely to result
> in "dead store" warnings from other compilers.
like these?
i686-w64-mingw32-gcc -c -pipe -O2 -DWINVER=0x501 -mwindows -Wall
-Ipcre parsers.c -o parsers.o
In file included from parsers.c:90:0:
strptime.h: In function 'strptime_internal':
strptime.h:277:21: warning: variable 'era' set but not used
[-Wunused-but-set-variable]
struct era_entry *era;
^
strptime.h:265:15: warning: variable 'rp_backup' set but not used
[-Wunused-but-set-variable]
const char *rp_backup;
^
> If the stores weren't actually dead they wouldn't be sufficient to
> prevent problems anyway.
Not that it means a whole lot, but the only problems I've noticed are
compiler warnings. I'm not seeing privoxy misbehaving.
Lee
More information about the Privoxy-devel
mailing list