diff options
author | Ed Smith-Rowland <3dw4rd@verizon.net> | 2021-02-02 16:11:57 -0500 |
---|---|---|
committer | Ed Smith-Rowland <3dw4rd@verizon.net> | 2021-02-03 12:12:31 -0500 |
commit | 1f69e63cfcc664fd7382dd877846007652a01dcf (patch) | |
tree | 044c232c236da131484baffa67d63b1cab0eac55 /gcc/c-family/c-cppbuiltin.c | |
parent | 530203d6e3244c25eda4124f0fa5756ca9a5683e (diff) | |
download | gcc-1f69e63cfcc664fd7382dd877846007652a01dcf.zip gcc-1f69e63cfcc664fd7382dd877846007652a01dcf.tar.gz gcc-1f69e63cfcc664fd7382dd877846007652a01dcf.tar.bz2 |
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.
Diffstat (limited to 'gcc/c-family/c-cppbuiltin.c')
-rw-r--r-- | gcc/c-family/c-cppbuiltin.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index dca6815..48dec21 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -1025,6 +1025,11 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_aggregate_paren_init=201902L"); cpp_define (pfile, "__cpp_using_enum=201907L"); } + if (cxx_dialect > cxx20) + { + /* Set feature test macros for C++23. */ + cpp_define (pfile, "__cpp_size_t_suffix=202006L"); + } if (flag_concepts) { if (cxx_dialect >= cxx20) |