Bug 7031 - GCC warnings when building with 4.4.2
GCC warnings when building with 4.4.2
Status: RESOLVED FIXED
Product: CTDB 2.5.x or older
Classification: Unclassified
Component: ctdb
unspecified
x86 Linux
: P3 normal
: ---
Assigned To: Michael Adam
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-12 08:54 UTC by Chuck Short
Modified: 2016-08-10 08:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chuck Short 2010-01-12 08:54:26 UTC
Hi,

When building ctdb we get the following warnings:

server/ctdb_lockwait.c:140: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
Compiling server/ctdb_recoverd.c
server/ctdb_recoverd.c: In function ‘check_recovery_lock’:
server/ctdb_recoverd.c:2620: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
server/ctdb_recoverd.c:2624: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
Compiling server/ctdb_recover.c
server/ctdb_recover.c: In function ‘ctdb_control_set_recmode’:
server/ctdb_recover.c:730: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
server/ctdb_recover.c:734: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result

...

server/eventscript.c:53: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result
server/eventscript.c: In function ‘fork_child_for_script’:
server/eventscript.c:410: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
Compiling server/ctdb_takeover.c
Compiling server/ctdb_serverids.c
Compiling server/ctdb_persistent.c
server/ctdb_persistent.c: In function ‘ctdb_childwrite’:
server/ctdb_persistent.c:461: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
...
server/ctdb_logging.c: In function ‘ctdb_logfile_log’:
server/ctdb_logging.c:266: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
server/ctdb_logging.c:280: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
server/ctdb_logging.c:284: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
server/ctdb_logging.c: In function ‘ctdb_logfile_log_add’:
server/ctdb_logging.c:298: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
server/ctdb_logging.c:303: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
...
./lib/replace/getpass.c: In function ‘rep_getpass’:
./lib/replace/getpass.c:188: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
Compiling strptime.c
Compiling lib/events/events.c
Compiling lib/events/events_select.c
lib/events/events_select.c: In function ‘select_event_loop_select’:
lib/events/events_select.c:183: warning: unused variable ‘destruction_count’
Compiling lib/events/events_signal.c
lib/events/events_signal.c: In function ‘signal_handler’:
lib/events/events_signal.c:81: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
lib/events/events_signal.c: In function ‘signal_pipe_handler’:
lib/events/events_signal.c:137: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result
lib/events/events_signal.c: In function ‘common_event_add_signal’:
lib/events/events_signal.c:219: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result
Compiling lib/events/events_timed.c
Compiling lib/events/events_standard.c
Compiling lib/events/events_epoll.c
lib/events/events_epoll.c: In function ‘epoll_event_loop’:
lib/events/events_epoll.c:263: warning: unused variable ‘destruction_count’
Compiling tcp/tcp_connect.c
Compiling tcp/tcp_io.c
Compiling tcp/tcp_init.c
Compiling tools/ctdb.c
tools/ctdb.c: In function ‘control_restoredb’:
tools/ctdb.c:3248: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result
tools/ctdb.c:3263: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result
tools/ctdb.c: In function ‘control_dumpmemory’:
tools/ctdb.c:3616: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
tools/ctdb.c: In function ‘mem_dump_handler’:
tools/ctdb.c:3627: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
tools/ctdb.c: In function ‘control_setrecmasterrole’:
tools/ctdb.c:2833: warning: ‘recmasterrole’ may be used uninitialized in this function
tools/ctdb.c: In function ‘control_setlmasterrole’:
tools/ctdb.c:2804: warning: ‘lmasterrole’ may be used uninitialized in this function
tools/ctdb.c: In function ‘control_setnatgwstate’:
tools/ctdb.c:2775: warning: ‘natgwstate’ may be used uninitialized in this function
tools/ctdb.c: In function ‘control_setreclock’:
tools/ctdb.c:2751: warning: ‘reclock’ may be used uninitialized in this function
tools/ctdb.c: In function ‘control_scriptstatus’:
tools/ctdb.c:818: warning: ‘min’ may be used uninitialized in this function
tools/ctdb.c:818: warning: ‘max’ may be used uninitialized in this function
Compiling tools/ctdb_vacuum.c
Linking bin/ctdb
Compiling utils/scsi_io/scsi_io.c
Linking bin/scsi_io
Generating utils/smnotify/smnotify.h
rpcgen -h utils/smnotify/smnotify.x > utils/smnotify/smnotify.h
Generating utils/smnotify/gen_xdr.c
rpcgen -c utils/smnotify/smnotify.x > utils/smnotify/gen_xdr.c 
Compiling utils/smnotify/gen_xdr.c
utils/smnotify/gen_xdr.c: In function ‘xdr_status’:
utils/smnotify/gen_xdr.c:11: warning: unused variable ‘buf’
Comment 1 Michael Adam 2010-02-24 05:27:38 UTC
Thanks for reporting this!
I will try to reproduce and fix it.

But meanwhile, could you also post the following here:

* the ctdb version you are building
* your configure command line
* your cflags

Thanks - Michael
Comment 2 Luk Claes 2011-05-14 07:29:53 UTC
This seems to be fixed by a couple of commits getting rid of compiler warnings, so maybe this bug should be closed?
Comment 3 Martin Schwenke 2016-08-10 08:35:03 UTC
None of these warnings are present in current versions of CTDB when compiled with a modern compiler.  Some of the "may be used uninitialized in this function" warnings in GCC 4.4 were overzealous and are better implemented in modern compilers.  The real warnings (e.g. ignored return value from read, write, ...) have been fixed long ago.

So, fixed in all currently supported versions.