After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793195 - Fix compiler warnings
Fix compiler warnings
Status: RESOLVED FIXED
Product: gnome-desktop
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Desktop Maintainers
Desktop Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-02-05 19:07 UTC by Ernestas Kulik
Modified: 2018-02-12 17:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix compiler warnings (17.22 KB, patch)
2018-02-05 19:07 UTC, Ernestas Kulik
accepted-commit_now Details | Review
Fix redundant const qualifiers (1.05 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review
Fix comparisons with differing signedness (5.24 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review
Don’t shadow variables (4.04 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review
Handle all cases when switching on an enum (4.33 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review
Disable deprecation warnings explicitly (2.46 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review
Silence warnings for increased pointer alignment (1.68 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review
Add const-qualifier when assigning string literals (1.40 KB, patch)
2018-02-12 16:58 UTC, Ernestas Kulik
committed Details | Review

Description Ernestas Kulik 2018-02-05 19:07:47 UTC
Some cause more problems with Clang and are trickier to deal with, but
this should make the library buildable with -Werror.

The following warnings have been fixed:

    * shadowed variables: renamed or recycled where it makes sense;

    * incompatible type conversions:
        * types equalized in comparisons,

        * initializing a c-string array with literals: array turned
          const, but constness cast-out when passing to g_spawn_sync(),
          since the array is guaranteed to not be modified,

        * XGetWindowProperty() calls: a void pointer used to hold
          returned property data to retain required alignment when
          casting later;

    * switching on enumerations: missing cases added;

    * redundant const-qualifiers in pointers: those assumedly should
      have been const pointers, so that’s what they became;

    * GTK+/GDK deprecation warnings: preprocessor definition to disable
      those is now passed unconditionally, which goes against
      --enable-deprecation-flags and is the reason why it was removed.
Comment 1 Ernestas Kulik 2018-02-05 19:07:53 UTC
Created attachment 367927 [details] [review]
Fix compiler warnings
Comment 2 Ernestas Kulik 2018-02-05 19:09:32 UTC
I tried to be as descriptive as possible, but feedback/questions welcome. This is mostly to make Continuous happy again.
Comment 3 Ernestas Kulik 2018-02-09 07:26:48 UTC
Any news on this? Not having to pass --disable-Werror would be nice.
Comment 4 Michael Catanzaro 2018-02-12 15:28:40 UTC
(In reply to Ernestas Kulik from comment #0)
>     * GTK+/GDK deprecation warnings: preprocessor definition to disable
>       those is now passed unconditionally, which goes against
>       --enable-deprecation-flags and is the reason why it was removed.

I guess it's a lot of work to fix these?
Comment 5 Ernestas Kulik 2018-02-12 15:40:11 UTC
(In reply to Michael Catanzaro from comment #4)
> (In reply to Ernestas Kulik from comment #0)
> >     * GTK+/GDK deprecation warnings: preprocessor definition to disable
> >       those is now passed unconditionally, which goes against
> >       --enable-deprecation-flags and is the reason why it was removed.
> 
> I guess it's a lot of work to fix these?

There are some non-trivial changes that need to be made, so I decided it would be better to just not emit the warnings for now.
Comment 6 Ernestas Kulik 2018-02-12 16:58:11 UTC
Created attachment 368266 [details] [review]
Fix redundant const qualifiers

The pointers in DefaultInputSource don’t correctly express that they are
const and not just point to const data.
Comment 7 Ernestas Kulik 2018-02-12 16:58:18 UTC
Created attachment 368267 [details] [review]
Fix comparisons with differing signedness
Comment 8 Ernestas Kulik 2018-02-12 16:58:26 UTC
Created attachment 368268 [details] [review]
Don’t shadow variables

Especially if the types don’t match.
Comment 9 Ernestas Kulik 2018-02-12 16:58:33 UTC
Created attachment 368269 [details] [review]
Handle all cases when switching on an enum
Comment 10 Ernestas Kulik 2018-02-12 16:58:41 UTC
Created attachment 368270 [details] [review]
Disable deprecation warnings explicitly

This additionally removes the ability to pass deprecation flags to
configure.ac. Revert when GTK/GDK warnings are fixed, or just don’t define
the magic macros.
Comment 11 Ernestas Kulik 2018-02-12 16:58:49 UTC
Created attachment 368271 [details] [review]
Silence warnings for increased pointer alignment

Not much to do other than some clever casting, since Xlib insists on
receiving char pointers.
Comment 12 Ernestas Kulik 2018-02-12 16:58:57 UTC
Created attachment 368272 [details] [review]
Add const-qualifier when assigning string literals

This also requires some casting when using due to legacy requirements.
The string is never modified, so it’s fine.
Comment 13 Ernestas Kulik 2018-02-12 17:05:55 UTC
Attachment 368266 [details] pushed as 152bc57 - Fix redundant const qualifiers
Attachment 368267 [details] pushed as 5cca208 - Fix comparisons with differing signedness
Attachment 368268 [details] pushed as 5d5fa67 - Don’t shadow variables
Attachment 368269 [details] pushed as d52b1a2 - Handle all cases when switching on an enum
Attachment 368270 [details] pushed as f687629 - Disable deprecation warnings explicitly
Attachment 368271 [details] pushed as 5db5f5d - Silence warnings for increased pointer alignment
Attachment 368272 [details] pushed as 50299b7 - Add const-qualifier when assigning string literals