[RFC, libstdc++] Implement C++20 P1208R6 - source_location.
Ed Smith-Rowland via libstdc++
libstdc++@gcc.gnu.org
Fri Nov 8 23:12:00 GMT 2019
As an experiment, I took a shot at implementing source_location for
C++20.?? This was mostly done in experimental but I wanted to try adding
column information.?? (The experimental version just returned 0).?? I
added __builtin_COLUMN in analogy to __builtin_LINE.?? The std version is
also consteval so you get different results in some cases wrt
experimental. You can diff the two 1.cc test cases in libstdc++ to see
for yourself.
As Jonathan mentioned on IRC, we probably want a single builtin and we
want to coordinate the name with clang (__builtin_source_location?).??
But this "works" and it might make useful fodder for the next round.
Ed
-------------- next part --------------
gcc/ChangeLog
2019-11-08 Ed Smith-Rowland <3dw4rd@verizon.net>
Implement C++20 P1208R6 - source_location. Implement column with a
__builtin_COLUMN for both std and experimental. The std current()
is consteval.
* builtins.c (fold_builtin_COLUMN): New function.
(fold_builtin_0): Use it.
* builtins.def: Add __builtin_COLUMN.
* doc/extend.texi: Doc __builtin_COLUMN.
* testsuite/c-c++-common/builtin_location.c: __builtin_COLUMN() tests.
* testsuite/c-c++-common/cpp/has-builtin-2.c: __builtin_COLUMN test.
libstdc++-v3/ChangeLog
2019-11-08 Ed Smith-Rowland <3dw4rd@verizon.net>
Implement C++20 P1208R6 - source_location. Implement column with a
__builtin_COLUMN for both std and experimental. The std current()
is consteval.
* include/experimental/source_location: Call __builtin_COLUMN
* include/std/source_location: New header.
* include/std/version: Add <source_location>
* testsuite/20_util/source_location/1.cc: New test.
* libstdc++-v3/testsuite/experimental/source_location/1.cc: Test column.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source_location.patch
Type: text/x-patch
Size: 12897 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20191108/b46210b4/attachment.bin>
More information about the Libstdc++
mailing list