]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Rewrite keycode map to avoid a struct
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 3 Apr 2013 12:51:56 +0000 (13:51 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 8 Apr 2013 09:03:20 +0000 (10:03 +0100)
commitd27efd8e5d15117b19b66fda6ec88c87468d3897
treed226912d42a4eed12d2a4c832f3aca2e90a293e8
parent15d8511b41e88196e8c67a45eefc45c9552806f3
Rewrite keycode map to avoid a struct

Playing games with field offsets in a struct causes all sorts
of alignment warnings on ARM platforms

util/virkeycode.c: In function '__virKeycodeValueFromString':
util/virkeycode.c:26:7: warning: cast increases required alignment of target type [-Wcast-align]
     (*(typeof(field_type) *)((char *)(object) + field_offset))
       ^
util/virkeycode.c:91:28: note: in expansion of macro 'getfield'
         const char *name = getfield(virKeycodes + i, const char *, name_offset);
                            ^
util/virkeycode.c:26:7: warning: cast increases required alignment of target type [-Wcast-align]
     (*(typeof(field_type) *)((char *)(object) + field_offset))
       ^
util/virkeycode.c:94:20: note: in expansion of macro 'getfield'
             return getfield(virKeycodes + i, unsigned short, code_offset);
                    ^
util/virkeycode.c: In function '__virKeycodeValueTranslate':
util/virkeycode.c:26:7: warning: cast increases required alignment of target type [-Wcast-align]
     (*(typeof(field_type) *)((char *)(object) + field_offset))
       ^
util/virkeycode.c:127:13: note: in expansion of macro 'getfield'
         if (getfield(virKeycodes + i, unsigned short, from_offset) == key_value)
             ^
util/virkeycode.c:26:7: warning: cast increases required alignment of target type [-Wcast-align]
     (*(typeof(field_type) *)((char *)(object) + field_offset))
       ^
util/virkeycode.c:128:20: note: in expansion of macro 'getfield'
             return getfield(virKeycodes + i, unsigned short, to_offset);

There is no compelling reason to use a struct for the keycode
tables. It can easily just use an array of arrays instead,
avoiding all alignment problems

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/virkeycode-mapgen.py
src/util/virkeycode.c