ACK: [PATCH] lib: framework: pack fwts_framework_flags to ensure it is a 32 bit int
Alex Hung
alex.hung at canonical.com
Wed Nov 11 02:51:26 UTC 2015
On 11/09/2015 09:20 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> recent commit c4091edad369beb12b451a0ab5f233fcda05a5f3
> ("Add in the notion of ACPI compliance tests.") make the fwts_framework_flags
> enum into a 64 bit integer which now breaks 32 bit builds:
>
> fwts_framework.c: In function 'fwts_framework_test_add':
> fwts_framework.c:155:4: error: format '%lx' expects argument of type
> 'long unsigned int', but argument 4 has type 'long long unsigned int'
> [-Werror=format]
>
> Since we have a bunch of spare bits in this enum, re-orginaise the bits to
> pack this into a 32 bit enum. Once we've used all these bits up we should
> consider making the enum into a 64 bit integer, but for now, try to save
> a few bytes by keeping this a 32 bit integer.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/include/fwts_framework.h | 30 +++++++++++++++---------------
> src/lib/src/fwts_framework.c | 2 +-
> 2 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
> index 7883339..0ae8321 100644
> --- a/src/lib/include/fwts_framework.h
> +++ b/src/lib/include/fwts_framework.h
> @@ -40,21 +40,21 @@ typedef enum {
> FWTS_FLAG_SHOW_PROGRESS_DIALOG = 0x00000010,
> FWTS_FLAG_ACPICA_DEBUG = 0x00000020,
> FWTS_FLAG_DUMP = 0x00000040,
> - FWTS_FLAG_BATCH = 0x00001000,
> - FWTS_FLAG_INTERACTIVE = 0x00002000,
> - FWTS_FLAG_BATCH_EXPERIMENTAL = 0x00004000,
> - FWTS_FLAG_INTERACTIVE_EXPERIMENTAL = 0x00008000,
> - FWTS_FLAG_POWER_STATES = 0x00010000,
> - FWTS_FLAG_ROOT_PRIV = 0x00020000,
> - FWTS_FLAG_UNSAFE = 0x00040000,
> - FWTS_FLAG_TEST_BIOS = 0x01000000,
> - FWTS_FLAG_TEST_UEFI = 0x02000000,
> - FWTS_FLAG_TEST_ACPI = 0x04000000,
> - FWTS_FLAG_UTILS = 0x08000000,
> - FWTS_FLAG_QUIET = 0x10000000,
> - FWTS_FLAG_SHOW_TESTS_FULL = 0x20000000,
> - FWTS_FLAG_SHOW_TESTS_CATEGORIES = 0x40000000,
> - FWTS_FLAG_TEST_COMPLIANCE_ACPI = 0x100000000
> + FWTS_FLAG_BATCH = 0x00000100,
> + FWTS_FLAG_INTERACTIVE = 0x00000200,
> + FWTS_FLAG_BATCH_EXPERIMENTAL = 0x00000400,
> + FWTS_FLAG_INTERACTIVE_EXPERIMENTAL = 0x00000800,
> + FWTS_FLAG_POWER_STATES = 0x00001000,
> + FWTS_FLAG_ROOT_PRIV = 0x00002000,
> + FWTS_FLAG_UNSAFE = 0x00004000,
> + FWTS_FLAG_TEST_BIOS = 0x00010000,
> + FWTS_FLAG_TEST_UEFI = 0x00020000,
> + FWTS_FLAG_TEST_ACPI = 0x00040000,
> + FWTS_FLAG_UTILS = 0x00080000,
> + FWTS_FLAG_QUIET = 0x00100000,
> + FWTS_FLAG_SHOW_TESTS_FULL = 0x00200000,
> + FWTS_FLAG_SHOW_TESTS_CATEGORIES = 0x00400000,
> + FWTS_FLAG_TEST_COMPLIANCE_ACPI = 0x00800000
> } fwts_framework_flags;
>
> #define FWTS_FLAG_TEST_MASK \
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index 9739c7b..3c2cef8 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -151,7 +151,7 @@ void fwts_framework_test_add(
> fwts_framework_test *new_test;
>
> if (flags & ~(FWTS_FLAG_RUN_ALL | FWTS_FLAG_ROOT_PRIV)) {
> - fprintf(stderr, "Test %s flags must be a bit field in 0x%lx, got 0x%lx\n",
> + fprintf(stderr, "Test %s flags must be a bit field in 0x%x, got 0x%x\n",
> name, FWTS_FLAG_RUN_ALL, flags);
> exit(EXIT_FAILURE);
> }
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list