-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update according to clang, gcc diagnostic differences, and fix newly found issues #2810
Conversation
Build SUCCESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one.
Build FAILURE Build FAILURE |
Build FAILURE |
@kira-syslogng retest this please |
Build SUCCESS |
@@ -74,7 +74,6 @@ AM_CFLAGS += \ | |||
-Wall \ | |||
-Wuninitialized \ | |||
-Wunused-but-set-parameter \ | |||
-Wcast-align \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to drop this entirely or plan to fix this later? In the latter case, you might open a jira issue for it.
return; | ||
} | ||
|
||
cr_assert(fabs(a-b) < G_MINDOUBLE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me feels G_MINDOUBLE too small, but have no better idea. Nonetheless it is equivalent change this way. Later we might want to pass this as a parameter if we run into trouble due to precision.
The `-Wmissing-parameter-type` is accepted by gcc (not by clang), despite that it does not do anything since C99. In such cases a `-Wimplicit-int` warning is triggered, thus replacing the current warning with the new. Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
This warning was never fixed, but gcc is take the ABI into account when reporting alignment issue. In case of x86 those are not actual issues, thus gcc silence. On the other hand clang reports it despite of arch. Also additionally the most issue is related to *sockaddr* casting, and some magic inside syslog-ng related to nv-pairs (both are probably okay on arm as well). Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
The *INFINITY* is defined as float by default, but according to C99 standard it still should be fine to mean infinite in case of double as well. Signed-off-by: Kokan <kokaipeter@gmail.com>
Add a new *cr_assert_gdouble_eq* to compare gdoubles. Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
First of all the `-Wsuggest-attribute=noreturn` is only supported by `gcc`, a better option would be `-Wmissing-noreturn` which is supported by `gcc` and `clang` as well. As the current standard the project follows is C99, there is no standard way, to conform with this warning (only gcc-ism). C11 provides `_Noreturn` keyword to save the day. I do not consider this warning that that important, as there is warning for function with non-void functions, this only handles methods that does not return (terminates the executable). Additionally the current flex 2.5.35 (used in travis) generates a code that does not conform with `-Wmissing-noreturn` (does not use the needed attribute). Newer version fixed this behaviore (2.6). I would only enable this warning when C11 is the used standard, by that time I hope flex newer version is also updated most of the places. Signed-off-by: Kokan <kokaipeter@gmail.com>
Signed-off-by: Kokan <kokaipeter@gmail.com>
Build FAILURE |
@kira-syslogng retest this please |
Build SUCCESS |
The main focus was on
cmake+clang
, sorryautotools
.Changes that were to replace/remove a warning was also changed in the
autotools
.But a few option was removed in case of
clang
asclang
does not define them, and those were not updated inautotools
(in case ofautotools
those warnings must be turned on via--enable-extra-warnings
).Additionally I also turned on the extra warnings for
cmake+clang
combination.Note: it seems clang is able to detect issues even if they are hidden via macro usage, while gcc is unable to see such errors (anything written in macros gcc just fine with it).