Thread (6 messages) flat view 6 messages, 3 authors, 2012-11-11

Re: [PATCH 1/1] HID: microsoft, fix invalid rdesc for 3k kbd

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2012-11-04 21:06:52
Also in: lkml

On Fri, Oct 19, 2012 at 1:28 PM, Jiri Slaby [off-list ref] wrote:
+       if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
+                       !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
+                               &rdesc[94], 4)) {
Which version of gcc are you using?

I'm getting (m68k-linux-gnu-gcc 4.1.2):

drivers/hid/hid-microsoft.c:51:18: error: macro "memcmp" passed 6
arguments, but takes just 3
drivers/hid/hid-microsoft.c: In function ‘ms_report_fixup’:
drivers/hid/hid-microsoft.c:50: error: ‘memcmp’ undeclared (first use
in this function)
drivers/hid/hid-microsoft.c:50: error: (Each undeclared identifier is
reported only once
/drivers/hid/hid-microsoft.c:50: error: for each function it appears in.)

Extracted into this test case:

---snip---
#include <string.h>

#define memcmp(a, b, c) memcmp((a), (b), (c))

int f(unsigned char *rdesc)
{
    return memcmp((char []){ 0x19, 0x00, 0x29, 0xff }, &rdesc[94], 4);
}
---snip---

it also fails with gcc-3.4/4.1/4.2/4.3/4.4 of Ubuntu 10.04 on amd64.

Interestingly, it doesn't fail if I remove the #define for memcmp. So it seems
to work if memcmp() is a real function, not a #define.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help