[PATCH kvmtool 1/9] linux/err.h: Add missing stdbool.h include

Alexandru Elisei alexandru.elisei at arm.com
Mon Nov 15 08:56:57 PST 2021


Add missing header stdbool.h to avoid errors like this one, which can
happen if the including file doesn't include stdbool.h:

include/linux/err.h:33:15: error: type defaults to ‘int’ in declaration of ‘bool’ [-Werror=implicit-int]
   33 | static inline bool __must_check IS_ERR(__force const void *ptr)
      |               ^~~~
include/linux/err.h:33:15: error: variable ‘bool’ declared ‘inline’ [-Werror]
include/linux/err.h:33:1: error: ‘warn_unused_result’ attribute only applies to function types [-Werror=attributes]
   33 | static inline bool __must_check IS_ERR(__force const void *ptr)
      | ^~~~~~
include/linux/err.h:33:33: error: expected ‘,’ or ‘;’ before ‘IS_ERR’
   33 | static inline bool __must_check IS_ERR(__force const void *ptr)
      |                                 ^~~~~~
include/linux/err.h:38:15: error: type defaults to ‘int’ in declaration of ‘bool’ [-Werror=implicit-int]
   38 | static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
      |               ^~~~
include/linux/err.h:38:15: error: variable ‘bool’ declared ‘inline’ [-Werror]
include/linux/err.h:38:1: error: ‘warn_unused_result’ attribute only applies to function types [-Werror=attributes]
   38 | static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
      | ^~~~~~
include/linux/err.h:38:15: error: redundant redeclaration of ‘bool’ [-Werror=redundant-decls]
   38 | static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
      |               ^~~~
include/linux/err.h:33:15: note: previous declaration of ‘bool’ was here
   33 | static inline bool __must_check IS_ERR(__force const void *ptr)
      |               ^~~~
include/linux/err.h:38:33: error: expected ‘,’ or ‘;’ before ‘IS_ERR_OR_NULL’
   38 | static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
      |                                 ^~~~~~~~~~~~~~
include/linux/err.h: In function ‘PTR_ERR_OR_ZERO’:
include/linux/err.h:58:6: error: implicit declaration of function ‘IS_ERR’ [-Werror=implicit-function-declaration]
   58 |  if (IS_ERR(ptr))
      |      ^~~~~~
include/linux/err.h:58:6: error: nested extern declaration of ‘IS_ERR’ [-Werror=nested-externs]

Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
 include/linux/err.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/err.h b/include/linux/err.h
index a729120644d5..1256c7abfefa 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -1,6 +1,8 @@
 #ifndef _LINUX_ERR_H
 #define _LINUX_ERR_H
 
+#include <stdbool.h>
+
 #include <linux/compiler.h>
 #include <linux/types.h>
 
-- 
2.31.1




More information about the linux-arm-kernel mailing list