Skip to content
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

Merged
merged 13 commits into from
Jul 16, 2019

Conversation

Kokan
Copy link
Collaborator

@Kokan Kokan commented Jun 28, 2019

The main focus was on cmake+clang, sorry autotools.
Changes that were to replace/remove a warning was also changed in the autotools.
But a few option was removed in case of clang as clang does not define them, and those were not updated in autotools (in case of autotools 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).

@kira-syslogng
Copy link
Contributor

Build SUCCESS

bazsi
bazsi previously approved these changes Jun 29, 2019
Copy link
Collaborator

@bazsi bazsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one.

@kira-syslogng
Copy link
Contributor

Build FAILURE

Build FAILURE

@kira-syslogng
Copy link
Contributor

Build FAILURE

@Kokan
Copy link
Collaborator Author

Kokan commented Jul 2, 2019

@kira-syslogng retest this please

@kira-syslogng
Copy link
Contributor

Build SUCCESS

furiel
furiel previously approved these changes Jul 10, 2019
@@ -74,7 +74,6 @@ AM_CFLAGS += \
-Wall \
-Wuninitialized \
-Wunused-but-set-parameter \
-Wcast-align \
Copy link
Collaborator

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);
Copy link
Collaborator

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.

Kokan added 13 commits July 11, 2019 12:52
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>
@kira-syslogng
Copy link
Contributor

Build FAILURE

@alltilla
Copy link
Collaborator

@kira-syslogng retest this please

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@furiel furiel merged commit 7074740 into syslog-ng:master Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants