[patch] Use __builtin_FILE and __builtin_LINE in assert implementation in C++

Florian Weimer fweimer@redhat.com
Sun Feb 5 22:34:17 GMT 2023


* Paul Pluzhnikov:

> +#  if __has_builtin(__builtin_FILE)
> +#   define __ASSERT_FILE __builtin_FILE()
> +#   define __ASSERT_LINE __builtin_LINE()
> +#  else
> +#   define __ASSERT_FILE __FILE__
> +#   define __ASSERT_LINE __LINE__
> +#  endif

__has_builtin itself needs to be conditionalized. 8-(

Please use __glibc_assert_file or something like that.  __ASSERT_FILE
sounds like something someone else might use (although it's in the
implementation namespace).

I think the general direction is fine.

Thanks,
Florian



More information about the Libc-alpha mailing list