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 765389 - [PATCH] Fix -Werror build for clang
[PATCH] Fix -Werror build for clang
Status: RESOLVED FIXED
Product: gtk-vnc
Classification: Other
Component: general
unspecified
Other FreeBSD
: Normal normal
: ---
Assigned To: gtk-vnc-maint
gtk-vnc-maint
Depends on:
Blocks:
 
 
Reported: 2016-04-21 17:31 UTC by Ting-Wei Lan
Modified: 2016-08-16 10:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Fix warnings showed by clang (6.94 KB, patch)
2016-04-21 17:32 UTC, Ting-Wei Lan
none Details | Review
build: Ignore cast alignment warnings showed by clang (684 bytes, patch)
2016-07-24 19:27 UTC, Ting-Wei Lan
none Details | Review
build: Update warnings.m4 from gnulib (4.25 KB, patch)
2016-07-24 19:27 UTC, Ting-Wei Lan
none Details | Review

Description Ting-Wei Lan 2016-04-21 17:31:58 UTC
Please see the attached patch. It should fix all warnings when compiling with clang.
Comment 1 Ting-Wei Lan 2016-04-21 17:32:53 UTC
Created attachment 326513 [details] [review]
build: Fix warnings showed by clang

This commit fixes three kinds of warning:

(1) Unknown option warning: Clang shows warnings instead of errors when
    unknown warning options are used. This is used to avoid build error
    on build systems made for GCC, but this also means we have to use
    -Werror=unknown-warning-option when checking whether a warning
    option is supported.

(2) Cast alignment warning: Clang shows warnings for pointer conversions
    even if the target machine allows unaligned memory access. I assume
    all memory access in gtk-vnc is properly aligned and suppress all
    warnings by converting pointers to void* first.

(3) Unused function warning: There is an usused static inline function.
    It is removed in this commit to avoid the warning.
Comment 2 Ting-Wei Lan 2016-05-23 18:04:59 UTC
This patch has stayed in bugzilla for one month. Can it be reviewed?
Comment 3 Ting-Wei Lan 2016-06-18 10:36:54 UTC
I think I have to ping again ... Can anyone help review the patch?
Comment 4 Ting-Wei Lan 2016-07-16 15:56:59 UTC
I think I really need to ping again ... This patch has stayed here for almost 3 months without begin reviewed.
Comment 5 Daniel P. Berrange 2016-07-21 17:07:58 UTC
Adding all those gpointer casts is really not something I'm willing to merge. Either the compiler will need to be made to be quiet, or a better code solution found. The problem with detecting support of warning flags with clang is something that should be fixed in gnulib's 'warnings.m4' file which is what we're using here, since that'll solve the problem for every app not just gtk-vnc.
Comment 6 Ting-Wei Lan 2016-07-24 19:27:41 UTC
Created attachment 332046 [details] [review]
build: Ignore cast alignment warnings showed by clang
Comment 7 Ting-Wei Lan 2016-07-24 19:27:49 UTC
Created attachment 332047 [details] [review]
build: Update warnings.m4 from gnulib

This fixes unknown option warnings when compiling with clang.
Comment 8 Daniel P. Berrange 2016-08-16 10:04:22 UTC
commit ceaeee79fab707513305796202cb1c5c46bce715
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Aug 16 11:03:37 2016 +0100

    Ignore cast align warnings to avoid tripping up clang
    
    Resolves: bz#765389
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

commit 4df8b43dac4c0e9cde401842f5ddf226bb770059
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Aug 16 11:01:40 2016 +0100

    Update to newer copies of gnulib's warnings code
    
    This introduces many more warning flags, and fixes compat
    with clang
    
    Resolves: bz#765389
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>