diff mbox series

[4/7] lib/src/fwts_acpi_tables: disable clang warning

Message ID 20180730183059.28039-5-colin.king@canonical.com
State Accepted
Headers show
Series abstract _Pragmas and minor changes to build with gcc and clang | expand

Commit Message

Colin Ian King July 30, 2018, 6:30 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

clang warns when we take the address of an object inside a
packed structure.  Disable this warning as I believe this
is OK for architectures that perform this operation.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_acpi_tables.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alex Hung July 31, 2018, 12:12 a.m. UTC | #1
On 2018-07-30 11:30 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> clang warns when we take the address of an object inside a
> packed structure.  Disable this warning as I believe this
> is OK for architectures that perform this operation.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index c7ba59be..f28ed60a 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -393,10 +393,13 @@ static int fwts_acpi_handle_fadt(
>   	/* Determine FACS addr and load it.
>   	 * Will ignore the missing FACS in the hardware-reduced mode.
>   	 */
> +PRAGMA_PUSH
> +PRAGMA_PACK_WARN_OFF
>   	result = fwts_acpi_handle_fadt_tables(fw, fadt,
>   			"FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL",
>   			&fadt->firmware_control, &fadt->x_firmware_ctrl,
>   			provenance);
> +PRAGMA_POP
>   	if (result != FWTS_OK) {
>   		if ((result == FWTS_NULL_POINTER) &&
>   				fwts_acpi_is_reduced_hardware(fadt)) {
> @@ -408,12 +411,15 @@ static int fwts_acpi_handle_fadt(
>   		}
>   	}
>   	/* Determine DSDT addr and load it */
> +PRAGMA_PUSH
> +PRAGMA_PACK_WARN_OFF
>   	if (fwts_acpi_handle_fadt_tables(fw, fadt,
>   	    "DSDT", "DSTD", "X_DSDT",
>   	    &fadt->dsdt, &fadt->x_dsdt, provenance) != FWTS_OK) {
>   		fwts_log_error(fw, "Failed to load DSDT.");
>   		return FWTS_ERROR;
>   	}
> +PRAGMA_POP
>   	return FWTS_OK;
>   }
>   
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu July 31, 2018, 7:49 a.m. UTC | #2
On 07/31/2018 02:30 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> clang warns when we take the address of an object inside a
> packed structure.  Disable this warning as I believe this
> is OK for architectures that perform this operation.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_acpi_tables.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index c7ba59be..f28ed60a 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -393,10 +393,13 @@ static int fwts_acpi_handle_fadt(
>  	/* Determine FACS addr and load it.
>  	 * Will ignore the missing FACS in the hardware-reduced mode.
>  	 */
> +PRAGMA_PUSH
> +PRAGMA_PACK_WARN_OFF
>  	result = fwts_acpi_handle_fadt_tables(fw, fadt,
>  			"FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL",
>  			&fadt->firmware_control, &fadt->x_firmware_ctrl,
>  			provenance);
> +PRAGMA_POP
>  	if (result != FWTS_OK) {
>  		if ((result == FWTS_NULL_POINTER) &&
>  				fwts_acpi_is_reduced_hardware(fadt)) {
> @@ -408,12 +411,15 @@ static int fwts_acpi_handle_fadt(
>  		}
>  	}
>  	/* Determine DSDT addr and load it */
> +PRAGMA_PUSH
> +PRAGMA_PACK_WARN_OFF
>  	if (fwts_acpi_handle_fadt_tables(fw, fadt,
>  	    "DSDT", "DSTD", "X_DSDT",
>  	    &fadt->dsdt, &fadt->x_dsdt, provenance) != FWTS_OK) {
>  		fwts_log_error(fw, "Failed to load DSDT.");
>  		return FWTS_ERROR;
>  	}
> +PRAGMA_POP
>  	return FWTS_OK;
>  }
>  
Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index c7ba59be..f28ed60a 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -393,10 +393,13 @@  static int fwts_acpi_handle_fadt(
 	/* Determine FACS addr and load it.
 	 * Will ignore the missing FACS in the hardware-reduced mode.
 	 */
+PRAGMA_PUSH
+PRAGMA_PACK_WARN_OFF
 	result = fwts_acpi_handle_fadt_tables(fw, fadt,
 			"FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL",
 			&fadt->firmware_control, &fadt->x_firmware_ctrl,
 			provenance);
+PRAGMA_POP
 	if (result != FWTS_OK) {
 		if ((result == FWTS_NULL_POINTER) &&
 				fwts_acpi_is_reduced_hardware(fadt)) {
@@ -408,12 +411,15 @@  static int fwts_acpi_handle_fadt(
 		}
 	}
 	/* Determine DSDT addr and load it */
+PRAGMA_PUSH
+PRAGMA_PACK_WARN_OFF
 	if (fwts_acpi_handle_fadt_tables(fw, fadt,
 	    "DSDT", "DSTD", "X_DSDT",
 	    &fadt->dsdt, &fadt->x_dsdt, provenance) != FWTS_OK) {
 		fwts_log_error(fw, "Failed to load DSDT.");
 		return FWTS_ERROR;
 	}
+PRAGMA_POP
 	return FWTS_OK;
 }