Re: CFT: snmalloc as libc malloc [snmalloc misidentifies what llvm versions have source_location: need >= 16, not 15]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 13 Feb 2023 22:01:29 UTC
On Feb 13, 2023, at 02:43, David Chisnall <theraven@FreeBSD.org> wrote:

> On 12/02/2023 22:53, Mark Millard wrote:
>> [snmalloc misidentifies what llvm versions have source_location .]
> 
> Thanks, I thought snmalloc included the code I wrote in a related project to do this, but apparently not.  I've opened a PR to fix it and will merge once it passes CI, then bump the submodule:
> 
> https://github.com/microsoft/snmalloc/pull/591
> 

For the:

-#if (defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 11) || \
-  (defined(__clang__) && __clang_major__ >= 15)
+#ifdef __cpp_lib_source_location

My understanding is that __cpp_lib_source_location is guaranteed
to potentially become defined basically only 2 ways:

A) inclusion of <source_location>
B) inclusion of <version>

Clearly (A) is not the case here and would require a
__has_include(<source_location>) test to allow this style
of attempting to get a definition for
__cpp_lib_source_location .

I looked a round some and did not notice an example of (B),
but I may have missed it.

So, it might be that this changed turned off use of
<source_location> in unintended places.

===
Mark Millard
marklmi at yahoo.com