ACK: [PATCH] Fix null_gass initializer for older versions of gcc (LP: #1549429)
ivanhu
ivan.hu at canonical.com
Thu Feb 25 02:34:10 UTC 2016
On 2016年02月25日 02:38, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> const fwts_acpi_gas null_gas = { 0 } causes a build failure with
> older compilers, such as gcc 4.6 (on Trusty):
>
> acpi/fadt/fadt.c: In function 'acpi_table_check_fadt_reduced_hardware':
> acpi/fadt/fadt.c:447:2: error: missing initializer
> [-Werror=missing-field-initializers]
> acpi/fadt/fadt.c:447:2: error: (near initialization for
> 'null_gas.register_bit_width') [-Werror=missing-field-initializers]
>
> make null_gas a static const - this will then be initialized as all
> zeros just once at run time and it is compatible with older versions
> of gcc too. Note this is a read-only struct, so this is fine to init
> like this
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpi/fadt/fadt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
> index 6dc324e..4dba8f1 100644
> --- a/src/acpi/fadt/fadt.c
> +++ b/src/acpi/fadt/fadt.c
> @@ -444,7 +444,7 @@ static void acpi_table_check_fadt_reduced_hardware(fwts_framework *fw)
> const char *IS_NOT = "IS NOT";
> bool rhw;
> bool passed;
> - const fwts_acpi_gas null_gas = { 0 };
> + static const fwts_acpi_gas null_gas;
> uint32_t flag_mask;
>
> rhw = fwts_acpi_is_reduced_hardware(fadt);
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list