Message ID | 1456339097-13169-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 2016年02月25日 02:38, Colin King wrote: > From: Colin Ian King <colin.king@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@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@canonical.com>
On 2016-02-25 02:38 AM, Colin King wrote: > From: Colin Ian King <colin.king@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@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: Alex Hung <alex.hung@canonical.com>
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);