glibc/assert
Paul Pluzhnikov e42ec82219 Use __builtin_FILE instead of __FILE__ in assert in C++.
Likewise use __builtin_LINE instead of __LINE__.

When building C++, inline functions are required to have the exact same
sequence of tokens in every translation unit. But __FILE__ token, when
used in a header file, does not necessarily expand to the exact same
string literal, and that may cause compilation failure when C++ modules
are being used. (It would also cause unpredictable output on assertion
failure at runtime, but this rarely matters in practice.)

For example, given the following sources:

  // a.h
  #include <assert.h>
  inline void fn () { assert (0); }

  // a.cc
  #include "a.h"

  // b.cc
  #include "foo/../a.h"

preprocessing a.cc will yield a call to __assert_fail("0", "a.h", ...)
but b.cc will yield __assert_fail("0", "foo/../a.h", ...)
2023-02-10 17:12:40 +00:00
..
__assert.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
__libc_assert_fail.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
assert-perr.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
assert.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
assert.h Use __builtin_FILE instead of __FILE__ in assert in C++. 2023-02-10 17:12:40 +00:00
Depend Update. 2000-07-01 05:19:18 +00:00
Makefile Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
test-assert-perr.c Update. 2000-12-05 08:17:58 +00:00
test-assert.c Update. 2000-12-05 08:17:58 +00:00
tst-assert-c++.cc Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
tst-assert-g++.cc Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
Versions Update. 2000-08-02 00:09:25 +00:00