Re: [kvm-unit-tests RFC PATCH v2 2/5] lib/{bitops, alloc_page}.h: Add missing headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexandru,
On 10/27/20 6:19 PM, Alexandru Elisei wrote:
> bitops.h uses the 'bool' and 'size_t' types, but doesn't include the
> stddef.h and stdbool.h headers, where the types are defined. This can cause
> the following error when compiling:
> 
> In file included from arm/new-test.c:9:
> /path/to/kvm-unit-tests/lib/bitops.h:77:15: error: unknown type name 'bool'
>    77 | static inline bool is_power_of_2(unsigned long n)
>       |               ^~~~
> /path/to/kvm-unit-tests/lib/bitops.h:82:38: error: unknown type name 'size_t'
>    82 | static inline unsigned int get_order(size_t size)
>       |                                      ^~~~~~
> /path/to/kvm-unit-tests/lib/bitops.h:24:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
>    23 | #include <asm/bitops.h>
>   +++ |+#include <stddef.h>
>    24 |
> make: *** [<builtin>: arm/new-test.o] Error 1
> 
> The same errors were observed when including alloc_page.h. Fix both files
> by including stddef.h and stdbool.h.
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
> ---
>  lib/alloc_page.h | 2 ++
>  lib/bitops.h     | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/lib/alloc_page.h b/lib/alloc_page.h
> index 88540d1def06..182862c43363 100644
> --- a/lib/alloc_page.h
> +++ b/lib/alloc_page.h
> @@ -4,6 +4,8 @@
>   * This is a simple allocator that provides contiguous physical addresses
>   * with byte granularity.
>   */
> +#include <stdbool.h>
> +#include <stddef.h>
nit: you may move those includes after the #ifndef ALLOC_PAGE_H as it is
usually done.
>  
>  #ifndef ALLOC_PAGE_H
>  #define ALLOC_PAGE_H 1
> diff --git a/lib/bitops.h b/lib/bitops.h
> index 308aa86514a8..5aeea0b998b1 100644
> --- a/lib/bitops.h
> +++ b/lib/bitops.h
> @@ -1,5 +1,7 @@
>  #ifndef _BITOPS_H_
>  #define _BITOPS_H_
> +#include <stdbool.h>
> +#include <stddef.h>
>  
>  /*
>   * Adapted from
> 
Besides
Reviewed-by: Eric Auger <eric.auger@xxxxxxxxxx>

Thanks

Eric


_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux