Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 538784 - dev-util/oprofile-1.0.0 - op_cpu_type.c:541:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
Summary: dev-util/oprofile-1.0.0 - op_cpu_type.c:541:20: warning: suggest parentheses ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andrew Savchenko
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2015-02-04 11:16 UTC by Jeroen Roovers (RETIRED)
Modified: 2015-02-09 17:21 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Roovers (RETIRED) gentoo-dev 2015-02-04 11:16:22 UTC
--- files/oprofile-1.0.0-athlon.patch   1 Dec 2014 06:39:59 -0000       1.1
+++ files/oprofile-1.0.0-athlon.patch   4 Feb 2015 11:07:27 -0000
@@ -1,14 +1,14 @@
 Fix AMD Athlon CPU family recognition.
 See upstream bug 275 for details:
 https://sourceforge.net/p/oprofile/bugs/275/
---- oprofile-1.0.0/libop/op_cpu_type.c.orig    2014-09-12 18:39:47.000000000 +0400
-+++ oprofile-1.0.0/libop/op_cpu_type.c 2014-11-30 18:29:00.328342552 +0300
+--- a/libop/op_cpu_type.c
++++ b/libop/op_cpu_type.c
 @@ -538,10 +538,13 @@
        family = cpu_family(eax);

        /* These family does not exist in the past.*/
 -      if (family < 0x0f || family == 0x13)
-+      if (family < 0x0f && family != 0x6 || family == 0x13)
++      if ((family < 0x0f && family != 0x06) || family == 0x13)
                return ret;

        switch (family) {
Comment 1 Andrew Savchenko gentoo-dev 2015-02-04 22:21:21 UTC
Hmmm, while proposed patch is harmless and I have no strong objection towards it, I still can't understand why such issues should be fixed at all.

The C standard clearly says than && have precedence over || (clause 6.5.13 and 6.5.14). While gcc devs may suggest that they desire paretheses to be used via -Wparentheses, that's a pure whim and I see no reason why it should be followed.

So, I'm not sure what to do here.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-05 11:17:29 UTC
I would agree. The patch does add some clarity using parentheses and by having all hexadecimal arguments use the same format, though.
Comment 3 Andrew Savchenko gentoo-dev 2015-02-09 17:21:31 UTC
In tree now.