Skip to contentSkip to conversation

tools/kdd: alternative way of muting spurious gcc warning

PATCH In review Marek Marczykowski-Górecki 4 participants 6 messages May 22, 2018 – May 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/kdd: alternative way of muting spurious gcc warning

Older gcc does not support #pragma GCC diagnostics, so use alternative approach - change variable type to uint32_t (this code handle 32-bit requests only anyway), which apparently also avoid gcc complaining about this (otherwise correct) code.

Fixes 437e00fea04becc91c1b6bc1c0baa636b067a5cc "tools/kdd: mute spurious gcc warning"

---
 tools/debugger/kdd/kdd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
tools/debugger/kdd/kdd.c +1 -4
index 61d769ece9..5a019a0a0c 100644
@@ -687,7 +687,7 @@ static void kdd_handle_read_ctrl(kdd_state *s)
         }
     } else {
         /* 32-bit control-register space starts at 0x[2]cc, for 84 bytes */
-        uint64_t offset = addr;
+        uint32_t offset = addr;
         if (offset > 0x200)
             offset -= 0x200;
         offset -= 0xcc;
@@ -695,10 +695,7 @@ static void kdd_handle_read_ctrl(kdd_state *s)
             KDD_LOG(s, "Request outside of known control space\n");
             len = 0;
         } else {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
             memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len);
-#pragma GCC diagnostic pop
         }
     }
 
Signature · 7 lines
2.13.6


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 9 lines · Marek Marczykowski-Górecki

Older gcc does not support #pragma GCC diagnostics, so use alternative approach - change variable type to uint32_t (this code handle 32-bit requests only anyway), which apparently also avoid gcc complaining about this (otherwise correct) code.

Fixes 437e00fea04becc91c1b6bc1c0baa636b067a5cc "tools/kdd: mute spurious gcc warning"

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#2 lore raw
Quoted 6 lines · Juergen Gross
Quoted 5 lines · Marek Marczykowski-Górecki

Older gcc does not support #pragma GCC diagnostics, so use alternative approach - change variable type to uint32_t (this code handle 32-bit requests only anyway), which apparently also avoid gcc complaining about this (otherwise correct) code.

Quoted 6 lines
Quoted 4 lines

Fixes 437e00fea04becc91c1b6bc1c0baa636b067a5cc "tools/kdd: mute spurious gcc warning"

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
In reply to Marek Marczykowski-Górecki
Quoted 9 lines · Marek Marczykowski-Górecki

Older gcc does not support #pragma GCC diagnostics, so use alternative approach - change variable type to uint32_t (this code handle 32-bit requests only anyway), which apparently also avoid gcc complaining about this (otherwise correct) code.

Fixes 437e00fea04becc91c1b6bc1c0baa636b067a5cc "tools/kdd: mute spurious gcc warning"

I'm confused. Do we still need this? Gcc 8.1 seems to have fixed the bug which caused compilation failure.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 6 lines · Wei Liu
Quoted 5 lines · Marek Marczykowski-Górecki

Older gcc does not support #pragma GCC diagnostics, so use alternative approach - change variable type to uint32_t (this code handle 32-bit requests only anyway), which apparently also avoid gcc complaining about this (otherwise correct) code.

Quoted 7 lines
Quoted 4 lines

Fixes 437e00fea04becc91c1b6bc1c0baa636b067a5cc "tools/kdd: mute spurious gcc warning"

I'm confused. Do we still need this? Gcc 8.1 seems to have fixed the bug which caused compilation failure.

Apparently not entirely - see my other email. It still fails on Fedora 28 with gcc 8.1.

Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#5 lore raw
Quoted 10 lines · Marek Marczykowski-Górecki
Quoted 9 lines · Wei Liu
Quoted 8 lines · Marek Marczykowski-Górecki

Older gcc does not support #pragma GCC diagnostics, so use alternative approach - change variable type to uint32_t (this code handle 32-bit requests only anyway), which apparently also avoid gcc complaining about this (otherwise correct) code.

Fixes 437e00fea04becc91c1b6bc1c0baa636b067a5cc "tools/kdd: mute spurious gcc warning"

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I'm confused. Do we still need this? Gcc 8.1 seems to have fixed the bug which caused compilation failure.

Apparently not entirely - see my other email. It still fails on Fedora 28 with gcc 8.1.

Oh I missed that, sorry.

In that case we should take this patch instead:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel