This repository has been archived by the owner. It is now read-only.

[dev.icinga.com #4159] Warnings with CLANG compiler #1277

Closed
icinga-migration opened this Issue May 9, 2013 · 5 comments

Comments

Projects
None yet
1 participant
@icinga-migration
Copy link
Member

icinga-migration commented May 9, 2013

This issue has been migrated from Redmine: https://dev.icinga.com/issues/4159

Created by LarsEngels on 2013-05-09 19:26:44 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2013-07-27 19:00:41 +00:00)
Target Version: 1.10
Last Update: 2013-07-27 19:00:41 +00:00 (in Redmine)

Icinga Version: 1.9.0
OS Version: FreeBSD 10-CURRENT

CLANG shows some warnings that gcc does not:

cc -Wall -O2 -pipe -march=core2 -I/usr/local/include -fPIC -fno-strict-aliasing   -DAPPLLIB_EXP="/usr/local/lib/perl5/5.12.4/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include  -I/usr/local/lib/perl5/5.12.4/mach/CORE  -DHAVE_CONFIG_H -DNSCORE -c -o objects-base.o ../common/objects.c
../common/objects.c:533:17: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (start_time < 0 || start_time > 86400) {
            ~~~~~~~~~~ ^ ~
../common/objects.c:537:15: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (end_time < 0 || end_time > 86400) {
            ~~~~~~~~ ^ ~
../common/objects.c:602:17: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (start_time < 0 || start_time > 86400) {
            ~~~~~~~~~~ ^ ~
../common/objects.c:606:15: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
        if (end_time < 0 || end_time > 86400) {
            ~~~~~~~~ ^ ~

[...]

cc -Wall -O2 -pipe -march=core2 -I/usr/local/include -fPIC -fno-strict-aliasing   -DAPPLLIB_EXP="/usr/local/lib/perl5/5.12.4/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include  -I/usr/local/lib/perl5/5.12.4/mach/CORE  -DHAVE_CONFIG_H -DNSCGI  -o config.cgi config.c ../base/statsprofiler.c  ../common/shared.o getcgi.o cgiutils.o cgiauth.o readlogs.o macros-cgi.o skiplist.o  objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o comments-cgi.o downtime-cgi.o -lthr -L/usr/local/lib
config.c:4527:30: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
        org_cgi_log_rotation_method = org_cgi_log_rotation_method;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

cc -Wall -O2 -pipe -march=core2 -I/usr/local/include -fPIC -fno-strict-aliasing   -DAPPLLIB_EXP="/usr/local/lib/perl5/5.12.4/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include  -I/usr/local/lib/perl5/5.12.4/mach/CORE  -DHAVE_CONFIG_H -c -o logging.o logging.c
logging.c:136:12: warning: incompatible pointer to integer conversion assigning to 'unsigned long' from 'pthread_t' (aka 'struct pthread *') [-Wint-conversion]
        tid=pthread_self();
           ^~~~~~~~~~~~~~~

Changesets

2013-07-27 18:37:42 +00:00 by (unknown) b13c487

fix default setting for cgi_log_rotation_method

thanks clang for unveiling self assignment!

refs #4159

2013-07-27 18:58:09 +00:00 by (unknown) 2d4ac42

fix warnings with CLANG compiler

fixes #4159
@icinga-migration

This comment has been minimized.

Copy link
Member Author

icinga-migration commented Jun 3, 2013

Updated by mfriedrich on 2013-06-03 19:51:01 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Priority changed from Normal to Low
@icinga-migration

This comment has been minimized.

Copy link
Member Author

icinga-migration commented Jul 27, 2013

Updated by mfriedrich on 2013-07-27 18:28:13 +00:00

  • Target Version set to 1.10
@icinga-migration

This comment has been minimized.

Copy link
Member Author

icinga-migration commented Jul 27, 2013

Updated by mfriedrich on 2013-07-27 18:41:42 +00:00

the last warning can only be reproduced in freebsd, as pthread_self() returns a struct instead of an integer.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

icinga-migration commented Jul 27, 2013

Updated by mfriedrich on 2013-07-27 18:57:21 +00:00

i can't fix the pthread_self() warning, as it would be an ifdef orgy for either having the typedef of "pthread_id" being unsigned long, or representing a pointer to a struct. that iso introduction is a just an epic clusterfuck for any compatibility around all systems. and i am not willing to create our own thread id setter/getter just to workaround the issue.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

icinga-migration commented Jul 27, 2013

Updated by Anonymous on 2013-07-27 19:00:41 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 2d4ac42.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.