[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <152261525140.30503.4153878451546376512.stgit@warthog.procyon.org.uk>
Date: Sun, 01 Apr 2018 21:40:51 +0100
From: David Howells <dhowells@...hat.com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH 06/45] C++: Do some basic C++ type definition
NULL should be defined as nullptr rather than (void *)0 as nullptr is a
special compiler type.
Don't define bool, true and false as these are defined by the compiler.
Signed-off-by: David Howells <dhowells@...hat.com>
---
include/linux/stddef.h | 12 ++++++------
include/linux/types.h | 2 --
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index 998a4ba28eba..470cf32e9119 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -4,13 +4,13 @@
#include <uapi/linux/stddef.h>
-#undef NULL
-#define NULL ((void *)0)
+/*
+ * The type of the NULL pointer. This is a special C++ pointer type.
+ */
+typedef decltype(nullptr) nullptr_t;
-enum {
- false = 0,
- true = 1
-};
+#undef NULL
+#define NULL nullptr
#undef offsetof
#ifdef __compiler_offsetof
diff --git a/include/linux/types.h b/include/linux/types.h
index 31e8258ac048..68323cb03910 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -31,8 +31,6 @@ typedef __kernel_timer_t timer_t;
typedef __kernel_clockid_t clockid_t;
typedef __kernel_mqd_t mqd_t;
-typedef _Bool bool;
-
typedef __kernel_uid32_t uid_t;
typedef __kernel_gid32_t gid_t;
typedef __kernel_uid16_t uid16_t;
Powered by blists - more mailing lists