Date: Fri, 10 Feb 2023 12:53:18 -0800 From: Mark Millard <marklmi@yahoo.com> To: shawn.webb@hardenedbsd.org, FreeBSD Hackers <freebsd-hackers@freebsd.org>, Dimitry Andric <dim@FreeBSD.org> Cc: David Chisnall <theraven@FreeBSD.org> Subject: Re: CFT: snmalloc as libc malloc (the nullptr_t issue) Message-ID: <1982263E-57E0-4709-AAB3-DBB4F75C7546@yahoo.com> In-Reply-To: <22F8AD1A-C1F9-48FA-BCED-E165E2DA5260@yahoo.com> References: <22F8AD1A-C1F9-48FA-BCED-E165E2DA5260@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 10, 2023, at 12:01, Mark Millard <marklmi@yahoo.com> wrote: > Looks to me like FreeBSD's problem: there is a rule about <stddef.h> > inclusion leading to a definition of nullptr_t that is not being > followed. The details follow. >=20 > The complaint: >=20 > = /usr/obj/data/src/hardenedbsd/amd64.amd64/tmp/usr/include/c++/v1/cstddef:5= 0:9: error: no member named 'nullptr_t' in the global namespace > using ::nullptr_t; >=20 > is reported against text in FreeBSD's usr/include/c++/v1/cstddef > (so against the llvm15 integration). >=20 > cppreference.com <http://cppreference.com/> reports for nullptr_t : >=20 > . . . > Defined in header <cstddef> > using nullptr_t =3D decltype(nullptr); >=20 > Notes > nullptr_t is available in the global namespace when <stddef.h> is = included, even if it is not a part of C99~C17 (referenced by = C++11~C++20). > nullptr_t is also a part of C since C23. > . . . >=20 > c++/v1/cstddef has, in part: >=20 > . . . > #include <stddef.h> > #include <version> >=20 > #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) > # pragma GCC system_header > #endif >=20 > _LIBCPP_BEGIN_NAMESPACE_STD >=20 > using ::nullptr_t; > . . . >=20 > But, in FreeBSD, <stddef.h> directly and indirectly does not lead to > a nullptr_t definition as far as I could find. >=20 I missed the fact that there is another stddef.h: /usr/include/c++/v1/stddef.h that looks like: // -*- C++ -*- = //=3D=3D=3D---------------------------------------------------------------= -------=3D=3D=3D// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM = Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // = //=3D=3D=3D---------------------------------------------------------------= -------=3D=3D=3D// #if defined(__need_ptrdiff_t) || defined(__need_size_t) || \ defined(__need_wchar_t) || defined(__need_NULL) || = defined(__need_wint_t) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #include_next <stddef.h> #elif !defined(_LIBCPP_STDDEF_H) #define _LIBCPP_STDDEF_H /* stddef.h synopsis Macros: offsetof(type,member-designator) NULL Types: ptrdiff_t size_t max_align_t // C++11 nullptr_t */ #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #include_next <stddef.h> #ifdef __cplusplus typedef decltype(nullptr) nullptr_t; #endif #endif // _LIBCPP_STDDEF_H So, another way of saying things is: this one seems to not be in use but should be. Note the dependency on defined(__need_NULL) for the initial #if . =3D=3D=3D Mark Millard marklmi at yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1982263E-57E0-4709-AAB3-DBB4F75C7546>