Patrice Dumas wrote:
> Hello,
> 
> With some features of gcc 4.1 turned on, one gets verbose warnings, some of
> which are worrisome. Some are likely to be harmless. All are reported
> here for your convenience:
> 
> 

I really don't have time to go through all of this, but here's a few 
hints (I hope):

> 
> filesys.c: In function 'kdbSetKey_filesys':
> filesys.c:286: warning: ignoring return value of 'fchown', declared with 
> attribute warn_unused_result

Probably easily fixed with

    (void) fchown(blah);

> kdb.c: In function 'kdbOpenBackend':
> kdb.c:321: warning: ISO C forbids conversion of object pointer to function 
> pointer type

This is because the cast is invalid. The kdbLibSym() function returns a 
(void *), but function pointers may technically be incompatible with 
that. One way to fix it might be to wrap the function pointer in a 
"struct Something { ... } x" in the .so. (But I'm sure there are better 
ways of loading function pointers from a .so. I just don't care enough 
to look them up.)

> kdb.c: In function 'kdbMonitorKeys_default':
> kdb.c:860: warning: implicit declaration of function 'usleep'

Seems to be for lack of including <unistd.h>

> kdb.c: In function 'kdbInfoToString':
> kdb.c:1270: warning: implicit declaration of function 'snprintf'

This _should_ be declared by #include <stdio.h>, but it may require
some #define _BSD_SOURCE or _GNU_SOURCE or some such.

> key.c:2929: warning: implicit declaration of function 'fileno'

ditto, I think.

> berkeleydb.c: In function 'keyFromBDB':
> berkeleydb.c:292: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules

The (char **) cast may simply not be used here. The call needs to use a 
temporary, or the UTF8Engine declaration needs to be changed. Btw, why 
isn't the backend using the actual API functions for the Key struct here 
instead of poking around directly in the Key struct?

[--snip--]
> 
> ipc.c: In function 'ipc_accept':
> ipc.c:78: warning: pointer targets in passing argument 3 of 'accept' differ 
> in signedness
> ipc.c: In function 'ipc_local':
> ipc.c:103: warning: pointer targets in passing argument 3 of 'getsockname' 
> differ in signedness
> ipc.c: In function 'getpeereid':
> ipc.c:176: warning: pointer targets in passing argument 5 of 'getsockopt' 
> differ in signedness

Don't pass pointers to incorrectly-signed integers (or cast as appropriate).

> 
> sig.c: In function 'sig_block':
> sig.c:44: warning: 'sigblock' is deprecated (declared at 
> /usr/include/signal.h:181)
> sig.c: In function 'sig_unblock':
> sig.c:56: warning: 'sigsetmask' is deprecated (declared at 
> /usr/include/signal.h:184)
> sig.c:56: warning: 'sigsetmask' is deprecated (declared at 
> /usr/include/signal.h:184)
> sig.c: In function 'sig_blocknone':
> sig.c:67: warning: 'sigsetmask' is deprecated (declared at 
> /usr/include/signal.h:184)
> sig.c: In function 'sig_pause':
> sig.c:91: warning: implicit declaration of function 'sigpause'

This code doesn't actually seem to be used anywhere... and probably 
shouldn't except to turn misc. signals off. Signals are inherently very 
unportable -- they have very subtly different behavior on different systems.

[--snip--]>
> kdbd.c:129: warning: format '%d' expects type 'int', but argument 4 has type 
> 'pthread_t'

On my gcc 4.1.1 on my AMD64 there are also some warnings with

    format '%d' expects type 'int', but argument bla has type 'size_t'

which, according to the snprintf man page can be fixed by using "%z" in 
the format string. This is unportable, though, and the parameters should 
probably just be cast to (int) as it's unlikely to cause any real problems.

The macro KEY_METAINFO_SIZE also has issues on my AMD64:

    #define KEY_METAINFO_SIZE(k) ((unsigned int)&(k->recordSize) - 
unsigned int)k)

is incorrect when the result is used as a "size_t" in various locations.
The correct definition is

    #define KEY_METAINFO_SIZE(k) ((size_t)&(k->recordSize) - (size_t)k)

[--snip--]

I'm too tired of the crappyness of C to go on...

-- 
Bardur Arantsson
<[EMAIL PROTECTED]>

I don't want to achieve immortality through my work. I want to
achieve immortality by not dying.
                                                       Woody Allen


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Registry-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/registry-list

Reply via email to