git: a892d594a20b - main - Don't define NULL to nullptr in C++11 mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Jun 2025 17:55:41 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=a892d594a20baa851a5850f0b3ae6f4d81c99a08
commit a892d594a20baa851a5850f0b3ae6f4d81c99a08
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-06-16 17:54:47 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-06-16 17:54:47 +0000
Don't define NULL to nullptr in C++11 mode
While C++ does seem to permit this, both GCC and clang do not do this
in their bundled <stddef.h> headers. Instead, both use the __null
builtin (and g++ unconditionally overrides NULL back to __null).
Our local change makes FreeBSD's C++ environment subtly different from
the rest of the world such that code that compiles fine with clang++
on FreeBSD doesn't compile fine on other systems and doesn't compile
on FreeBSD using g++.
This reverts commit 3033610f5dfd03b68de35631a8693963a80099c2.
PR: 286477 (exp-run)
Reviewed by: olce, imp, dim, emaste
Differential Revision: https://reviews.freebsd.org/D50089
---
sys/sys/_null.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sys/sys/_null.h b/sys/sys/_null.h
index 28a7bd7f6708..f5c4223b9b8c 100644
--- a/sys/sys/_null.h
+++ b/sys/sys/_null.h
@@ -31,9 +31,7 @@
#if !defined(__cplusplus)
#define NULL ((void *)0)
#else
-#if __cplusplus >= 201103L
-#define NULL nullptr
-#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
+#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
#define NULL __null
#else
#if defined(__LP64__)