c++: Implement C++23 P0330 - Literal Suffixes for ptrdiff_t and size_t.
authorEd Smith-Rowland <3dw4rd@verizon.net>
Tue, 2 Feb 2021 21:11:57 +0000 (16:11 -0500)
committerEd Smith-Rowland <3dw4rd@verizon.net>
Wed, 3 Feb 2021 17:12:31 +0000 (12:12 -0500)
commit1f69e63cfcc664fd7382dd877846007652a01dcf
tree044c232c236da131484baffa67d63b1cab0eac55
parent530203d6e3244c25eda4124f0fa5756ca9a5683e
c++: Implement C++23 P0330 - Literal Suffixes for ptrdiff_t and size_t.

Integer literal suffixes for signed size ('z') and unsigned size
(some permutation od 'zu') are provided as a language addition.

gcc/c-family/ChangeLog:

* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_size_t_suffix.
* c-lex.c (interpret_integer): Set node type for size literal.

libcpp/ChangeLog:

* expr.c (interpret_int_suffix): Detect 'z' integer suffix.
(cpp_classify_number): Compat warning for use of 'z' suffix.
* include/cpplib.h (struct cpp_options): New flag.
(enum cpp_warning_reason): New flag.
(CPP_N_USERDEF): Comment C++0x -> C++11.
(CPP_N_SIZE_T): New flag for cpp_classify_number.
* init.c (cpp_set_lang): Initialize new flag.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/udlit-shadow-neg.C: Test for 'z' and 'zu' shadowing.
* g++.dg/cpp23/feat-cxx2b.C: New test.
* g++.dg/cpp23/size_t-literals.C: New test.
* g++.dg/warn/Wsize_t-literals.C: New test.
gcc/c-family/c-cppbuiltin.c
gcc/c-family/c-lex.c
gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C
gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp23/size_t-literals.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wsize_t-literals.C [new file with mode: 0644]
libcpp/expr.c
libcpp/include/cpplib.h
libcpp/init.c