• D
    Rewrite keycode map to avoid a struct · d27efd8e
    Daniel P. Berrange 提交于
    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: NDaniel P. Berrange <berrange@redhat.com>
    d27efd8e
virkeycode-mapgen.py 2.0 KB