compilation warnings on Ubuntu 12.04.3 LTS

Bug #1243841 reported by Galen Charlton
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenSRF
Fix Released
Low
Unassigned

Bug Description

A user encountered the following compilation warnings building OpenSRF 2.2.1 on Ubuntu 12.04.3 LTS:

...
.deps/libosrf_json_la-utils.Tpo -c utils.c -fPIC -DPIC -o .libs/libosrf_json_la-utils.o
utils.c: In function 'set_proc_title':
utils.c:133:2: warning: format not a string literal and no format arguments [-Wformat-security]
utils.c:133:2: warning: format not a string literal and no format arguments [-Wformat-security]
utils.c: In function 'stringisnum':
utils.c:697:8: warning: ignoring return value of 'strtol', declared with attribute warn_unused_result [-Wunused-result]
utils.c: In function 'daemonize':
utils.c:665:8: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
utils.c:672:10: warning: ignoring return value of 'freopen', declared with attribute warn_unused_result [-Wunused-result]
utils.c:673:10: warning: ignoring return value of 'freopen', declared with attribute warn_unused_result [-Wunused-result]
utils.c:674:10: warning: ignoring return value of 'freopen', declared with attribute warn_unused_result [-Wunused-result]

...
.deps/osrf_legacy_json.Tpo -c -o osrf_legacy_json.o osrf_legacy_json.c
osrf_legacy_json.c: In function ‘json_eat_comment’:
osrf_legacy_json.c:607:6: warning: variable ‘fourth_dash’ set but not used [-Wunused-but-set-variable]
osrf_legacy_json.c: In function ‘jsonObjectIteratorNext’:
osrf_legacy_json.c:836:5: warning: passing argument 3 of ‘makeNode’ discards ‘const’ qualifier from pointer target type [enabled by default]
osrf_legacy_json.c:808:24: note: expected ‘char *’ but argument is of type ‘const char *’
mv -f .deps/osrf_legacy_json.Tpo .deps/osrf_legacy_json.Po


srfsh.c: In function ‘process_request’:
srfsh.c:367:9: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]

….
/osrf_http_translator.c: In function 'osrfHttpTranslatorParseRequest':
./osrf_http_translator.c:299:25: warning: passing argument 1 of 'free' discards 'const' qualifier from pointer target type [enabled by default]
/usr/include/stdlib.h:488:13: note: expected 'void *' but argument is of type 'const char *'

These are likely benign, but it would be best if the build were clean.

OpenSRF: 2.2.1 (and probably also master)

Tags: pullrequest
Revision history for this message
Chris Sharp (chrissharp123) wrote :

I've begun a collab branch here:

http://git.evergreen-ils.org/?p=working/OpenSRF.git;a=shortlog;h=refs/heads/collab/csharp/lp1243841_fix_compilation_warnings

I would appreciate more experienced eyes on this, of course :-).

Changed in opensrf:
status: New → Confirmed
Revision history for this message
Thomas Leavitt (u-tho4as-f) wrote :

I get this (and a lot more, now that I scroll through) when I run make after ./configure.

srfsh.c: In function ‘process_request’:
srfsh.c:386:4: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
    system( request + 1 );
    ^

Should I post a comprehensive list? Not far enough in the process to determine if any of them matter. "make" did not appear to prematurely exit.

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I rebased Chris's branch on master and added some additional commits to clean up the other warnings on Ubuntu 14.04 with gcc 4.8. My branch is here:

working/collab/dyrcona/lp1243841_fix_compilation_warnings : http://git.evergreen-ils.org/?p=working/OpenSRF.git;a=shortlog;h=refs/heads/collab/dyrcona/lp1243841_fix_compilation_warnings

I think this gets the rest of the C compiler warnings. It should be tested with newer compilers on more recent distros and with clang at some point.

I am adding the pullrequest tag because I think it is ready.

I did not attempt to address any of the warnings from configure as there should be another bug for that.

tags: added: pullrequest
Changed in opensrf:
milestone: none → 2.5.3
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed the patches to master and rel_3_0, along with a further patch that makes a whitespace change to quiet a -Wmisleading-indentation warning. Thanks, Chris and Jason!

Changed in opensrf:
importance: Undecided → Low
milestone: 2.5.3 → 3.0.1
status: Confirmed → Fix Committed
Changed in opensrf:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.