Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508364 - sys-apps/portage - update compiler warning QA for GCC 4.9
Summary: sys-apps/portage - update compiler warning QA for GCC 4.9
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 484436 gcc-4.9 508418
  Show dependency tree
 
Reported: 2014-04-22 06:40 UTC by Ryan Hill (RETIRED)
Modified: 2014-10-21 05:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
portage-gcc49-qa-warnings.patch (portage-gcc49-qa-warnings.patch,2.92 KB, patch)
2014-04-22 06:40 UTC, Ryan Hill (RETIRED)
Details | Diff
Updated patch (0001-Update-gcc-warning-checks-to-work-with-colored-outpu.patch,4.76 KB, patch)
2014-09-12 10:48 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Hill (RETIRED) gentoo-dev 2014-04-22 06:40:20 UTC
Created attachment 375452 [details, diff]
portage-gcc49-qa-warnings.patch

4.9 adds support for color-highlighted warnings with the -fdiagnostics-color flag.  Because portage includes escape characters in build logs (bug #496816) we end up with crap like:

^[[01m^[[K/var/tmp/portage/app-office/calligra-2.7.5/work/calligra-2.7.5/kexi/plugins/forms/widgets/kexidbimagebox.cpp:903:49:^[[m^[[K ^[[01;33m^[[Kwarning: ^[[m^[[K'^[[01m^[[Kconst QColor& QColorGroup::base() const^[[m^[[K' is deprecated (declared at ^[[01m^[[K/usr/include/qt4/QtGui/qpalette.h:234^[[m^[[K) [-Wdeprecated-declarations]

In addition to being completely unreadable this breaks all our QA rules for flagging compiler warnings.

While I was poking around in here I converted a few of the rules to match the -W flag name rather than the warning message itself.  This should make it a little more future-proof.

Tested by building zsnes with and without -fdiagnostics-color.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-09-11 11:25:25 UTC
I can confirm that gcc-4.7 spits those -W flags in QA warnings too. I guess we could just switch to that.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-09-12 10:48:00 UTC
Created attachment 384614 [details, diff]
Updated patch

Thanks for the patch. Here's my update to it. I've switched a few more to either -Wfoo or combination of -Wfoo and a keyword. Also added comments for what each check does.

I've tested it with 4.9&4.8. I'm going to test 4.7&4.6 when I build them too. I doubt we need to support earlier versions.
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2014-09-13 04:55:20 UTC
Thanks, this looks good.  I just checked 4.7.  Anything before that we can ignore.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-09-13 06:57:37 UTC
I guess so. 4.6 doesn't even compile :).
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2014-09-16 02:22:46 UTC
Everyone marking 4.6.4 stable seem to disagree.
Comment 6 SpanKY gentoo-dev 2014-09-18 20:49:29 UTC
(In reply to Michał Górny from comment #2)

if it matches gcc-4.7 and newer, then sounds good to me.  i don't mind dropping support in this area for older versions (same as hardening).
Comment 7 Brian Dolbec (RETIRED) gentoo-dev 2014-09-26 19:14:08 UTC
Fix applied and Released in portage-2.2.14_rc1
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2014-10-11 06:22:29 UTC
A bit off-topic but not worth opening a new bug:

+    # left/right-hand operand of comma expression has no effect
+    "warning: .*comma.*\\[-Wunused-value\\]"

With 4.9 and later the "right-hand" version of this warning gets triggered by a large number of packages, including binutils, glibc, and gcc itself.  It's very noisy; I'm seeing it occur on some packages 30-50 times.  I looked into it a while back and IIUC it can be caused when the RHS of a comma expression is a macro that supplies a return value which is not used by the caller), which seems to be a relatively common practice.  In any case I think this warning is pretty harmless, or at least doesn't fall into "severe warnings that may exhibit random runtime failures" territory, and the large number of warnings generated may drown out more important messages.

So, can we limit this to "left-hand" please?
Comment 9 Zac Medico gentoo-dev 2014-10-19 19:47:33 UTC
(In reply to Ryan Hill from comment #8)
> A bit off-topic but not worth opening a new bug:
> 
> +    # left/right-hand operand of comma expression has no effect
> +    "warning: .*comma.*\\[-Wunused-value\\]"
> 
> So, can we limit this to "left-hand" please?

Like this then?

"warning: .*left-hand operand of comma.*\\[-Wunused-value\\]"
Comment 10 Brian Dolbec (RETIRED) gentoo-dev 2014-10-20 00:40:34 UTC
Pushed this commit:

https://github.com/gentoo/portage/commit/458c549c02f0597e8ed9c0e122e0fb8af28ae8e4

which should fix this.
Comment 11 Zac Medico gentoo-dev 2014-10-20 19:41:19 UTC
This is fixed in 2.2.14.
Comment 12 Ryan Hill (RETIRED) gentoo-dev 2014-10-21 05:53:58 UTC
Thanks!