Bug 89243 - clean up compiler warnings from clang
Summary: clean up compiler warnings from clang
Status: RESOLVED MOVED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: git master
Hardware: Other All
: medium enhancement
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-20 18:10 UTC by Simon McVittie
Modified: 2018-10-12 21:22 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
tests: reassure clang that oom() does in fact not return (1.05 KB, patch)
2015-02-20 18:11 UTC, Simon McVittie
Details | Splinter Review
marshalling tests: fix an incorrect use of memcmp (1.24 KB, patch)
2015-02-20 18:12 UTC, Simon McVittie
Details | Splinter Review

Description Simon McVittie 2015-02-20 18:10:55 UTC
For better code quality, we should be able to build dbus with clang so that its better (or just different) compiler warnings can point out bad code.

As a first step towards that, I've been building it with:

-Wno-error=cast-align
-Wno-error=pointer-sign
-Wno-error=unused-const-variable
-Wno-error=tautological-compare

of which pointer-sign is Bug #15522 (and I'm not quite sure why configure isn't detecting that suppression as supported already).
Comment 1 Simon McVittie 2015-02-20 18:11:47 UTC
Created attachment 113693 [details] [review]
tests: reassure clang that oom() does in fact not return

---

gcc can tell that g_error is already noreturn, but clang can't.
Comment 2 Simon McVittie 2015-02-20 18:12:47 UTC
Created attachment 113694 [details] [review]
marshalling tests: fix an incorrect use of memcmp

---

We intended to memcmp sizeof(literal) bytes but were actually comparing 1 byte. Oops. (The tests still pass with this fixed, though.)
Comment 3 Ralf Habacker 2015-02-23 18:33:36 UTC
Comment on attachment 113694 [details] [review]
marshalling tests: fix an incorrect use of memcmp

looks good
Comment 4 Ralf Habacker 2015-02-23 18:35:10 UTC
Comment on attachment 113693 [details] [review]
tests: reassure clang that oom() does in fact not return

Review of attachment 113693 [details] [review]:
-----------------------------------------------------------------

looks good
Comment 5 Simon McVittie 2015-02-24 11:28:06 UTC
Patches applied, thanks. I'll leave this open, because there are still obvious clang warnings.
Comment 6 Simon McVittie 2015-02-24 11:40:37 UTC
(In reply to Simon McVittie from comment #0)
> -Wno-error=cast-align

That's essentially Bug #10599 so I'm treating it as somewhat out-of-scope for this bug (although it would be good to suppress the warning until then).

> -Wno-error=pointer-sign

This is Bug #15522; similar.

> -Wno-error=unused-const-variable

This is a new insight from clang; gcc doesn't notice. We probably just need more #ifndef TESTS or whatever.

> -Wno-error=tautological-compare

clang is making one of our enums unsigned, where gcc makes it signed. I think we might also be abusing the relevant enum to take an out-of-range value (not allowed in Standard C) which ought to be fixed one day anyway.
Comment 7 GitLab Migration User 2018-10-12 21:22:18 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/122.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.