Skip to content
  • Daniele Buono's avatar
    a58cabd0
    s390x: Avoid variable size warning in ipl.h · a58cabd0
    Daniele Buono authored
    
    
    S390IPLState contains two IplParameterBlock, which may in turn have
    either a IPLBlockPV or a IplBlockFcp, both ending with a variable
    sized field (an array).
    
    This causes a warning with clang 11 or greater, which checks that
    variable sized type are only allocated at the end of the struct:
    
    In file included from ../qemu-cfi-v3/target/s390x/diag.c:21:
    ../qemu-cfi-v3/hw/s390x/ipl.h:161:23: error: field 'iplb' with variable sized type 'IplParameterBlock' (aka 'union IplParameterBlock') not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
        IplParameterBlock iplb;
                          ^
    ../qemu-cfi-v3/hw/s390x/ipl.h:162:23: error: field 'iplb_pv' with variable sized type 'IplParameterBlock' (aka 'union IplParameterBlock') not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
        IplParameterBlock iplb_pv;
    
    In this case, however, the warning is a false positive, because
    IPLBlockPV and IplBlockFcp are allocated in a union wrapped at 4K,
    making the union non-variable sized.
    
    Fix the warning by turning the two variable sized arrays into arrays
    of size 0. This avoids the compiler error and should produce the
    same code.
    
    Signed-off-by: default avatarDaniele Buono <dbuono@linux.vnet.ibm.com>
    Message-Id: <20201105221905.1350-5-dbuono@linux.vnet.ibm.com>
    Acked-by: default avatarCornelia Huck <cohuck@redhat.com>
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    a58cabd0
    s390x: Avoid variable size warning in ipl.h
    Daniele Buono authored
    
    
    S390IPLState contains two IplParameterBlock, which may in turn have
    either a IPLBlockPV or a IplBlockFcp, both ending with a variable
    sized field (an array).
    
    This causes a warning with clang 11 or greater, which checks that
    variable sized type are only allocated at the end of the struct:
    
    In file included from ../qemu-cfi-v3/target/s390x/diag.c:21:
    ../qemu-cfi-v3/hw/s390x/ipl.h:161:23: error: field 'iplb' with variable sized type 'IplParameterBlock' (aka 'union IplParameterBlock') not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
        IplParameterBlock iplb;
                          ^
    ../qemu-cfi-v3/hw/s390x/ipl.h:162:23: error: field 'iplb_pv' with variable sized type 'IplParameterBlock' (aka 'union IplParameterBlock') not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
        IplParameterBlock iplb_pv;
    
    In this case, however, the warning is a false positive, because
    IPLBlockPV and IplBlockFcp are allocated in a union wrapped at 4K,
    making the union non-variable sized.
    
    Fix the warning by turning the two variable sized arrays into arrays
    of size 0. This avoids the compiler error and should produce the
    same code.
    
    Signed-off-by: default avatarDaniele Buono <dbuono@linux.vnet.ibm.com>
    Message-Id: <20201105221905.1350-5-dbuono@linux.vnet.ibm.com>
    Acked-by: default avatarCornelia Huck <cohuck@redhat.com>
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Loading