On Wed, Jun 28, 2017 at 10:13:25PM +0200, Fasse wrote:
> When building OpenBSD with the ACPIVIDEO_DEBUG option set the
> compilation fails:
> 
> cc1: warnings being treated as errors
> /usr/src/sys/dev/acpi/acpivideo.c: In function 'acpivideo_set_policy':
> /usr/src/sys/dev/acpi/acpivideo.c:136: warning: format '%X' expects type 
> 'unsigned int', but argument 3 has type 'int64_t'
> /usr/src/sys/dev/acpi/acpivideo.c:136: error: expected expression before '/' 
> token
> *** Error 1 in /usr/src/sys/arch/amd64/compile/CUSTOM (Makefile:960 
> 'acpivideo.o')
> 
> 
> The return type of aml_val2int (AML_EVALNODE(9)) is int64_t.
> The 'patch' below switches to the format specifier %lld. According to
> C99 long long must be at least 64 bit wide so it should be fine!?
> Otherwise, <inttypes.h> and PRId64 might be an option. However, quickly
> searching the src-tree reveals PRId64 is seldom used.
> 
> 
> Index: src/sys/dev/acpi/acpivideo.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/acpi/acpivideo.c,v
> retrieving revision 1.10
> diff -u -p -u -r1.10 acpivideo.c
> --- src/sys/dev/acpi/acpivideo.c      14 Mar 2015 03:38:47 -0000      1.10
> +++ src/sys/dev/acpi/acpivideo.c      28 Jun 2017 18:39:48 -0000
> @@ -132,7 +132,7 @@ acpivideo_set_policy(struct acpivideo_so
>       args.type = AML_OBJTYPE_INTEGER;
>  
>       aml_evalname(sc->sc_acpi, sc->sc_devnode, "_DOS", 1, &args, &res);
> -     DPRINTF(("%s: set policy to %X\n", DEVNAME(sc), aml_val2int(&res)));
> +     DPRINTF(("%s: set policy to %lld\n", DEVNAME(sc), aml_val2int(&res)));
>  
>       aml_freevalue(&res);
>  }
> 

thanks. fixed.

Reply via email to