diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2023-02-10 16:14:30 +0000 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2023-02-10 17:12:40 +0000 |
commit | e42ec822190056895e55e5140ce2304e67e34445 (patch) | |
tree | 9642f122730aaee91cec7726970b7cde87cd7bf9 /stdlib/swapcontext.c | |
parent | 63550530d98db6e9c30dc96a3ea08411b873b23e (diff) | |
download | glibc-e42ec822190056895e55e5140ce2304e67e34445.tar glibc-e42ec822190056895e55e5140ce2304e67e34445.tar.gz glibc-e42ec822190056895e55e5140ce2304e67e34445.tar.bz2 glibc-e42ec822190056895e55e5140ce2304e67e34445.zip |
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", ...)
Diffstat (limited to 'stdlib/swapcontext.c')
0 files changed, 0 insertions, 0 deletions