aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-01-03Update copyright years.Jakub Jelinek3-3/+3
2023-12-07c-family: Fix up -fno-debug-cpp [PR111965]Jakub Jelinek2-0/+10
As can be seen in the second testcase, -fno-debug-cpp is actually implemented the same as -fdebug-cpp and so doesn't turn the debugging off. The following patch fixes that. 2023-12-07 Andrew Pinski <pinskia@gmail.com> Jakub Jelinek <jakub@redhat.com> PR preprocessor/111965 gcc/c-family/ * c-opts.cc (c_common_handle_option) <case OPT_fdebug_cpp>: Set cpp_opts->debug to value rather than 1. gcc/testsuite/ * gcc.dg/cpp/pr111965-1.c: New test. * gcc.dg/cpp/pr111965-2.c: New test.
2023-11-27libcpp: Fix unsigned promotion for unevaluated divide by zero [PR112701]Lewis Hyatt1-2/+20
When libcpp encounters a divide by zero while processing a constant expression "x/y", it returns "x" as a fallback. The value of the fallback is not normally important, since an error will be generated anyway, but if the expression appears in an unevaluated context, such as "0 ? 0/0u : -1", then there will be no error, and the fallback value will be meaningful to the extent that it may cause promotion from signed to unsigned of an operand encountered later. As the PR notes, libcpp does not do the unsigned promotion correctly in this case; fix it by making the fallback return value unsigned as necessary. libcpp/ChangeLog: PR preprocessor/112701 * expr.cc (num_div_op): Set unsignedp appropriately when returning a stub value for divide by 0. gcc/testsuite/ChangeLog: PR preprocessor/112701 * gcc.dg/cpp/expr.c: Add additional tests to cover divide by 0 in an unevaluated context, where the unsignedness still matters.
2023-11-15testsuite: Adjust gcc.dg/cpp/if-2.c for 16-bit targetsJakub Jelinek1-2/+2
Jeff reported this testcase newly FAILs on 16-bit targets, the following patch adjusts the expected diagnostics for that case. 2023-11-15 Jakub Jelinek <jakub@redhat.com> * gcc.dg/cpp/if-2.c: Adjust expected diagnostics for 16-bit targets.
2023-11-14c++: Implement C++26 P1854R4 - Making non-encodable string literals ↵Jakub Jelinek3-8/+8
ill-formed [PR110341] This paper voted in as DR makes some multi-character literals ill-formed. 'abcd' stays valid, but e.g. 'á' is newly invalid in UTF-8 exec charset while valid e.g. in ISO-8859-1, because it is a single character which needs 2 bytes to be encoded. The following patch does that by checking (only pedantically, especially because it is a DR) if we'd emit a -Wmultichar warning because character constant has more than one byte in it whether the number of source characters is equal to the number of bytes in the multichar string. If it is, it is normal multi-character literal constant and is diagnosed normally with -Wmultichar, otherwise at least one of the c-chars in the sequence was encoded as 2+ bytes. 2023-11-14 Jakub Jelinek <jakub@redhat.com> PR c++/110341 libcpp/ * charset.cc: Implement C++26 P1854R4 - Making non-encodable string literals ill-formed. (one_count_chars, convert_count_chars, count_source_chars): New functions. (narrow_str_to_charconst): Change last arg type from cpp_ttype to const cpp_token *. For C++ if pedantic and i > 1 in CPP_CHAR interpret token also as CPP_STRING32 and if number of characters in the CPP_STRING32 is larger than number of bytes in CPP_CHAR, pedwarn on it. Make the diagnostics more detailed. (wide_str_to_charconst): Change last arg type from cpp_ttype to const cpp_token *. Make the diagnostics more detailed. (cpp_interpret_charconst): Adjust narrow_str_to_charconst and wide_str_to_charconst callers. gcc/testsuite/ * g++.dg/cpp26/literals1.C: New test. * g++.dg/cpp26/literals2.C: New test. * g++.dg/cpp23/wchar-multi1.C: Adjust expected diagnostic wordings. * g++.dg/cpp23/wchar-multi2.C: Likewise. * gcc.dg/c23-utf8char-3.c: Likewise. * gcc.dg/cpp/charconst-4.c: Likewise. * gcc.dg/cpp/charconst.c: Likewise. * gcc.dg/cpp/if-2.c: Likewise. * gcc.dg/utf16-4.c: Likewise. * gcc.dg/utf32-4.c: Likewise. * g++.dg/cpp1z/utf8-neg.C: Likewise. * g++.dg/cpp2a/ucn2.C: Likewise. * g++.dg/ext/utf16-4.C: Likewise. * g++.dg/ext/utf32-4.C: Likewise.
2023-11-13C99 testsuite readiness: -fpermissive testsFlorian Weimer3-3/+3
These tests use obsolete language constructs, but they are not clearly targeting C89, either. So use -fpermissive to keep future errors as warnings. The reasons why obsolete constructs are used used vary from test to test. Some tests deliberately exercise later stages of the compiler that only occur with those constructs. Some tests have precise expectations about warnings that will become errors with a future change, but do not specifically test a particular warning/error (if that is the case, the later changes tend to duplicate them into warning/error variants). In a few cases, use of obsolete constructs is clearly due to test case reduction, but it was not possible to un-reduce the test due to its size. gcc/testsuite/ * c-c++-common/Wduplicated-branches-11.c: Compile with -fpermissive. * c-c++-common/Wduplicated-branches-12.c: Likewise. * c-c++-common/builtins.c: Likewise. * c-c++-common/pointer-to-fn1.c: Likewise. * gcc.c-torture/compile/20010320-1.c: Likewise. * gcc.c-torture/compile/20050105-1.c: Likewise. * gcc.c-torture/compile/20080704-1.c: Likewise. * gcc.c-torture/compile/20080910-1.c: Likewise. * gcc.c-torture/compile/20090917-1.c: Likewise. * gcc.c-torture/compile/20100915-1.c: Likewise. * gcc.c-torture/compile/20101216-1.c: Likewise. * gcc.c-torture/compile/20121027-1.c: Likewise. * gcc.c-torture/compile/20180605-1.c: Likewise. * gcc.c-torture/compile/950816-2.c: Likewise. * gcc.c-torture/compile/dse.c: Likewise. * gcc.c-torture/compile/pr100576.c: Likewise. * gcc.c-torture/compile/pr17408.c: Likewise. * gcc.c-torture/compile/pr19121.c: Likewise. * gcc.c-torture/compile/pr26213.c: Likewise. * gcc.c-torture/compile/pr27341-2.c: Likewise. * gcc.c-torture/compile/pr28776-2.c: Likewise. * gcc.c-torture/compile/pr33133.c: Likewise. * gcc.c-torture/compile/pr34091.c: Likewise. * gcc.c-torture/compile/pr36154.c: Likewise. * gcc.c-torture/compile/pr37381.c: Likewise. * gcc.c-torture/compile/pr38360.c: Likewise. * gcc.c-torture/compile/pr40291.c: Likewise. * gcc.c-torture/compile/pr41182-1.c: Likewise. * gcc.c-torture/compile/pr43635.c: Likewise. * gcc.c-torture/compile/pr44043.c: Likewise. * gcc.c-torture/compile/pr44063.c: Likewise. * gcc.c-torture/compile/pr44246.c: Likewise. * gcc.c-torture/compile/pr45535.c: Likewise. * gcc.c-torture/compile/pr46934.c: Likewise. * gcc.c-torture/compile/pr47428.c: Likewise. * gcc.c-torture/compile/pr49145.c: Likewise. * gcc.c-torture/compile/pr49206.c: Likewise. * gcc.c-torture/compile/pr51694.c: Likewise. * gcc.c-torture/compile/pr53886.c: Likewise. * gcc.c-torture/compile/pr65241.c: Likewise. * gcc.c-torture/compile/pr72802.c: Likewise. * gcc.c-torture/compile/pr81360.c: Likewise. * gcc.c-torture/compile/pr82052.c: Likewise. * gcc.c-torture/compile/pr90275-2.c: Likewise. * gcc.c-torture/compile/pr90275.c: Likewise. * gcc.c-torture/compile/pr96796.c: Likewise. * gcc.c-torture/compile/regs-arg-size.c: Likewise. * gcc.c-torture/compile/udivmod4.c: Likewise. * gcc.c-torture/compile/widechar-1.c: Likewise. * gcc.c-torture/execute/20000412-3.c: Likewise. * gcc.c-torture/execute/20010605-2.c: Likewise. * gcc.c-torture/execute/20020314-1.c: Likewise. * gcc.c-torture/execute/20020819-1.c: Likewise. * gcc.c-torture/execute/20031211-2.c: Likewise. * gcc.c-torture/execute/20040223-1.c: Likewise. * gcc.c-torture/execute/20041019-1.c: Likewise. * gcc.c-torture/execute/20120427-1.c: Likewise. * gcc.c-torture/execute/20120427-2.c: Likewise. * gcc.c-torture/execute/920908-2.c: Likewise. * gcc.c-torture/execute/921110-1.c: Likewise. * gcc.c-torture/execute/930111-1.c: Likewise. * gcc.c-torture/execute/930208-1.c: Likewise. * gcc.c-torture/execute/930702-1.c: Likewise. * gcc.c-torture/execute/930818-1.c: Likewise. * gcc.c-torture/execute/931017-1.c: Likewise. * gcc.c-torture/execute/931018-1.c: Likewise. * gcc.c-torture/execute/931208-1.c: Likewise. * gcc.c-torture/execute/941101-1.c: Likewise. * gcc.c-torture/execute/941110-1.c: Likewise. * gcc.c-torture/execute/950322-1.c: Likewise. * gcc.c-torture/execute/950426-1.c: Likewise. * gcc.c-torture/execute/950512-1.c: Likewise. * gcc.c-torture/execute/950621-1.c: Likewise. * gcc.c-torture/execute/960218-1.c: Likewise. * gcc.c-torture/execute/960402-1.c: Likewise. * gcc.c-torture/execute/cmpsf-1.c: Likewise. * gcc.c-torture/execute/cmpsi-1.c: Likewise. * gcc.c-torture/execute/cmpsi-2.c: Likewise. * gcc.c-torture/execute/divmod-1.c: Likewise. * gcc.c-torture/execute/pr22061-1.c: Likewise. * gcc.c-torture/execute/pr55875.c: Likewise. * gcc.dg/20050629-1.c: Likewise. * gcc.dg/20080615-1.c: Likewise. * gcc.dg/Walloca-14.c: Likewise. * gcc.dg/Wbuiltin-declaration-mismatch-3.c: Likewise. * gcc.dg/Wbuiltin-declaration-mismatch-9.c: Likewise. * gcc.dg/Wdouble-promotion.c: Likewise. * gcc.dg/Wrestrict-5.c: Likewise. * gcc.dg/Wstringop-overflow-13.c: Likewise. * gcc.dg/analyzer/fd-bind-pr107783.c: Likewise. * gcc.dg/array-5.c: Likewise. * gcc.dg/asan/pr56417.c: Likewise. * gcc.dg/attr-access-read-only.c: Likewise. * gcc.dg/attr-access-read-write.c: Likewise. * gcc.dg/attr-access-write-only.c: Likewise. * gcc.dg/bitint-36.c: Likewise. * gcc.dg/builtin-bswap-10.c: Likewise. * gcc.dg/cleanup-1.c: Likewise. * gcc.dg/cpp/pr60014-1.c: Likewise. * gcc.dg/cpp/pr60014-2.c: Likewise. * gcc.dg/cpp/pr60014-3.c: Likewise. * gcc.dg/ipa/ipa-bit-cp-1.c: Likewise. * gcc.dg/ipa/ipa-bit-cp-2.c: Likewise. * gcc.dg/ipa/ipa-bit-cp.c: Likewise. * gcc.dg/ipa/pr105639.c: Likewise. * gcc.dg/ipa/pr71981.c: Likewise. * gcc.dg/lto/20081109_0.c: Likewise. * gcc.dg/lto/pr54702_1.c: Likewise. * gcc.dg/lto/pr55525_0.c: Likewise. * gcc.dg/noncompile/20020213-1.c:: Likewise. * gcc.dg/noncompile/pr71426.c: Likewise. * gcc.dg/noncompile/undeclared-1.c: Likewise. * gcc.dg/overflow-warn-2.c: Likewise. * gcc.dg/pr100142.c: Likewise. * gcc.dg/pr100790.c: Likewise. * gcc.dg/pr100791.c: Likewise. * gcc.dg/pr103093.c: Likewise. * gcc.dg/pr105140.c: Likewise. * gcc.dg/pr105250.c: Likewise. * gcc.dg/pr105853.c: Likewise. * gcc.dg/pr105856.c: Likewise. * gcc.dg/pr26865.c: Likewise. * gcc.dg/pr40989.c: Likewise. * gcc.dg/pr42715.c: Likewise. * gcc.dg/pr44971.c: Likewise. * gcc.dg/pr46571.c: Likewise. * gcc.dg/pr54363.c: Likewise. * gcc.dg/pr56724-2.c: Likewise. * gcc.dg/pr59630.c: Likewise. * gcc.dg/pr67043.c: Likewise. * gcc.dg/pr67730-1.c: Likewise. * gcc.dg/pr67730-2.c: Likewise. * gcc.dg/pr68320.c: Likewise. * gcc.dg/pr69156.c: Likewise. * gcc.dg/pr69824.c: Likewise. * gcc.dg/pr70174.c: Likewise. * gcc.dg/pr70281.c: Likewise. * gcc.dg/pr77862.c: Likewise. * gcc.dg/pr82765.c: Likewise. * gcc.dg/pr83852.c: Likewise. * gcc.dg/pr84206.c: Likewise. * gcc.dg/pr85164-1.c: Likewise. * gcc.dg/pr85955.c: Likewise. * gcc.dg/pr86271.c: Likewise. * gcc.dg/pr86928.c: Likewise. * gcc.dg/pr99122-1.c: Likewise. * gcc.dg/pr99136.c: Likewise. * gcc.dg/redecl-19.c: Likewise. * gcc.dg/redecl-24.c: Likewise. * gcc.dg/torture/pr39204.c: Likewise. * gcc.dg/torture/pr57676.c: Likewise. * gcc.dg/torture/pr67222.c: Likewise. * gcc.dg/torture/pr77677-2.c: Likewise. * gcc.dg/torture/pr79125.c: Likewise. * gcc.dg/torture/pr94479.c: Likewise. * gcc.dg/tree-ssa/20070815.c: Likewise. * gcc.dg/tree-ssa/builtin-sprintf-29.c: Likewise. * gcc.dg/tree-ssa/builtins-folding-gimple-ub.c: Likewise. * gcc.dg/tree-ssa/pr22051-2.c: Likewise. * gcc.dg/tree-ssa/ssa-dse-10.c: Likewise. * gcc.target/aarch64/pr60697.c: Likewise. * gcc.target/aarch64/pr87305.c: Likewise. * gcc.target/aarch64/sve/pr96357.c: Likewise. * gcc.target/i386/attr-nocf-check-1a.c: Likewise. * gcc.target/i386/attr-nocf-check-3a.c: Likewise. * gcc.target/i386/avx512bf16-pr108881.c: Likewise. * gcc.target/i386/cet-notrack-2a.c: Likewise. * gcc.target/i386/cet-notrack-2b.c: Likewise. * gcc.target/i386/cet-notrack-5b.c: Likewise. * gcc.target/i386/cet-notrack-6a.c: Likewise. * gcc.target/i386/cet-notrack-6b.c: Likewise. * gcc.target/i386/pr70325.c: Likewise. * gcc.target/i386/pr70858.c: Likewise. * gcc.target/i386/pr83488.c: Likewise. * gcc.target/i386/pr85511.c: Likewise. * gcc.target/i386/pr87572.c: Likewise. * gcc.target/i386/pr88195.c: Likewise.
2023-11-08testsuite: Rename c2x-*, gnu2x-* tests to c23-*, gnu23-*Joseph Myers15-2/+2
Completing the move to refer to C23 in place of C2X, rename all tests with "c2x" or "gnu2x" in their names to use "c23" or "gnu23" instead. 17 files in the testsuite that referred to such tests (or, in one case, a generated .i file to be scanned) by those names are updated for the renaming. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/testsuite/ * gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c: Move to ... * gcc.dg/atomic/c23-stdatomic-lockfree-char8_t.c: ... here. * gcc.dg/atomic/c2x-stdatomic-var-init-1.c: Move to ... * gcc.dg/atomic/c23-stdatomic-var-init-1.c: ... here. * gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c: Move to ... * gcc.dg/atomic/gnu23-stdatomic-lockfree-char8_t.c: ... here. Update reference to moved file. * gcc.dg/c2x-align-1.c: Move to ... * gcc.dg/c23-align-1.c: ... here. * gcc.dg/c2x-align-6.c: Move to ... * gcc.dg/c23-align-6.c: ... here. * gcc.dg/c2x-attr-deprecated-1.c: Move to ... * gcc.dg/c23-attr-deprecated-1.c: ... here. Update reference to moved file. * gcc.dg/c2x-attr-deprecated-2.c: Move to ... * gcc.dg/c23-attr-deprecated-2.c: ... here. * gcc.dg/c2x-attr-deprecated-3.c: Move to ... * gcc.dg/c23-attr-deprecated-3.c: ... here. * gcc.dg/c2x-attr-deprecated-4.c: Move to ... * gcc.dg/c23-attr-deprecated-4.c: ... here. * gcc.dg/c2x-attr-fallthrough-1.c: Move to ... * gcc.dg/c23-attr-fallthrough-1.c: ... here. * gcc.dg/c2x-attr-fallthrough-2.c: Move to ... * gcc.dg/c23-attr-fallthrough-2.c: ... here. * gcc.dg/c2x-attr-fallthrough-3.c: Move to ... * gcc.dg/c23-attr-fallthrough-3.c: ... here. * gcc.dg/c2x-attr-fallthrough-4.c: Move to ... * gcc.dg/c23-attr-fallthrough-4.c: ... here. * gcc.dg/c2x-attr-fallthrough-5.c: Move to ... * gcc.dg/c23-attr-fallthrough-5.c: ... here. * gcc.dg/c2x-attr-fallthrough-6.c: Move to ... * gcc.dg/c23-attr-fallthrough-6.c: ... here. * gcc.dg/c2x-attr-maybe_unused-1.c: Move to ... * gcc.dg/c23-attr-maybe_unused-1.c: ... here. * gcc.dg/c2x-attr-maybe_unused-2.c: Move to ... * gcc.dg/c23-attr-maybe_unused-2.c: ... here. * gcc.dg/c2x-attr-maybe_unused-3.c: Move to ... * gcc.dg/c23-attr-maybe_unused-3.c: ... here. * gcc.dg/c2x-attr-maybe_unused-4.c: Move to ... * gcc.dg/c23-attr-maybe_unused-4.c: ... here. * gcc.dg/c2x-attr-nodiscard-1.c: Move to ... * gcc.dg/c23-attr-nodiscard-1.c: ... here. * gcc.dg/c2x-attr-nodiscard-2.c: Move to ... * gcc.dg/c23-attr-nodiscard-2.c: ... here. * gcc.dg/c2x-attr-nodiscard-3.c: Move to ... * gcc.dg/c23-attr-nodiscard-3.c: ... here. * gcc.dg/c2x-attr-nodiscard-4.c: Move to ... * gcc.dg/c23-attr-nodiscard-4.c: ... here. * gcc.dg/c2x-attr-noreturn-1.c: Move to ... * gcc.dg/c23-attr-noreturn-1.c: ... here. * gcc.dg/c2x-attr-noreturn-2.c: Move to ... * gcc.dg/c23-attr-noreturn-2.c: ... here. * gcc.dg/c2x-attr-noreturn-3.c: Move to ... * gcc.dg/c23-attr-noreturn-3.c: ... here. * gcc.dg/c2x-attr-syntax-1.c: Move to ... * gcc.dg/c23-attr-syntax-1.c: ... here. * gcc.dg/c2x-attr-syntax-2.c: Move to ... * gcc.dg/c23-attr-syntax-2.c: ... here. * gcc.dg/c2x-attr-syntax-3.c: Move to ... * gcc.dg/c23-attr-syntax-3.c: ... here. * gcc.dg/c2x-attr-syntax-4.c: Move to ... * gcc.dg/c23-attr-syntax-4.c: ... here. * gcc.dg/c2x-attr-syntax-5.c: Move to ... * gcc.dg/c23-attr-syntax-5.c: ... here. * gcc.dg/c2x-attr-syntax-6.c: Move to ... * gcc.dg/c23-attr-syntax-6.c: ... here. * gcc.dg/c2x-attr-syntax-7.c: Move to ... * gcc.dg/c23-attr-syntax-7.c: ... here. * gcc.dg/c2x-auto-1.c: Move to ... * gcc.dg/c23-auto-1.c: ... here. * gcc.dg/c2x-auto-2.c: Move to ... * gcc.dg/c23-auto-2.c: ... here. * gcc.dg/c2x-auto-3.c: Move to ... * gcc.dg/c23-auto-3.c: ... here. * gcc.dg/c2x-auto-4.c: Move to ... * gcc.dg/c23-auto-4.c: ... here. * gcc.dg/c2x-binary-constants-1.c: Move to ... * gcc.dg/c23-binary-constants-1.c: ... here. * gcc.dg/c2x-binary-constants-2.c: Move to ... * gcc.dg/c23-binary-constants-2.c: ... here. * gcc.dg/c2x-binary-constants-3.c: Move to ... * gcc.dg/c23-binary-constants-3.c: ... here. * gcc.dg/c2x-bool-1.c: Move to ... * gcc.dg/c23-bool-1.c: ... here. * gcc.dg/c2x-bool-2.c: Move to ... * gcc.dg/c23-bool-2.c: ... here. * gcc.dg/c2x-bool-limits-1.c: Move to ... * gcc.dg/c23-bool-limits-1.c: ... here. * gcc.dg/c2x-builtins-1.c: Move to ... * gcc.dg/c23-builtins-1.c: ... here. * gcc.dg/c2x-complit-1.c: Move to ... * gcc.dg/c23-complit-1.c: ... here. * gcc.dg/c2x-complit-2.c: Move to ... * gcc.dg/c23-complit-2.c: ... here. * gcc.dg/c2x-complit-3.c: Move to ... * gcc.dg/c23-complit-3.c: ... here. * gcc.dg/c2x-complit-4.c: Move to ... * gcc.dg/c23-complit-4.c: ... here. * gcc.dg/c2x-complit-5.c: Move to ... * gcc.dg/c23-complit-5.c: ... here. * gcc.dg/c2x-complit-6.c: Move to ... * gcc.dg/c23-complit-6.c: ... here. * gcc.dg/c2x-complit-7.c: Move to ... * gcc.dg/c23-complit-7.c: ... here. * gcc.dg/c2x-complit-8.c: Move to ... * gcc.dg/c23-complit-8.c: ... here. * gcc.dg/c2x-concat-1.c: Move to ... * gcc.dg/c23-concat-1.c: ... here. * gcc.dg/c2x-constexpr-1.c: Move to ... * gcc.dg/c23-constexpr-1.c: ... here. * gcc.dg/c2x-constexpr-2a.c: Move to ... * gcc.dg/c23-constexpr-2a.c: ... here. Update reference to moved file. * gcc.dg/c2x-constexpr-2b.c: Move to ... * gcc.dg/c23-constexpr-2b.c: ... here. * gcc.dg/c2x-constexpr-3.c: Move to ... * gcc.dg/c23-constexpr-3.c: ... here. * gcc.dg/c2x-constexpr-4.c: Move to ... * gcc.dg/c23-constexpr-4.c: ... here. * gcc.dg/c2x-constexpr-5.c: Move to ... * gcc.dg/c23-constexpr-5.c: ... here. * gcc.dg/c2x-constexpr-6.c: Move to ... * gcc.dg/c23-constexpr-6.c: ... here. * gcc.dg/c2x-constexpr-7.c: Move to ... * gcc.dg/c23-constexpr-7.c: ... here. * gcc.dg/c2x-constexpr-8.c: Move to ... * gcc.dg/c23-constexpr-8.c: ... here. * gcc.dg/c2x-constexpr-9.c: Move to ... * gcc.dg/c23-constexpr-9.c: ... here. * gcc.dg/c2x-digit-separators-1.c: Move to ... * gcc.dg/c23-digit-separators-1.c: ... here. * gcc.dg/c2x-digit-separators-2.c: Move to ... * gcc.dg/c23-digit-separators-2.c: ... here. * gcc.dg/c2x-digit-separators-3.c: Move to ... * gcc.dg/c23-digit-separators-3.c: ... here. * gcc.dg/c2x-empty-init-1.c: Move to ... * gcc.dg/c23-empty-init-1.c: ... here. * gcc.dg/c2x-empty-init-2.c: Move to ... * gcc.dg/c23-empty-init-2.c: ... here. * gcc.dg/c2x-empty-init-3.c: Move to ... * gcc.dg/c23-empty-init-3.c: ... here. * gcc.dg/c2x-enum-1.c: Move to ... * gcc.dg/c23-enum-1.c: ... here. * gcc.dg/c2x-enum-2.c: Move to ... * gcc.dg/c23-enum-2.c: ... here. * gcc.dg/c2x-enum-3.c: Move to ... * gcc.dg/c23-enum-3.c: ... here. * gcc.dg/c2x-enum-4.c: Move to ... * gcc.dg/c23-enum-4.c: ... here. * gcc.dg/c2x-enum-5.c: Move to ... * gcc.dg/c23-enum-5.c: ... here. * gcc.dg/c2x-enum-6.c: Move to ... * gcc.dg/c23-enum-6.c: ... here. * gcc.dg/c2x-enum-7.c: Move to ... * gcc.dg/c23-enum-7.c: ... here. * gcc.dg/c2x-enum-8.c: Move to ... * gcc.dg/c23-enum-8.c: ... here. * gcc.dg/c2x-float-1.c: Move to ... * gcc.dg/c23-float-1.c: ... here. * gcc.dg/c2x-float-10.c: Move to ... * gcc.dg/c23-float-10.c: ... here. * gcc.dg/c2x-float-11.c: Move to ... * gcc.dg/c23-float-11.c: ... here. * gcc.dg/c2x-float-12.c: Move to ... * gcc.dg/c23-float-12.c: ... here. * gcc.dg/c2x-float-13.c: Move to ... * gcc.dg/c23-float-13.c: ... here. * gcc.dg/c2x-float-2.c: Move to ... * gcc.dg/c23-float-2.c: ... here. * gcc.dg/c2x-float-3.c: Move to ... * gcc.dg/c23-float-3.c: ... here. * gcc.dg/c2x-float-4.c: Move to ... * gcc.dg/c23-float-4.c: ... here. * gcc.dg/c2x-float-5.c: Move to ... * gcc.dg/c23-float-5.c: ... here. * gcc.dg/c2x-float-6.c: Move to ... * gcc.dg/c23-float-6.c: ... here. * gcc.dg/c2x-float-7a.c: Move to ... * gcc.dg/c23-float-7a.c: ... here. * gcc.dg/c2x-float-7b.c: Move to ... * gcc.dg/c23-float-7b.c: ... here. * gcc.dg/c2x-float-7c.c: Move to ... * gcc.dg/c23-float-7c.c: ... here. * gcc.dg/c2x-float-8.c: Move to ... * gcc.dg/c23-float-8.c: ... here. * gcc.dg/c2x-float-9.c: Move to ... * gcc.dg/c23-float-9.c: ... here. * gcc.dg/c2x-float-no-dfp-1.c: Move to ... * gcc.dg/c23-float-no-dfp-1.c: ... here. * gcc.dg/c2x-float-no-dfp-2.c: Move to ... * gcc.dg/c23-float-no-dfp-2.c: ... here. Update reference to moved file. * gcc.dg/c2x-float-no-dfp-3.c: Move to ... * gcc.dg/c23-float-no-dfp-3.c: ... here. * gcc.dg/c2x-float-no-dfp-4.c: Move to ... * gcc.dg/c23-float-no-dfp-4.c: ... here. Update reference to moved file. * gcc.dg/c2x-floatn-1.c: Move to ... * gcc.dg/c23-floatn-1.c: ... here. * gcc.dg/c2x-floatn-2.c: Move to ... * gcc.dg/c23-floatn-2.c: ... here. * gcc.dg/c2x-floatn-3.c: Move to ... * gcc.dg/c23-floatn-3.c: ... here. * gcc.dg/c2x-floatn-4.c: Move to ... * gcc.dg/c23-floatn-4.c: ... here. * gcc.dg/c2x-floatn-5.c: Move to ... * gcc.dg/c23-floatn-5.c: ... here. * gcc.dg/c2x-floatn-6.c: Move to ... * gcc.dg/c23-floatn-6.c: ... here. * gcc.dg/c2x-floatn-7.c: Move to ... * gcc.dg/c23-floatn-7.c: ... here. * gcc.dg/c2x-floatn-8.c: Move to ... * gcc.dg/c23-floatn-8.c: ... here. * gcc.dg/c2x-fordecl-1.c: Move to ... * gcc.dg/c23-fordecl-1.c: ... here. * gcc.dg/c2x-fordecl-2.c: Move to ... * gcc.dg/c23-fordecl-2.c: ... here. * gcc.dg/c2x-fordecl-3.c: Move to ... * gcc.dg/c23-fordecl-3.c: ... here. * gcc.dg/c2x-fordecl-4.c: Move to ... * gcc.dg/c23-fordecl-4.c: ... here. * gcc.dg/c2x-has-c-attribute-1.c: Move to ... * gcc.dg/c23-has-c-attribute-1.c: ... here. * gcc.dg/c2x-has-c-attribute-2.c: Move to ... * gcc.dg/c23-has-c-attribute-2.c: ... here. * gcc.dg/c2x-has-c-attribute-3.c: Move to ... * gcc.dg/c23-has-c-attribute-3.c: ... here. * gcc.dg/c2x-has-c-attribute-4.c: Move to ... * gcc.dg/c23-has-c-attribute-4.c: ... here. * gcc.dg/c2x-labels-1.c: Move to ... * gcc.dg/c23-labels-1.c: ... here. * gcc.dg/c2x-labels-2.c: Move to ... * gcc.dg/c23-labels-2.c: ... here. * gcc.dg/c2x-labels-3.c: Move to ... * gcc.dg/c23-labels-3.c: ... here. * gcc.dg/c2x-limits-1.c: Move to ... * gcc.dg/c23-limits-1.c: ... here. * gcc.dg/c2x-no-dfp-1.c: Move to ... * gcc.dg/c23-no-dfp-1.c: ... here. * gcc.dg/c2x-nullptr-1.c: Move to ... * gcc.dg/c23-nullptr-1.c: ... here. * gcc.dg/c2x-nullptr-2.c: Move to ... * gcc.dg/c23-nullptr-2.c: ... here. * gcc.dg/c2x-nullptr-3.c: Move to ... * gcc.dg/c23-nullptr-3.c: ... here. * gcc.dg/c2x-nullptr-4.c: Move to ... * gcc.dg/c23-nullptr-4.c: ... here. * gcc.dg/c2x-nullptr-5.c: Move to ... * gcc.dg/c23-nullptr-5.c: ... here. * gcc.dg/c2x-nullptr-6.c: Move to ... * gcc.dg/c23-nullptr-6.c: ... here. * gcc.dg/c2x-old-style-definition-1.c: Move to ... * gcc.dg/c23-old-style-definition-1.c: ... here. * gcc.dg/c2x-old-style-definition-2.c: Move to ... * gcc.dg/c23-old-style-definition-2.c: ... here. * gcc.dg/c2x-old-style-definition-3.c: Move to ... * gcc.dg/c23-old-style-definition-3.c: ... here. * gcc.dg/c2x-old-style-definition-4.c: Move to ... * gcc.dg/c23-old-style-definition-4.c: ... here. * gcc.dg/c2x-old-style-definition-5.c: Move to ... * gcc.dg/c23-old-style-definition-5.c: ... here. * gcc.dg/c2x-old-style-definition-6.c: Move to ... * gcc.dg/c23-old-style-definition-6.c: ... here. * gcc.dg/c2x-parm-omit-1.c: Move to ... * gcc.dg/c23-parm-omit-1.c: ... here. * gcc.dg/c2x-parm-omit-2.c: Move to ... * gcc.dg/c23-parm-omit-2.c: ... here. * gcc.dg/c2x-parm-omit-3.c: Move to ... * gcc.dg/c23-parm-omit-3.c: ... here. * gcc.dg/c2x-parm-omit-4.c: Move to ... * gcc.dg/c23-parm-omit-4.c: ... here. * gcc.dg/c2x-qual-1.c: Move to ... * gcc.dg/c23-qual-1.c: ... here. * gcc.dg/c2x-qual-2.c: Move to ... * gcc.dg/c23-qual-2.c: ... here. * gcc.dg/c2x-qual-3.c: Move to ... * gcc.dg/c23-qual-3.c: ... here. * gcc.dg/c2x-qual-4.c: Move to ... * gcc.dg/c23-qual-4.c: ... here. * gcc.dg/c2x-qual-5.c: Move to ... * gcc.dg/c23-qual-5.c: ... here. * gcc.dg/c2x-qual-6.c: Move to ... * gcc.dg/c23-qual-6.c: ... here. * gcc.dg/c2x-qual-7.c: Move to ... * gcc.dg/c23-qual-7.c: ... here. * gcc.dg/c2x-static-assert-1.c: Move to ... * gcc.dg/c23-static-assert-1.c: ... here. * gcc.dg/c2x-static-assert-2.c: Move to ... * gcc.dg/c23-static-assert-2.c: ... here. * gcc.dg/c2x-static-assert-3.c: Move to ... * gcc.dg/c23-static-assert-3.c: ... here. * gcc.dg/c2x-static-assert-4.c: Move to ... * gcc.dg/c23-static-assert-4.c: ... here. * gcc.dg/c2x-stdarg-1.c: Move to ... * gcc.dg/c23-stdarg-1.c: ... here. * gcc.dg/c2x-stdarg-2.c: Move to ... * gcc.dg/c23-stdarg-2.c: ... here. * gcc.dg/c2x-stdarg-3.c: Move to ... * gcc.dg/c23-stdarg-3.c: ... here. * gcc.dg/c2x-stdarg-4.c: Move to ... * gcc.dg/c23-stdarg-4.c: ... here. * gcc.dg/c2x-stdarg-5.c: Move to ... * gcc.dg/c23-stdarg-5.c: ... here. * gcc.dg/c2x-stdatomic-1.c: Move to ... * gcc.dg/c23-stdatomic-1.c: ... here. * gcc.dg/c2x-stddef-1.c: Move to ... * gcc.dg/c23-stddef-1.c: ... here. * gcc.dg/c2x-stdint-1.c: Move to ... * gcc.dg/c23-stdint-1.c: ... here. * gcc.dg/c2x-thread-local-1.c: Move to ... * gcc.dg/c23-thread-local-1.c: ... here. * gcc.dg/c2x-thread-local-2.c: Move to ... * gcc.dg/c23-thread-local-2.c: ... here. * gcc.dg/c2x-typeof-1.c: Move to ... * gcc.dg/c23-typeof-1.c: ... here. * gcc.dg/c2x-typeof-2.c: Move to ... * gcc.dg/c23-typeof-2.c: ... here. * gcc.dg/c2x-typeof-3.c: Move to ... * gcc.dg/c23-typeof-3.c: ... here. * gcc.dg/c2x-unproto-1.c: Move to ... * gcc.dg/c23-unproto-1.c: ... here. * gcc.dg/c2x-unproto-2.c: Move to ... * gcc.dg/c23-unproto-2.c: ... here. * gcc.dg/c2x-unproto-3.c: Move to ... * gcc.dg/c23-unproto-3.c: ... here. * gcc.dg/c2x-unproto-4.c: Move to ... * gcc.dg/c23-unproto-4.c: ... here. * gcc.dg/c2x-unreachable-1.c: Move to ... * gcc.dg/c23-unreachable-1.c: ... here. * gcc.dg/c2x-utf8char-1.c: Move to ... * gcc.dg/c23-utf8char-1.c: ... here. * gcc.dg/c2x-utf8char-2.c: Move to ... * gcc.dg/c23-utf8char-2.c: ... here. * gcc.dg/c2x-utf8char-3.c: Move to ... * gcc.dg/c23-utf8char-3.c: ... here. * gcc.dg/c2x-utf8str-type.c: Move to ... * gcc.dg/c23-utf8str-type.c: ... here. * gcc.dg/c2x-utf8str.c: Move to ... * gcc.dg/c23-utf8str.c: ... here. * gcc.dg/cpp/c2x-elifdef-1.c: Move to ... * gcc.dg/cpp/c23-elifdef-1.c: ... here. * gcc.dg/cpp/c2x-elifdef-2.c: Move to ... * gcc.dg/cpp/c23-elifdef-2.c: ... here. * gcc.dg/cpp/c2x-scope-1.c: Move to ... * gcc.dg/cpp/c23-scope-1.c: ... here. * gcc.dg/cpp/c2x-scope-2.c: Move to ... * gcc.dg/cpp/c23-scope-2.c: ... here. Update reference to moved file. * gcc.dg/cpp/c2x-trigraphs-1.c: Move to ... * gcc.dg/cpp/c23-trigraphs-1.c: ... here. * gcc.dg/cpp/c2x-trigraphs-2.c: Move to ... * gcc.dg/cpp/c23-trigraphs-2.c: ... here. * gcc.dg/cpp/c2x-ucn-1.c: Move to ... * gcc.dg/cpp/c23-ucn-1.c: ... here. * gcc.dg/cpp/c2x-ucnid-1-utf8.c: Move to ... * gcc.dg/cpp/c23-ucnid-1-utf8.c: ... here. * gcc.dg/cpp/c2x-ucnid-1.c: Move to ... * gcc.dg/cpp/c23-ucnid-1.c: ... here. * gcc.dg/cpp/c2x-va-opt-1.c: Move to ... * gcc.dg/cpp/c23-va-opt-1.c: ... here. * gcc.dg/cpp/c2x-warning-1.c: Move to ... * gcc.dg/cpp/c23-warning-1.c: ... here. * gcc.dg/cpp/c2x-warning-2.c: Move to ... * gcc.dg/cpp/c23-warning-2.c: ... here. * gcc.dg/cpp/gnu2x-warning-1.c: Move to ... * gcc.dg/cpp/gnu23-warning-1.c: ... here. * gcc.dg/cpp/gnu2x-warning-2.c: Move to ... * gcc.dg/cpp/gnu23-warning-2.c: ... here. * gcc.dg/dfp/c2x-builtins-dfp-1.c: Move to ... * gcc.dg/dfp/c23-builtins-dfp-1.c: ... here. * gcc.dg/dfp/c2x-constants-1.c: Move to ... * gcc.dg/dfp/c23-constants-1.c: ... here. * gcc.dg/dfp/c2x-constants-2.c: Move to ... * gcc.dg/dfp/c23-constants-2.c: ... here. * gcc.dg/dfp/c2x-constexpr-dfp-1.c: Move to ... * gcc.dg/dfp/c23-constexpr-dfp-1.c: ... here. * gcc.dg/dfp/c2x-constexpr-dfp-2.c: Move to ... * gcc.dg/dfp/c23-constexpr-dfp-2.c: ... here. * gcc.dg/dfp/c2x-float-dfp-1.c: Move to ... * gcc.dg/dfp/c23-float-dfp-1.c: ... here. * gcc.dg/dfp/c2x-float-dfp-2.c: Move to ... * gcc.dg/dfp/c23-float-dfp-2.c: ... here. Update reference to moved file. * gcc.dg/dfp/c2x-float-dfp-3.c: Move to ... * gcc.dg/dfp/c23-float-dfp-3.c: ... here. * gcc.dg/dfp/c2x-float-dfp-4.c: Move to ... * gcc.dg/dfp/c23-float-dfp-4.c: ... here. * gcc.dg/dfp/c2x-float-dfp-5.c: Move to ... * gcc.dg/dfp/c23-float-dfp-5.c: ... here. * gcc.dg/dfp/c2x-float-dfp-6.c: Move to ... * gcc.dg/dfp/c23-float-dfp-6.c: ... here. * gcc.dg/dfp/c2x-float-dfp-7.c: Move to ... * gcc.dg/dfp/c23-float-dfp-7.c: ... here. * gcc.dg/dfp/c2x-float-dfp-8.c: Move to ... * gcc.dg/dfp/c23-float-dfp-8.c: ... here. * gcc.dg/dfp/c2x-keywords-1.c: Move to ... * gcc.dg/dfp/c23-keywords-1.c: ... here. * gcc.dg/dfp/c2x-keywords-2.c: Move to ... * gcc.dg/dfp/c23-keywords-2.c: ... here. * gcc.dg/format/c2x-dfp-printf-1.c: Move to ... * gcc.dg/format/c23-dfp-printf-1.c: ... here. * gcc.dg/format/c2x-dfp-scanf-1.c: Move to ... * gcc.dg/format/c23-dfp-scanf-1.c: ... here. * gcc.dg/format/c2x-printf-1.c: Move to ... * gcc.dg/format/c23-printf-1.c: ... here. * gcc.dg/format/c2x-scanf-1.c: Move to ... * gcc.dg/format/c23-scanf-1.c: ... here. * gcc.dg/format/c2x-strftime-1.c: Move to ... * gcc.dg/format/c23-strftime-1.c: ... here. * gcc.dg/gnu2x-attr-syntax-1.c: Move to ... * gcc.dg/gnu23-attr-syntax-1.c: ... here. * gcc.dg/gnu2x-attr-syntax-2.c: Move to ... * gcc.dg/gnu23-attr-syntax-2.c: ... here. * gcc.dg/gnu2x-attrs-1.c: Move to ... * gcc.dg/gnu23-attrs-1.c: ... here. * gcc.dg/gnu2x-attrs-2.c: Move to ... * gcc.dg/gnu23-attrs-2.c: ... here. * gcc.dg/gnu2x-auto-1.c: Move to ... * gcc.dg/gnu23-auto-1.c: ... here. * gcc.dg/gnu2x-builtins-no-dfp-1.c: Move to ... * gcc.dg/gnu23-builtins-no-dfp-1.c: ... here. * gcc.dg/gnu2x-complit-1.c: Move to ... * gcc.dg/gnu23-complit-1.c: ... here. * gcc.dg/gnu2x-complit-2.c: Move to ... * gcc.dg/gnu23-complit-2.c: ... here. * gcc.dg/gnu2x-constexpr-1.c: Move to ... * gcc.dg/gnu23-constexpr-1.c: ... here. * gcc.dg/gnu2x-empty-init-1.c: Move to ... * gcc.dg/gnu23-empty-init-1.c: ... here. * gcc.dg/gnu2x-empty-init-2.c: Move to ... * gcc.dg/gnu23-empty-init-2.c: ... here. * gcc.dg/gnu2x-enum-1.c: Move to ... * gcc.dg/gnu23-enum-1.c: ... here. * gcc.dg/gnu2x-static-assert-1.c: Move to ... * gcc.dg/gnu23-static-assert-1.c: ... here. * gcc.dg/gnu2x-stdarg-1.c: Move to ... * gcc.dg/gnu23-stdarg-1.c: ... here. * gcc.dg/gnu2x-typeof-1.c: Move to ... * gcc.dg/gnu23-typeof-1.c: ... here. * gcc.dg/gnu2x-utf8char-1.c: Move to ... * gcc.dg/gnu23-utf8char-1.c: ... here. Update reference to moved file. * gcc.dg/gnu2x-utf8str-type.c: Move to ... * gcc.dg/gnu23-utf8str-type.c: ... here. Update reference to moved file. * gcc.dg/gnu2x-utf8str.c: Move to ... * gcc.dg/gnu23-utf8str.c: ... here. * gcc.dg/torture/builtin-fp-int-inexact-c2x.c: Move to ... * gcc.dg/torture/builtin-fp-int-inexact-c23.c: ... here. * gcc.dg/torture/c2x-stdarg-split-1a.c: Move to ... * gcc.dg/torture/c23-stdarg-split-1a.c: ... here. Update reference to moved file. * gcc.dg/torture/c2x-stdarg-split-1b.c: Move to ... * gcc.dg/torture/c23-stdarg-split-1b.c: ... here. * objc.dg/attributes/gnu2x-attr-syntax-1.m: Move to ... * objc.dg/attributes/gnu23-attr-syntax-1.m: ... here. Update reference to moved file. * g++.dg/cpp/elifdef-2.C: Update reference to moved file. * g++.dg/cpp/elifdef-4.C: Likewise. * gcc.dg/c11-float-dfp-1.c: Likewise. * gcc.dg/c11-float-dfp-2.c: Likewise. * gcc.dg/cpp/gnu11-elifdef-1.c: Likewise. * gcc.dg/dfp/ts18661-2-float-dfp-1.c: Likewise.
2023-11-07testsuite: Refer more consistently to C23 not C2XJoseph Myers16-30/+30
Continuing the move to refer to C23 in place of C2X throughout the source tree, update testcase contents to use the "c23" or "gnu23" option names in place of the old "c2x" or "gnu2x" names, except for the few tests specifically intended to test the old names, and to refer to C23 in comments. This updates testcase *contents*; testcase naming (renaming c2x-* tests to c23-* and gnu2x-* tests to gnu23-*), with a few consequent changes to contents (where tests #include other tests, or refer to them by name in comments) is to be addressed separately. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/testsuite/ * c-c++-common/alias-1.c: Use "c23" or "gnu23" option names in place of "c2x" or "gnu2x" names, and refer to C23 in comments in place of C2X or C2x. * gcc.dg/Wformat-overflow1.c: Likewise. * gcc.dg/asm-scope-1.c: Likewise. * gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c: Likewise. * gcc.dg/atomic/c2x-stdatomic-var-init-1.c: Likewise. * gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c: Likewise. * gcc.dg/atomic/stdatomic-bitint-1.c: Likewise. * gcc.dg/atomic/stdatomic-bitint-2.c: Likewise. * gcc.dg/attr-assume-1.c: Likewise. * gcc.dg/attr-assume-2.c: Likewise. * gcc.dg/attr-assume-3.c: Likewise. * gcc.dg/attr-assume-4.c: Likewise. * gcc.dg/bitint-1.c: Likewise. * gcc.dg/bitint-10.c: Likewise. * gcc.dg/bitint-11.c: Likewise. * gcc.dg/bitint-12.c: Likewise. * gcc.dg/bitint-13.c: Likewise. * gcc.dg/bitint-14.c: Likewise. * gcc.dg/bitint-15.c: Likewise. * gcc.dg/bitint-16.c: Likewise. * gcc.dg/bitint-17.c: Likewise. * gcc.dg/bitint-18.c: Likewise. * gcc.dg/bitint-19.c: Likewise. * gcc.dg/bitint-2.c: Likewise. * gcc.dg/bitint-20.c: Likewise. * gcc.dg/bitint-21.c: Likewise. * gcc.dg/bitint-22.c: Likewise. * gcc.dg/bitint-23.c: Likewise. * gcc.dg/bitint-25.c: Likewise. * gcc.dg/bitint-28.c: Likewise. * gcc.dg/bitint-29.c: Likewise. * gcc.dg/bitint-3.c: Likewise. * gcc.dg/bitint-30.c: Likewise. * gcc.dg/bitint-31.c: Likewise. * gcc.dg/bitint-32.c: Likewise. * gcc.dg/bitint-34.c: Likewise. * gcc.dg/bitint-35.c: Likewise. * gcc.dg/bitint-36.c: Likewise. * gcc.dg/bitint-38.c: Likewise. * gcc.dg/bitint-39.c: Likewise. * gcc.dg/bitint-4.c: Likewise. * gcc.dg/bitint-5.c: Likewise. * gcc.dg/bitint-6.c: Likewise. * gcc.dg/bitint-7.c: Likewise. * gcc.dg/bitint-8.c: Likewise. * gcc.dg/bitint-9.c: Likewise. * gcc.dg/c11-attr-syntax-3.c: Likewise. * gcc.dg/c11-builtins-1.c: Likewise. * gcc.dg/c11-complit-1.c: Likewise. * gcc.dg/c11-complit-2.c: Likewise. * gcc.dg/c11-complit-3.c: Likewise. * gcc.dg/c11-digit-separators-1.c: Likewise. * gcc.dg/c11-empty-init-3.c: Likewise. * gcc.dg/c11-enum-1.c: Likewise. * gcc.dg/c11-enum-2.c: Likewise. * gcc.dg/c11-enum-3.c: Likewise. * gcc.dg/c11-enum-4.c: Likewise. * gcc.dg/c11-enum-5.c: Likewise. * gcc.dg/c11-enum-6.c: Likewise. * gcc.dg/c11-floatn-5.c: Likewise. * gcc.dg/c11-floatn-6.c: Likewise. * gcc.dg/c11-floatn-7.c: Likewise. * gcc.dg/c11-floatn-8.c: Likewise. * gcc.dg/c11-fordecl-3.c: Likewise. * gcc.dg/c11-fordecl-4.c: Likewise. * gcc.dg/c11-keywords-1.c: Likewise. * gcc.dg/c11-old-style-definition-1.c: Likewise. * gcc.dg/c11-old-style-definition-2.c: Likewise. * gcc.dg/c11-parm-omit-3.c: Likewise. * gcc.dg/c11-qual-1.c: Likewise. * gcc.dg/c11-static-assert-9.c: Likewise. * gcc.dg/c11-stdarg-3.c: Likewise. * gcc.dg/c11-unproto-1.c: Likewise. * gcc.dg/c11-unproto-2.c: Likewise. * gcc.dg/c11-utf8char-1.c: Likewise. * gcc.dg/c17-nullptr-2.c: Likewise. * gcc.dg/c2x-align-1.c: Likewise. * gcc.dg/c2x-align-6.c: Likewise. * gcc.dg/c2x-attr-deprecated-1.c: Likewise. * gcc.dg/c2x-attr-deprecated-2.c: Likewise. * gcc.dg/c2x-attr-deprecated-3.c: Likewise. * gcc.dg/c2x-attr-deprecated-4.c: Likewise. * gcc.dg/c2x-attr-fallthrough-1.c: Likewise. * gcc.dg/c2x-attr-fallthrough-2.c: Likewise. * gcc.dg/c2x-attr-fallthrough-3.c: Likewise. * gcc.dg/c2x-attr-fallthrough-4.c: Likewise. * gcc.dg/c2x-attr-fallthrough-5.c: Likewise. * gcc.dg/c2x-attr-fallthrough-6.c: Likewise. * gcc.dg/c2x-attr-maybe_unused-1.c: Likewise. * gcc.dg/c2x-attr-maybe_unused-2.c: Likewise. * gcc.dg/c2x-attr-maybe_unused-3.c: Likewise. * gcc.dg/c2x-attr-maybe_unused-4.c: Likewise. * gcc.dg/c2x-attr-nodiscard-1.c: Likewise. * gcc.dg/c2x-attr-nodiscard-2.c: Likewise. * gcc.dg/c2x-attr-nodiscard-3.c: Likewise. * gcc.dg/c2x-attr-nodiscard-4.c: Likewise. * gcc.dg/c2x-attr-noreturn-1.c: Likewise. * gcc.dg/c2x-attr-noreturn-2.c: Likewise. * gcc.dg/c2x-attr-noreturn-3.c: Likewise. * gcc.dg/c2x-attr-syntax-1.c: Likewise. * gcc.dg/c2x-attr-syntax-2.c: Likewise. * gcc.dg/c2x-attr-syntax-3.c: Likewise. * gcc.dg/c2x-attr-syntax-4.c: Likewise. * gcc.dg/c2x-attr-syntax-5.c: Likewise. * gcc.dg/c2x-attr-syntax-7.c: Likewise. * gcc.dg/c2x-auto-1.c: Likewise. * gcc.dg/c2x-auto-2.c: Likewise. * gcc.dg/c2x-auto-3.c: Likewise. * gcc.dg/c2x-auto-4.c: Likewise. * gcc.dg/c2x-binary-constants-1.c: Likewise. * gcc.dg/c2x-binary-constants-2.c: Likewise. * gcc.dg/c2x-binary-constants-3.c: Likewise. * gcc.dg/c2x-bool-1.c: Likewise. * gcc.dg/c2x-bool-2.c: Likewise. * gcc.dg/c2x-bool-limits-1.c: Likewise. * gcc.dg/c2x-builtins-1.c: Likewise. * gcc.dg/c2x-complit-1.c: Likewise. * gcc.dg/c2x-complit-2.c: Likewise. * gcc.dg/c2x-complit-3.c: Likewise. * gcc.dg/c2x-complit-4.c: Likewise. * gcc.dg/c2x-complit-5.c: Likewise. * gcc.dg/c2x-complit-6.c: Likewise. * gcc.dg/c2x-complit-7.c: Likewise. * gcc.dg/c2x-complit-8.c: Likewise. * gcc.dg/c2x-concat-1.c: Likewise. * gcc.dg/c2x-constexpr-1.c: Likewise. * gcc.dg/c2x-constexpr-2a.c: Likewise. * gcc.dg/c2x-constexpr-2b.c: Likewise. * gcc.dg/c2x-constexpr-3.c: Likewise. * gcc.dg/c2x-constexpr-4.c: Likewise. * gcc.dg/c2x-constexpr-5.c: Likewise. * gcc.dg/c2x-constexpr-6.c: Likewise. * gcc.dg/c2x-constexpr-7.c: Likewise. * gcc.dg/c2x-constexpr-8.c: Likewise. * gcc.dg/c2x-constexpr-9.c: Likewise. * gcc.dg/c2x-digit-separators-1.c: Likewise. * gcc.dg/c2x-digit-separators-2.c: Likewise. * gcc.dg/c2x-digit-separators-3.c: Likewise. * gcc.dg/c2x-empty-init-1.c: Likewise. * gcc.dg/c2x-empty-init-2.c: Likewise. * gcc.dg/c2x-empty-init-3.c: Likewise. * gcc.dg/c2x-enum-1.c: Likewise. * gcc.dg/c2x-enum-2.c: Likewise. * gcc.dg/c2x-enum-3.c: Likewise. * gcc.dg/c2x-enum-4.c: Likewise. * gcc.dg/c2x-enum-5.c: Likewise. * gcc.dg/c2x-enum-6.c: Likewise. * gcc.dg/c2x-enum-7.c: Likewise. * gcc.dg/c2x-enum-8.c: Likewise. * gcc.dg/c2x-float-1.c: Likewise. * gcc.dg/c2x-float-10.c: Likewise. * gcc.dg/c2x-float-11.c: Likewise. * gcc.dg/c2x-float-12.c: Likewise. * gcc.dg/c2x-float-13.c: Likewise. * gcc.dg/c2x-float-2.c: Likewise. * gcc.dg/c2x-float-3.c: Likewise. * gcc.dg/c2x-float-4.c: Likewise. * gcc.dg/c2x-float-5.c: Likewise. * gcc.dg/c2x-float-6.c: Likewise. * gcc.dg/c2x-float-7a.c: Likewise. * gcc.dg/c2x-float-7b.c: Likewise. * gcc.dg/c2x-float-7c.c: Likewise. * gcc.dg/c2x-float-8.c: Likewise. * gcc.dg/c2x-float-9.c: Likewise. * gcc.dg/c2x-float-no-dfp-1.c: Likewise. * gcc.dg/c2x-float-no-dfp-2.c: Likewise. * gcc.dg/c2x-float-no-dfp-3.c: Likewise. * gcc.dg/c2x-float-no-dfp-4.c: Likewise. * gcc.dg/c2x-floatn-1.c: Likewise. * gcc.dg/c2x-floatn-2.c: Likewise. * gcc.dg/c2x-floatn-3.c: Likewise. * gcc.dg/c2x-floatn-4.c: Likewise. * gcc.dg/c2x-floatn-5.c: Likewise. * gcc.dg/c2x-floatn-6.c: Likewise. * gcc.dg/c2x-floatn-7.c: Likewise. * gcc.dg/c2x-floatn-8.c: Likewise. * gcc.dg/c2x-fordecl-1.c: Likewise. * gcc.dg/c2x-fordecl-2.c: Likewise. * gcc.dg/c2x-fordecl-3.c: Likewise. * gcc.dg/c2x-fordecl-4.c: Likewise. * gcc.dg/c2x-has-c-attribute-1.c: Likewise. * gcc.dg/c2x-has-c-attribute-2.c: Likewise. * gcc.dg/c2x-has-c-attribute-3.c: Likewise. * gcc.dg/c2x-has-c-attribute-4.c: Likewise. * gcc.dg/c2x-labels-1.c: Likewise. * gcc.dg/c2x-labels-2.c: Likewise. * gcc.dg/c2x-labels-3.c: Likewise. * gcc.dg/c2x-limits-1.c: Likewise. * gcc.dg/c2x-no-dfp-1.c: Likewise. * gcc.dg/c2x-nullptr-1.c: Likewise. * gcc.dg/c2x-nullptr-2.c: Likewise. * gcc.dg/c2x-nullptr-3.c: Likewise. * gcc.dg/c2x-nullptr-4.c: Likewise. * gcc.dg/c2x-nullptr-5.c: Likewise. * gcc.dg/c2x-nullptr-6.c: Likewise. * gcc.dg/c2x-old-style-definition-1.c: Likewise. * gcc.dg/c2x-old-style-definition-2.c: Likewise. * gcc.dg/c2x-old-style-definition-3.c: Likewise. * gcc.dg/c2x-old-style-definition-4.c: Likewise. * gcc.dg/c2x-old-style-definition-5.c: Likewise. * gcc.dg/c2x-old-style-definition-6.c: Likewise. * gcc.dg/c2x-parm-omit-1.c: Likewise. * gcc.dg/c2x-parm-omit-2.c: Likewise. * gcc.dg/c2x-parm-omit-3.c: Likewise. * gcc.dg/c2x-parm-omit-4.c: Likewise. * gcc.dg/c2x-qual-1.c: Likewise. * gcc.dg/c2x-qual-2.c: Likewise. * gcc.dg/c2x-qual-3.c: Likewise. * gcc.dg/c2x-qual-4.c: Likewise. * gcc.dg/c2x-qual-5.c: Likewise. * gcc.dg/c2x-qual-6.c: Likewise. * gcc.dg/c2x-qual-7.c: Likewise. * gcc.dg/c2x-static-assert-1.c: Likewise. * gcc.dg/c2x-static-assert-2.c: Likewise. * gcc.dg/c2x-static-assert-3.c: Likewise. * gcc.dg/c2x-static-assert-4.c: Likewise. * gcc.dg/c2x-stdarg-1.c: Likewise. * gcc.dg/c2x-stdarg-2.c: Likewise. * gcc.dg/c2x-stdarg-3.c: Likewise. * gcc.dg/c2x-stdarg-4.c: Likewise. * gcc.dg/c2x-stdarg-5.c: Likewise. * gcc.dg/c2x-stdatomic-1.c: Likewise. * gcc.dg/c2x-stddef-1.c: Likewise. * gcc.dg/c2x-stdint-1.c: Likewise. * gcc.dg/c2x-thread-local-1.c: Likewise. * gcc.dg/c2x-thread-local-2.c: Likewise. * gcc.dg/c2x-typeof-1.c: Likewise. * gcc.dg/c2x-typeof-2.c: Likewise. * gcc.dg/c2x-typeof-3.c: Likewise. * gcc.dg/c2x-unproto-1.c: Likewise. * gcc.dg/c2x-unproto-2.c: Likewise. * gcc.dg/c2x-unproto-3.c: Likewise. * gcc.dg/c2x-unproto-4.c: Likewise. * gcc.dg/c2x-unreachable-1.c: Likewise. * gcc.dg/c2x-utf8char-1.c: Likewise. * gcc.dg/c2x-utf8char-2.c: Likewise. * gcc.dg/c2x-utf8char-3.c: Likewise. * gcc.dg/c2x-utf8str-type.c: Likewise. * gcc.dg/c2x-utf8str.c: Likewise. * gcc.dg/c90-auto-1.c: Likewise. * gcc.dg/c90-complit-2.c: Likewise. * gcc.dg/cpp/c11-warning-3.c: Likewise. * gcc.dg/cpp/c2x-elifdef-1.c: Likewise. * gcc.dg/cpp/c2x-elifdef-2.c: Likewise. * gcc.dg/cpp/c2x-scope-1.c: Likewise. * gcc.dg/cpp/c2x-scope-2.c: Likewise. * gcc.dg/cpp/c2x-trigraphs-1.c: Likewise. * gcc.dg/cpp/c2x-trigraphs-2.c: Likewise. * gcc.dg/cpp/c2x-ucn-1.c: Likewise. * gcc.dg/cpp/c2x-ucnid-1-utf8.c: Likewise. * gcc.dg/cpp/c2x-ucnid-1.c: Likewise. * gcc.dg/cpp/c2x-va-opt-1.c: Likewise. * gcc.dg/cpp/c2x-warning-1.c: Likewise. * gcc.dg/cpp/c2x-warning-2.c: Likewise. * gcc.dg/cpp/gnu11-warning-3.c: Likewise. * gcc.dg/cpp/gnu2x-warning-1.c: Likewise. * gcc.dg/cpp/gnu2x-warning-2.c: Likewise. * gcc.dg/cr-decimal-dig-2.c: Likewise. * gcc.dg/cr-decimal-dig-3.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-2.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-3.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-4.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d32-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d32-2.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d64-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d64-2.c: Likewise. * gcc.dg/dfp/bitint-1.c: Likewise. * gcc.dg/dfp/bitint-2.c: Likewise. * gcc.dg/dfp/bitint-3.c: Likewise. * gcc.dg/dfp/bitint-4.c: Likewise. * gcc.dg/dfp/bitint-5.c: Likewise. * gcc.dg/dfp/bitint-6.c: Likewise. * gcc.dg/dfp/bitint-7.c: Likewise. * gcc.dg/dfp/bitint-8.c: Likewise. * gcc.dg/dfp/c2x-builtins-dfp-1.c: Likewise. * gcc.dg/dfp/c2x-constants-1.c: Likewise. * gcc.dg/dfp/c2x-constants-2.c: Likewise. * gcc.dg/dfp/c2x-constexpr-dfp-1.c: Likewise. * gcc.dg/dfp/c2x-constexpr-dfp-2.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-1.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-2.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-3.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-4.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-5.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-6.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-7.c: Likewise. * gcc.dg/dfp/c2x-float-dfp-8.c: Likewise. * gcc.dg/dfp/c2x-keywords-1.c: Likewise. * gcc.dg/dfp/c2x-keywords-2.c: Likewise. * gcc.dg/dfp/tr24732-float-dfp-1.c: Likewise. * gcc.dg/dfp/ts18661-2-float-dfp-1.c: Likewise. * gcc.dg/fixed-point/bitint-1.c: Likewise. * gcc.dg/format/c11-printf-1.c: Likewise. * gcc.dg/format/c11-scanf-1.c: Likewise. * gcc.dg/format/c2x-dfp-printf-1.c: Likewise. * gcc.dg/format/c2x-dfp-scanf-1.c: Likewise. * gcc.dg/format/c2x-printf-1.c: Likewise. * gcc.dg/format/c2x-scanf-1.c: Likewise. * gcc.dg/format/c2x-strftime-1.c: Likewise. * gcc.dg/format/ext-10.c: Likewise. * gcc.dg/format/ext-9.c: Likewise. * gcc.dg/gnu11-typeof-2.c: Likewise. * gcc.dg/gnu2x-attr-syntax-1.c: Likewise. * gcc.dg/gnu2x-attr-syntax-2.c: Likewise. * gcc.dg/gnu2x-attrs-1.c: Likewise. * gcc.dg/gnu2x-attrs-2.c: Likewise. * gcc.dg/gnu2x-auto-1.c: Likewise. * gcc.dg/gnu2x-builtins-no-dfp-1.c: Likewise. * gcc.dg/gnu2x-complit-1.c: Likewise. * gcc.dg/gnu2x-complit-2.c: Likewise. * gcc.dg/gnu2x-constexpr-1.c: Likewise. * gcc.dg/gnu2x-empty-init-1.c: Likewise. * gcc.dg/gnu2x-empty-init-2.c: Likewise. * gcc.dg/gnu2x-enum-1.c: Likewise. * gcc.dg/gnu2x-static-assert-1.c: Likewise. * gcc.dg/gnu2x-stdarg-1.c: Likewise. * gcc.dg/gnu2x-typeof-1.c: Likewise. * gcc.dg/gnu2x-utf8char-1.c: Likewise. * gcc.dg/gnu2x-utf8str-type.c: Likewise. * gcc.dg/gnu2x-utf8str.c: Likewise. * gcc.dg/gomp/attrs-1.c: Likewise. * gcc.dg/gomp/attrs-10.c: Likewise. * gcc.dg/gomp/attrs-11.c: Likewise. * gcc.dg/gomp/attrs-12.c: Likewise. * gcc.dg/gomp/attrs-13.c: Likewise. * gcc.dg/gomp/attrs-14.c: Likewise. * gcc.dg/gomp/attrs-15.c: Likewise. * gcc.dg/gomp/attrs-16.c: Likewise. * gcc.dg/gomp/attrs-17.c: Likewise. * gcc.dg/gomp/attrs-18.c: Likewise. * gcc.dg/gomp/attrs-19.c: Likewise. * gcc.dg/gomp/attrs-2.c: Likewise. * gcc.dg/gomp/attrs-20.c: Likewise. * gcc.dg/gomp/attrs-21.c: Likewise. * gcc.dg/gomp/attrs-3.c: Likewise. * gcc.dg/gomp/attrs-4.c: Likewise. * gcc.dg/gomp/attrs-5.c: Likewise. * gcc.dg/gomp/attrs-6.c: Likewise. * gcc.dg/gomp/attrs-7.c: Likewise. * gcc.dg/gomp/attrs-8.c: Likewise. * gcc.dg/gomp/attrs-9.c: Likewise. * gcc.dg/limits-width-2.c: Likewise. * gcc.dg/qual-return-10.c: Likewise. * gcc.dg/qual-return-9.c: Likewise. * gcc.dg/sso-19.c: Likewise. * gcc.dg/stdckdint-1.c: Likewise. * gcc.dg/stdckdint-2.c: Likewise. * gcc.dg/stdint-width-2.c: Likewise. * gcc.dg/tm/attrs-1.c: Likewise. * gcc.dg/torture/bitint-1.c: Likewise. * gcc.dg/torture/bitint-10.c: Likewise. * gcc.dg/torture/bitint-11.c: Likewise. * gcc.dg/torture/bitint-12.c: Likewise. * gcc.dg/torture/bitint-13.c: Likewise. * gcc.dg/torture/bitint-14.c: Likewise. * gcc.dg/torture/bitint-15.c: Likewise. * gcc.dg/torture/bitint-16.c: Likewise. * gcc.dg/torture/bitint-17.c: Likewise. * gcc.dg/torture/bitint-18.c: Likewise. * gcc.dg/torture/bitint-19.c: Likewise. * gcc.dg/torture/bitint-2.c: Likewise. * gcc.dg/torture/bitint-20.c: Likewise. * gcc.dg/torture/bitint-21.c: Likewise. * gcc.dg/torture/bitint-22.c: Likewise. * gcc.dg/torture/bitint-23.c: Likewise. * gcc.dg/torture/bitint-24.c: Likewise. * gcc.dg/torture/bitint-25.c: Likewise. * gcc.dg/torture/bitint-26.c: Likewise. * gcc.dg/torture/bitint-27.c: Likewise. * gcc.dg/torture/bitint-28.c: Likewise. * gcc.dg/torture/bitint-29.c: Likewise. * gcc.dg/torture/bitint-3.c: Likewise. * gcc.dg/torture/bitint-30.c: Likewise. * gcc.dg/torture/bitint-31.c: Likewise. * gcc.dg/torture/bitint-32.c: Likewise. * gcc.dg/torture/bitint-33.c: Likewise. * gcc.dg/torture/bitint-34.c: Likewise. * gcc.dg/torture/bitint-35.c: Likewise. * gcc.dg/torture/bitint-36.c: Likewise. * gcc.dg/torture/bitint-37.c: Likewise. * gcc.dg/torture/bitint-38.c: Likewise. * gcc.dg/torture/bitint-39.c: Likewise. * gcc.dg/torture/bitint-4.c: Likewise. * gcc.dg/torture/bitint-40.c: Likewise. * gcc.dg/torture/bitint-41.c: Likewise. * gcc.dg/torture/bitint-42.c: Likewise. * gcc.dg/torture/bitint-5.c: Likewise. * gcc.dg/torture/bitint-6.c: Likewise. * gcc.dg/torture/bitint-7.c: Likewise. * gcc.dg/torture/bitint-8.c: Likewise. * gcc.dg/torture/bitint-9.c: Likewise. * gcc.dg/torture/builtin-fp-int-inexact-c2x.c: Likewise. * gcc.dg/torture/c2x-stdarg-split-1a.c: Likewise. * gcc.dg/torture/c2x-stdarg-split-1b.c: Likewise. * gcc.dg/torture/float128-nan-floath.c: Likewise. * gcc.dg/torture/float128x-nan-floath.c: Likewise. * gcc.dg/torture/float16-nan-floath.c: Likewise. * gcc.dg/torture/float32-nan-floath.c: Likewise. * gcc.dg/torture/float32x-nan-floath.c: Likewise. * gcc.dg/torture/float64-nan-floath.c: Likewise. * gcc.dg/torture/float64x-nan-floath.c: Likewise. * gcc.target/i386/excess-precision-11.c: Likewise. * gcc.target/i386/excess-precision-12.c: Likewise. * lib/target-supports.exp: Likewise. * objc.dg/attributes/gnu2x-attr-syntax-1.m: Likewise.
2023-11-07c: Refer more consistently to C23 not C2XJoseph Myers10-26/+26
Continuing the move to refer to C23 in place of C2X throughout the source tree, update documentation, diagnostics, comments, variable and function names, etc., to use the C23 name. Testsuite updates are left for a future patch, except for testcases that test diagnostics that previously mentioned C2X (but in those testcases, sometimes other comments are updated, not just the diagnostic expectations). Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/ * builtins.def (DEF_C2X_BUILTIN): Rename to DEF_C23_BUILTIN and use flag_isoc23 and function_c23_misc. * config/rl78/rl78.cc (rl78_option_override): Compare lang_hooks.name with "GNU C23" not "GNU C2X". * coretypes.h (function_c2x_misc): Rename to function_c23_misc. * doc/cpp.texi (@code{__has_attribute}): Refer to C23 instead of C2x. * doc/extend.texi: Likewise. * doc/invoke.texi: Likewise. * dwarf2out.cc (highest_c_language, gen_compile_unit_die): Compare against and return "GNU C23" language string instead of "GNU C2X". * ginclude/float.h: Refer to C23 instead of C2X in comments. * ginclude/stdint-gcc.h: Likewise. * glimits.h: Likewise. * tree.h: Likewise. gcc/ada/ * gcc-interface/utils.cc (flag_isoc2x): Rename to flag_isoc23. gcc/c-family/ * c-common.cc (flag_isoc2x): Rename to flag_isoc23. (c_common_reswords): Use D_C23 instead of D_C2X. * c-common.h: Refer throughout to C23 instead of C2X in comments. (D_C2X): Rename to D_C23. (flag_isoc2x): Rename to flag_isoc23. * c-cppbuiltin.cc (builtin_define_float_constants): Use flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2x in comments. * c-format.cc: Use STD_C23 instead of STD_C2X and flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2X in comments. * c-format.h: Use STD_C23 instead of STD_C2X. * c-lex.cc: Use warn_c11_c23_compat instead of warn_c11_c2x_compat and flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2X in diagnostics. * c-opts.cc: Use flag_isoc23 instead of flag_isoc2x. Refer to C23 instead of C2X in comments. (set_std_c2x): Rename to set_std_c23. * c.opt (Wc11-c23-compat): Use CPP(cpp_warn_c11_c23_compat) CppReason(CPP_W_C11_C23_COMPAT) Var(warn_c11_c23_compat) instead of CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT) Var(warn_c11_c2x_compat). gcc/c/ * c-decl.cc: Use flag_isoc23 instead of flag_isoc2x and c23_auto_p instead of c2x_auto_p. Refer to C23 instead of C2X in diagnostics and comments. * c-errors.cc: Use flag_isoc23 instead of flag_isoc2x and warn_c11_c23_compat instead of warn_c11_c2x_compat. Refer to C23 instead of C2X in comments. * c-parser.cc: Use flag_isoc23 instead of flag_isoc2x, warn_c11_c23_compat instead of warn_c11_c2x_compat, c23_auto_p instead of c2x_auto_p and D_C23 instead of D_C2X. Refer to C23 instead of C2X in diagnostics and comments. * c-tree.h: Refer to C23 instead of C2X in comments. (struct c_declspecs): Rename c2x_auto_p to c23_auto_p. * c-typeck.cc: Use flag_isoc23 instead of flag_isoc2x and warn_c11_c23_compat instead of warn_c11_c2x_compat. Refer to C23 instead of C2X in diagnostics and comments. gcc/fortran/ * gfortran.h (gfc_real_info): Refer to C23 instead of C2X in comment. gcc/lto/ * lto-lang.cc (flag_isoc2x): Rename to flag_isoc23. gcc/testsuite/ * gcc.dg/binary-constants-2.c: Refer to C23 instead of C2X. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/bitint-23.c: Likewise. * gcc.dg/bitint-26.c: Likewise. * gcc.dg/bitint-27.c: Likewise. * gcc.dg/c11-attr-syntax-1.c: Likewise. * gcc.dg/c11-attr-syntax-2.c: Likewise. * gcc.dg/c11-floatn-1.c: Likewise. * gcc.dg/c11-floatn-2.c: Likewise. * gcc.dg/c11-floatn-3.c: Likewise. * gcc.dg/c11-floatn-4.c: Likewise. * gcc.dg/c11-floatn-5.c: Likewise. * gcc.dg/c11-floatn-6.c: Likewise. * gcc.dg/c11-floatn-7.c: Likewise. * gcc.dg/c11-floatn-8.c: Likewise. * gcc.dg/c2x-attr-syntax-4.c: Likewise. * gcc.dg/c2x-attr-syntax-6.c: Likewise. * gcc.dg/c2x-attr-syntax-7.c: Likewise. * gcc.dg/c2x-binary-constants-2.c: Likewise. * gcc.dg/c2x-floatn-5.c: Likewise. * gcc.dg/c2x-floatn-6.c: Likewise. * gcc.dg/c2x-floatn-7.c: Likewise. * gcc.dg/c2x-floatn-8.c: Likewise. * gcc.dg/c2x-nullptr-4.c: Likewise. * gcc.dg/c2x-qual-2.c: Likewise. * gcc.dg/c2x-qual-3.c: Likewise. * gcc.dg/c2x-qual-6.c: Likewise. * gcc.dg/cpp/c11-warning-1.c: Likewise. * gcc.dg/cpp/c11-warning-2.c: Likewise. * gcc.dg/cpp/c11-warning-3.c: Likewise. * gcc.dg/cpp/c2x-warning-2.c: Likewise. * gcc.dg/cpp/gnu11-elifdef-3.c: Likewise. * gcc.dg/cpp/gnu11-elifdef-4.c: Likewise. * gcc.dg/cpp/gnu11-warning-1.c: Likewise. * gcc.dg/cpp/gnu11-warning-2.c: Likewise. * gcc.dg/cpp/gnu11-warning-3.c: Likewise. * gcc.dg/cpp/gnu2x-warning-2.c: Likewise. * gcc.dg/dfp/c11-constants-1.c: Likewise. * gcc.dg/dfp/c11-constants-2.c: Likewise. * gcc.dg/dfp/c2x-constants-2.c: Likewise. * gcc.dg/dfp/constants-pedantic.c: Likewise. * gcc.dg/pr30260.c: Likewise. * gcc.dg/system-binary-constants-1.c: Likewise. libcpp/ * directives.cc: Refer to C23 instead of C2X in diagnostics and comments. (STDC2X): Rename to STDC23. * expr.cc: Use cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat and CPP_W_C11_C23_COMPAT instead of CPP_W_C11_C2X_COMPAT. Refer to C23 instead of C2X in diagnostics and comments. * include/cpplib.h: Refer to C23 instead of C2X in diagnostics and comments. (CLK_GNUC2X): Rename to CLK_GNUC23. (CLK_STDC2X): Rename to CLK_STDC23. (CPP_W_C11_C2X_COMPAT): Rename to CPP_W_C11_C23_COMPAT. * init.cc: Use GNUC23 instead of GNUC2X, STDC23 instead of STDC2X and cpp_warn_c11_c23_compat instead of cpp_warn_c11_c2x_compat. * lex.cc (maybe_va_opt_error): Refer to C23 instead of C2X in diagnostic. * macro.cc (_cpp_arguments_ok): Refer to C23 instead of C2X in comment.
2023-11-06Avoid undeclared use of abort in gcc.dg/cpp/wchar-1.cFlorian Weimer1-2/+2
This should be safe because this is a preprocessor test; it should not exercise implicit function declarations. * gcc.dg/cpp/wchar-1.c (main): Call __builtin_abort instead of abort.
2023-06-20libcpp: Improve location for macro names [PR66290]Lewis Hyatt11-307/+307
When libcpp reports diagnostics whose locus is a macro name (such as for -Wunused-macros), it uses the location in the cpp_macro object that was stored by _cpp_new_macro. This is currently set to pfile->directive_line, which contains the line number only and no column information. This patch changes the stored location to the src_loc for the token defining the macro name, which includes the location and range information. libcpp/ChangeLog: PR c++/66290 * macro.cc (_cpp_create_definition): Add location argument. * internal.h (_cpp_create_definition): Adjust prototype. * directives.cc (do_define): Pass new location argument to _cpp_create_definition. (do_undef): Stop passing inferior location to cpp_warning_with_line; the default from cpp_warning is better. (cpp_pop_definition): Pass new location argument to _cpp_create_definition. * pch.cc (cpp_read_state): Likewise. gcc/testsuite/ChangeLog: PR c++/66290 * c-c++-common/cpp/macro-ranges.c: New test. * c-c++-common/cpp/line-2.c: Adapt to check for column information on macro-related libcpp warnings. * c-c++-common/cpp/line-3.c: Likewise. * c-c++-common/cpp/macro-arg-count-1.c: Likewise. * c-c++-common/cpp/pr58844-1.c: Likewise. * c-c++-common/cpp/pr58844-2.c: Likewise. * c-c++-common/cpp/warning-zero-location.c: Likewise. * c-c++-common/pragma-diag-14.c: Likewise. * c-c++-common/pragma-diag-15.c: Likewise. * g++.dg/modules/macro-2_d.C: Likewise. * g++.dg/modules/macro-4_d.C: Likewise. * g++.dg/modules/macro-4_e.C: Likewise. * g++.dg/spellcheck-macro-ordering.C: Likewise. * gcc.dg/builtin-redefine.c: Likewise. * gcc.dg/cpp/Wunused.c: Likewise. * gcc.dg/cpp/redef2.c: Likewise. * gcc.dg/cpp/redef3.c: Likewise. * gcc.dg/cpp/redef4.c: Likewise. * gcc.dg/cpp/ucnid-11-utf8.c: Likewise. * gcc.dg/cpp/ucnid-11.c: Likewise. * gcc.dg/cpp/undef2.c: Likewise. * gcc.dg/cpp/warn-redefined-2.c: Likewise. * gcc.dg/cpp/warn-redefined.c: Likewise. * gcc.dg/cpp/warn-unused-macros-2.c: Likewise. * gcc.dg/cpp/warn-unused-macros.c: Likewise.
2023-01-16Update copyright years.Jakub Jelinek3-3/+3
2022-12-07preprocessor: Enable __VA_OPT__ for C2xJoseph Myers2-0/+20
C2x supports __VA_OPT__, so adjust libcpp not to pedwarn for uses of it (or of not passing any variable arguments to a variable-arguments macro) in standard C2x mode. I didn't try to duplicate existing tests for the details of the feature, just verified -pedantic-errors handling is as expected. And there's a reasonable argument (bug 98859) that __VA_OPT__ shouldn't be diagnosed in older standard modes at all (as opposed to not passing any variable arguments to a variable-arguments macro, for which older versions of the C standard require a diagnostic as a constraint violation); that argument applies to C as much as to C++, but I haven't made any changes in that regard. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * init.cc (lang_defaults): Enable va_opt for STDC2X. * lex.cc (maybe_va_opt_error): Adjust diagnostic message for C. * macro.cc (_cpp_arguments_ok): Update comment. gcc/testsuite/ * gcc.dg/cpp/c11-vararg-1.c, gcc.dg/cpp/c2x-va-opt-1.c: New tests.
2022-10-14preprocessor: C2x identifier rulesJoseph Myers2-0/+26
C2x has, like C++, adopted rules for identifiers based directly on an unversioned normative reference to Unicode. Make libcpp follow those rules for c2x / gnu2x standards (this involves bringing back a flag separate from the C++ one for whether to use these identifier rules, but this time enabled for all C++ language versions since that was the conclusion adopted for C++ identifier handling). There is one change here that affects C++. I believe the new normative requirement for NFC only applies to identifiers, not to the use of identifier-continue characters in pp-numbers, where there is no such requirement and so the diagnostic ought to be a warning not a pedwarn in pp-numbers, and that this is the case for both C and C++. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * charset.cc (ucn_valid_in_identifier): Check xid_identifiers not cplusplus to determine whether to use CXX23 and NXX23 flags. * include/cpplib.h (struct cpp_options): Add xid_identifiers. * init.cc (struct lang_flags, lang_defaults): Add xid_identifiers. (cpp_set_lang): Set xid_identifiers. * lex.cc (warn_about_normalization): Add parameter identifier. Only pedwarn about non-NFC for identifiers, not pp-numbers. (_cpp_lex_direct): Update calls to warn_about_normalization. gcc/testsuite/ * gcc.dg/cpp/c2x-ucnid-1-utf8.c, gcc.dg/cpp/c2x-ucnid-1.c: New tests.
2022-10-12preprocessor: Fix tracking of system header state [PR60014,PR60723]Lewis Hyatt6-0/+42
The token_streamer class (which implements gcc mode -E and -save-temps/-no-integrated-cpp) needs to keep track whether the last tokens output were in a system header, so that it can generate line marker annotations as necessary for a downstream consumer to reconstruct the state. The logic for tracking it, which was added by r5-1863 to resolve PR60723, has some edge case issues as revealed by the three new test cases. The first, coming from the original PR60014, was incidentally fixed by r9-1926 for unrelated reasons. The other two were still failing on master prior to this commit. Such code paths were not realizable prior to r13-1544, which made it possible for the token streamer to see CPP_PRAGMA tokens in more contexts. The two main issues being corrected here are: 1) print.prev_was_system_token needs to indicate whether the previous token output was in a system location. However, it was not being set on every token, only on those that triggered the main code path; specifically it was not triggered on a CPP_PRAGMA token. Testcase 2 covers this case. 2) The token_streamer uses a variable "line_marker_emitted" to remember whether a line marker has been emitted while processing a given token, so that it wouldn't be done more than once in case multiple conditions requiring a line marker are true. There was no reason for this to be a member variable that retains its value from token to token, since it is just needed for tracking the state locally while processing a single given token. The fact that it could retain its value for a subsequent token is rather difficult to observe, but testcase 3 demonstrates incorrect behavior resulting from that. Moving this to a local variable also simplifies understanding the control flow going forward. gcc/c-family/ChangeLog: PR preprocessor/60014 PR preprocessor/60723 * c-ppoutput.cc (class token_streamer): Remove member line_marker_emitted to... (token_streamer::stream): ...a local variable here. Set print.prev_was_system_token on all code paths. gcc/testsuite/ChangeLog: PR preprocessor/60014 PR preprocessor/60723 * gcc.dg/cpp/pr60014-1.c: New test. * gcc.dg/cpp/pr60014-1.h: New test. * gcc.dg/cpp/pr60014-2.c: New test. * gcc.dg/cpp/pr60014-2.h: New test. * gcc.dg/cpp/pr60014-3.c: New test. * gcc.dg/cpp/pr60014-3.h: New test.
2022-09-30diagnostics: Fix virtual location for -Wuninitialized [PR69543]Lewis Hyatt1-3/+4
Warnings issued for -Wuninitialized have been using the spelling location of the problematic usage, discarding any information on the location of the macro expansion point if such usage was in a macro. This makes the warnings impossible to control reliably with #pragma GCC diagnostic, and also discards useful context in the diagnostic output. There seems to be no need to discard the virtual location information, so this patch fixes that. PR69543 was mostly about _Pragma issues which have been fixed for many years now. The PR remains open because two of the testcases added in response to it still have xfails, but those xfails have nothing to do with _Pragma and rather just with the issue fixed by this patch, so the PR can be closed now as well. The other testcase modified here, pragma-diagnostic-2.c, was explicitly testing for the undesirable behavior that was xfailed in pr69543-3.c. I have adjusted that and also added a new testcase verifying all 3 types of warning that come from tree-ssa-uninit.cc get the proper location information now. gcc/ChangeLog: PR preprocessor/69543 * tree-ssa-uninit.cc (warn_uninit): Stop stripping macro tracking information away from the diagnostic location. (maybe_warn_read_write_only): Likewise. (maybe_warn_operand): Likewise. gcc/testsuite/ChangeLog: PR preprocessor/69543 * c-c++-common/pr69543-3.c: Remove xfail. * c-c++-common/pr69543-4.c: Likewise. * gcc.dg/cpp/pragma-diagnostic-2.c: Adjust test for new behavior. * c-c++-common/pragma-diag-16.c: New test.
2022-09-23testsuite: Add more C2x testsJoseph Myers1-0/+996
There are some new requirements in C2x where GCC already behaves as required (for all standard versions), where previous standard versions either had weaker requirements permitting the GCC behavior, or were arguably defective in what they said in that area. Add tests that specifically verify GCC behaves as expected for C2x. (There may be further such tests to be added in future for already-supported C2x features.) * Compound literals in function parameter lists have automatic storage duration. (This is a case where strictly this wasn't specified by previous standard versions, but it seems to make more sense to treat this as a defect in those versions than to implement something different conditionally for those versions.) * Concatenation of string literals with different prefixes is a constraint violation (previously it was implementation-defined whether it was permitted, and GCC did not permit it). * UCNs above 0x10ffff are a constraint violation; previously they were implicitly undefined behavior by virtue of wording about "designates the character" referring to code points outside the ISO/IEC 10646 range; GCC diagnosed such UCNs since commit 0900e29cdbc533fecf2a311447bbde17f101bbd6 (Sep 2019). The test I added also has more detailed coverage of what lower-valued UCNs are accepted. Tested for x86_64-pc-linux-gnu. * gcc.dg/c2x-complit-1.c, gcc.dg/c2x-concat-1.c, gcc.dg/cpp/c2x-ucn-1.c: New tests.
2022-09-05preprocessor: Disable trigraphs for C2xJoseph Myers3-0/+20
ISO C2x removes trigraphs, so disable them accordingly for -std=c2x (they can still be enabled using -trigraphs). Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * init.cc (lang_defaults): Disable trigraphs for C2x. gcc/testsuite/ * gcc.dg/cpp/c11-trigraphs-1.c, gcc.dg/cpp/c2x-trigraphs-1.c, gcc.dg/cpp/c2x-trigraphs-2.c: New tests.
2022-08-26c++: Implement C++23 P2071R2 - Named universal character escapes [PR106648]Jakub Jelinek2-0/+16
The following patch implements the C++23 P2071R2 - Named universal character escapes paper to support \N{LATIN SMALL LETTER E} etc. I've used Unicode 14.0, there are 144803 character name properties (including the ones generated by Unicode NR1 and NR2 rules) and correction/control/alternate aliases, together with zero terminators that would be 3884745 bytes, which is clearly unacceptable for libcpp. This patch instead contains a generator which from the UnicodeData.txt and NameAliases.txt files emits a space optimized radix tree (208765 bytes long for 14.0), a single string literal dictionary (59418 bytes), maximum name length (currently 88 chars) and two small helper arrays for the NR1/NR2 name generation. The radix tree needs 2 to 9 bytes per node, the exact format is described in the generator program. There could be ways to shrink the dictionary size somewhat at the expense of slightly slower lookups. Currently the patch implements strict matching (that is what is needed to actually implement it on valid code) and Unicode UAX44-LM2 algorithm loose matching to provide hints (that algorithm essentially ignores hyphens in between two alphanumeric characters, spaces and underscores (with one exception for hyphen) and does case insensitive matching). In the attachment is a WIP patch that shows how to implement also spellcheck.{h,cc} style discovery of misspellings, but I'll need to talk to David Malcolm about it, as spellcheck.{h,cc} is in gcc/ subdir (so the WIP incremental patch instead prints all the names to stderr). 2022-08-26 Jakub Jelinek <jakub@redhat.com> PR c++/106648 libcpp/ * charset.cc: Implement C++23 P2071R2 - Named universal character escapes. Include uname2c.h. (hangul_syllables, hangul_count): New variables. (struct uname2c_data): New type. (_cpp_uname2c, _cpp_uname2c_uax44_lm2): New functions. (_cpp_valid_ucn): Use them. Handle named universal character escapes. (convert_ucn): Adjust comment. (convert_escape): Call convert_ucn even for \N. (_cpp_interpret_identifier): Handle named universal character escapes. * lex.cc (get_bidi_ucn): Fix up function comment formatting. (get_bidi_named): New function. (forms_identifier_p, lex_string): Handle named universal character escapes. * makeuname2c.cc: New file. Small parts copied from makeucnid.cc. * uname2c.h: New generated file. gcc/c-family/ * c-cppbuiltin.cc (c_cpp_builtins): Predefine __cpp_named_character_escapes to 202207L. gcc/testsuite/ * c-c++-common/cpp/named-universal-char-escape-1.c: New test. * c-c++-common/cpp/named-universal-char-escape-2.c: New test. * c-c++-common/cpp/named-universal-char-escape-3.c: New test. * c-c++-common/cpp/named-universal-char-escape-4.c: New test. * c-c++-common/Wbidi-chars-25.c: New test. * gcc.dg/cpp/named-universal-char-escape-1.c: New test. * gcc.dg/cpp/named-universal-char-escape-2.c: New test. * g++.dg/cpp/named-universal-char-escape-1.C: New test. * g++.dg/cpp/named-universal-char-escape-2.C: New test. * g++.dg/cpp23/feat-cxx2b.C: Test __cpp_named_character_escapes.
2022-08-20libcpp: Implement C++23 P2290R3 - Delimited escape sequences [PR106645]Jakub Jelinek2-0/+20
The following patch implements the C++23 P2290R3 paper. 2022-08-20 Jakub Jelinek <jakub@redhat.com> PR c++/106645 libcpp/ * include/cpplib.h (struct cpp_options): Implement P2290R3 - Delimited escape sequences. Add delimite_escape_seqs member. * init.cc (struct lang_flags): Likewise. (lang_defaults): Add delim column. (cpp_set_lang): Copy over delimite_escape_seqs. * charset.cc (extend_char_range): New function. (_cpp_valid_ucn): Use it. Handle delimited escape sequences. (convert_hex): Likewise. (convert_oct): Likewise. (convert_ucn): Use extend_char_range. (convert_escape): Call convert_oct even for \o. (_cpp_interpret_identifier): Handle delimited escape sequences. * lex.cc (get_bidi_ucn_1): Likewise. Add end argument, fill it in. (get_bidi_ucn): Adjust get_bidi_ucn_1 caller. Use end argument to compute num_bytes. gcc/testsuite/ * c-c++-common/cpp/delimited-escape-seq-1.c: New test. * c-c++-common/cpp/delimited-escape-seq-2.c: New test. * c-c++-common/cpp/delimited-escape-seq-3.c: New test. * c-c++-common/Wbidi-chars-24.c: New test. * gcc.dg/cpp/delimited-escape-seq-1.c: New test. * gcc.dg/cpp/delimited-escape-seq-2.c: New test. * g++.dg/cpp/delimited-escape-seq-1.C: New test. * g++.dg/cpp/delimited-escape-seq-2.C: New test.
2022-08-18preprocessor: Support #warning for standard C2xJoseph Myers12-0/+70
ISO C2x standardizes the existing #warning extension. Arrange accordingly for it not to be diagnosed with -std=c2x -pedantic, but to be diagnosed with -Wc11-c2x-compat. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/testsuite/ * gcc.dg/cpp/c11-warning-1.c, gcc.dg/cpp/c11-warning-2.c, gcc.dg/cpp/c11-warning-3.c, gcc.dg/cpp/c11-warning-4.c, gcc.dg/cpp/c2x-warning-1.c, gcc.dg/cpp/c2x-warning-2.c, gcc.dg/cpp/gnu11-warning-1.c, gcc.dg/cpp/gnu11-warning-2.c, gcc.dg/cpp/gnu11-warning-3.c, gcc.dg/cpp/gnu11-warning-4.c, gcc.dg/cpp/gnu2x-warning-1.c, gcc.dg/cpp/gnu2x-warning-2.c: New tests. libcpp/ * include/cpplib.h (struct cpp_options): Add warning_directive. * init.cc (struct lang_flags, lang_defaults): Add warning_directive. * directives.cc (DIRECTIVE_TABLE): Mark #warning as STDC2X not EXTENSION. (directive_diagnostics): Diagnose #warning with -Wc11-c2x-compat, or with -pedantic for a standard not supporting #warning.
2022-01-03Update copyright years.Jakub Jelinek3-3/+3
2021-11-01diagnostics: escape non-ASCII source bytes for certain diagnosticsDavid Malcolm2-0/+40
This patch adds support to GCC's diagnostic subsystem for escaping certain bytes and Unicode characters when quoting source code. Specifically, this patch adds a new flag rich_location::m_escape_on_output which is a hint from a diagnostic that non-ASCII bytes in the pertinent lines of the user's source code should be escaped when printed. The patch sets this for the following diagnostics: - when complaining about stray bytes in the program (when these are non-printable) - when complaining about "null character(s) ignored"); - for -Wnormalized= (and generate source ranges for such warnings) The escaping is controlled by a new option: -fdiagnostics-escape-format=[unicode|bytes] For example, consider a diagnostic involing a source line containing the string "before" followed by the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by the string "after", where the diagnostic highlights the U+03C0 character. By default, this line will be printed verbatim to the user when reporting a diagnostic at it, as: beforeπXafter ^ (using X for the stray byte to avoid putting invalid UTF-8 in this commit message) If the diagnostic sets the "escape" flag, it will be printed as: before<U+03C0><BF>after ^~~~~~~~ with -fdiagnostics-escape-format=unicode (the default), or as: before<CF><80><BF>after ^~~~~~~~ if the user supplies -fdiagnostics-escape-format=bytes. This only affects how the source is printed; it does not affect how column numbers that are printed (as per -fdiagnostics-column-unit= and -fdiagnostics-column-origin=). gcc/c-family/ChangeLog: * c-lex.c (c_lex_with_flags): When complaining about non-printable CPP_OTHER tokens, set the "escape on output" flag. gcc/ChangeLog: * common.opt (fdiagnostics-escape-format=): New. (diagnostics_escape_format): New enum. (DIAGNOSTICS_ESCAPE_FORMAT_UNICODE): New enum value. (DIAGNOSTICS_ESCAPE_FORMAT_BYTES): Likewise. * diagnostic-format-json.cc (json_end_diagnostic): Add "escape-source" attribute. * diagnostic-show-locus.c (exploc_with_display_col::exploc_with_display_col): Replace "tabstop" param with a cpp_char_column_policy and add an "aspect" param. Use these to compute m_display_col accordingly. (struct char_display_policy): New struct. (layout::m_policy): New field. (layout::m_escape_on_output): New field. (def_policy): New function. (make_range): Update for changes to exploc_with_display_col ctor. (default_print_decoded_ch): New. (width_per_escaped_byte): New. (escape_as_bytes_width): New. (escape_as_bytes_print): New. (escape_as_unicode_width): New. (escape_as_unicode_print): New. (make_policy): New. (layout::layout): Initialize new fields. Update m_exploc ctor call for above change to ctor. (layout::maybe_add_location_range): Update for changes to exploc_with_display_col ctor. (layout::calculate_x_offset_display): Update for change to cpp_display_width. (layout::print_source_line): Pass policy to cpp_display_width_computation. Capture cpp_decoded_char when calling process_next_codepoint. Move printing of source code to m_policy.m_print_cb. (line_label::line_label): Pass in policy rather than context. (layout::print_any_labels): Update for change to line_label ctor. (get_affected_range): Pass in policy rather than context, updating calls to location_compute_display_column accordingly. (get_printed_columns): Likewise, also for cpp_display_width. (correction::correction): Pass in policy rather than tabstop. (correction::compute_display_cols): Pass m_policy rather than m_tabstop to cpp_display_width. (correction::m_tabstop): Replace with... (correction::m_policy): ...this. (line_corrections::line_corrections): Pass in policy rather than context. (line_corrections::m_context): Replace with... (line_corrections::m_policy): ...this. (line_corrections::add_hint): Update to use m_policy rather than m_context. (line_corrections::add_hint): Likewise. (layout::print_trailing_fixits): Likewise. (selftest::test_display_widths): New. (selftest::test_layout_x_offset_display_utf8): Update to use policy rather than tabstop. (selftest::test_one_liner_labels_utf8): Add test of escaping source lines. (selftest::test_diagnostic_show_locus_one_liner_utf8): Update to use policy rather than tabstop. (selftest::test_overlapped_fixit_printing): Likewise. (selftest::test_overlapped_fixit_printing_utf8): Likewise. (selftest::test_overlapped_fixit_printing_2): Likewise. (selftest::test_tab_expansion): Likewise. (selftest::test_escaping_bytes_1): New. (selftest::test_escaping_bytes_2): New. (selftest::diagnostic_show_locus_c_tests): Call the new tests. * diagnostic.c (diagnostic_initialize): Initialize context->escape_format. (convert_column_unit): Update to use default character width policy. (selftest::test_diagnostic_get_location_text): Likewise. * diagnostic.h (enum diagnostics_escape_format): New enum. (diagnostic_context::escape_format): New field. * doc/invoke.texi (-fdiagnostics-escape-format=): New option. (-fdiagnostics-format=): Add "escape-source" attribute to examples of JSON output, and document it. * input.c (location_compute_display_column): Pass in "policy" rather than "tabstop", passing to cpp_byte_column_to_display_column. (selftest::test_cpp_utf8): Update to use cpp_char_column_policy. * input.h (class cpp_char_column_policy): New forward decl. (location_compute_display_column): Pass in "policy" rather than "tabstop". * opts.c (common_handle_option): Handle OPT_fdiagnostics_escape_format_. * selftest.c (temp_source_file::temp_source_file): New ctor overload taking a size_t. * selftest.h (temp_source_file::temp_source_file): Likewise. gcc/testsuite/ChangeLog: * c-c++-common/diagnostic-format-json-1.c: Add regexp to consume "escape-source" attribute. * c-c++-common/diagnostic-format-json-2.c: Likewise. * c-c++-common/diagnostic-format-json-3.c: Likewise. * c-c++-common/diagnostic-format-json-4.c: Likewise, twice. * c-c++-common/diagnostic-format-json-5.c: Likewise. * gcc.dg/cpp/warn-normalized-4-bytes.c: New test. * gcc.dg/cpp/warn-normalized-4-unicode.c: New test. * gcc.dg/encoding-issues-bytes.c: New test. * gcc.dg/encoding-issues-unicode.c: New test. * gfortran.dg/diagnostic-format-json-1.F90: Add regexp to consume "escape-source" attribute. * gfortran.dg/diagnostic-format-json-2.F90: Likewise. * gfortran.dg/diagnostic-format-json-3.F90: Likewise. libcpp/ChangeLog: * charset.c (convert_escape): Use encoding_rich_location when complaining about nonprintable unknown escape sequences. (cpp_display_width_computation::::cpp_display_width_computation): Pass in policy rather than tabstop. (cpp_display_width_computation::process_next_codepoint): Add "out" param and populate *out if non-NULL. (cpp_display_width_computation::advance_display_cols): Pass NULL to process_next_codepoint. (cpp_byte_column_to_display_column): Pass in policy rather than tabstop. Pass NULL to process_next_codepoint. (cpp_display_column_to_byte_column): Pass in policy rather than tabstop. * errors.c (cpp_diagnostic_get_current_location): New function, splitting out the logic from... (cpp_diagnostic): ...here. (cpp_warning_at): New function. (cpp_pedwarning_at): New function. * include/cpplib.h (cpp_warning_at): New decl for rich_location. (cpp_pedwarning_at): Likewise. (struct cpp_decoded_char): New. (struct cpp_char_column_policy): New. (cpp_display_width_computation::cpp_display_width_computation): Replace "tabstop" param with "policy". (cpp_display_width_computation::process_next_codepoint): Add "out" param. (cpp_display_width_computation::m_tabstop): Replace with... (cpp_display_width_computation::m_policy): ...this. (cpp_byte_column_to_display_column): Replace "tabstop" param with "policy". (cpp_display_width): Likewise. (cpp_display_column_to_byte_column): Likewise. * include/line-map.h (rich_location::escape_on_output_p): New. (rich_location::set_escape_on_output): New. (rich_location::m_escape_on_output): New. * internal.h (cpp_diagnostic_get_current_location): New decl. (class encoding_rich_location): New. * lex.c (skip_whitespace): Use encoding_rich_location when complaining about null characters. (warn_about_normalization): Generate a source range when complaining about improperly normalized tokens, rather than just a point, and use encoding_rich_location so that the source code is escaped on printing. * line-map.c (rich_location::rich_location): Initialize m_escape_on_output. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-10-06libcpp: Implement C++23 P2334R1 - #elifdef/#elifndefJakub Jelinek4-0/+198
This patch implements C++23 P2334R1, which is easy because Joseph has done all the hard work for C2X already. Unlike the C N2645 paper, the C++ P2334R1 contains one important addition (but not in the normative text): "While this is a new preprocessor feature and cannot be treated as a defect report, implementations that support older versions of the standard are encouraged to implement this feature in the older language modes as well as C++23." so there are different variants how to implement it. One is ignoring that sentence and only implementing it for -std=c++23/-std=gnu++23 like it is only implemented for -std=c2x. Another option would be to implement it also in the older GNU modes but not in the C/CXX modes (but it would be strange if we did that just for C++ and not for C). Yet another option is to enable it unconditionally. And yet another option would be to enable it unconditionally but emit a warning (or pedwarn) when it is seen. Note, when it is enabled for the older language modes, as Joseph wrote in the c11-elifdef-1.c testcase, it can result e.g. in rejecting previously valid code: #define A #undef B #if 0 #elifdef A #error "#elifdef A applied" #endif #if 0 #elifndef B #error "#elifndef B applied" #endif Note, seems clang went the enable it unconditionally in all standard versions of both C and C++, no warnings or anything whatsoever, so essentially treated it as a DR that changed behavior of e.g. the above code. After feedback, this option enables #elifdef/#elifndef for -std=c2x and -std=c++2{b,3} and enables it also for -std=gnu*, but for GNU modes older than C2X or C++23 if -pedantic it emits a pedwarn on the directives that either would be rejected in the corresponding -std=c* modes, e.g. #if 1 #elifdef A // pedwarn if -pedantic #endif or when the directives would be silently accepted, but when they are recognized it changes behavior, so e.g. #define A #if 0 #elifdef A // pedwarn if -pedantic #define M 1 #endif It won't pedwarn if the directives would be silently ignored and wouldn't change anything, like: #define A #if 0 #elifndef A #define M 1 #endif or #undef B #if 0 #elifdef B #define M 1 #endif 2021-10-06 Jakub Jelinek <jakub@redhat.com> libcpp/ * init.c (lang_defaults): Implement P2334R1, enable elifdef for -std=c++23 and -std=gnu++23. * directives.c (_cpp_handle_directive): Support elifdef/elifndef if either CPP_OPTION (pfile, elifdef) or !CPP_OPTION (pfile, std). (do_elif): For older non-std modes if pedantic pedwarn about #elifdef/#elifndef directives that change behavior. gcc/testsuite/ * gcc.dg/cpp/gnu11-elifdef-1.c: New test. * gcc.dg/cpp/gnu11-elifdef-2.c: New test. * gcc.dg/cpp/gnu11-elifdef-3.c: New test. * gcc.dg/cpp/gnu11-elifdef-4.c: New test. * g++.dg/cpp/elifdef-1.C: New test. * g++.dg/cpp/elifdef-2.C: New test. * g++.dg/cpp/elifdef-3.C: New test. * g++.dg/cpp/elifdef-4.C: New test. * g++.dg/cpp/elifdef-5.C: New test. * g++.dg/cpp/elifdef-6.C: New test. * g++.dg/cpp/elifdef-7.C: New test.
2021-09-01libcpp: Implement C++23 P1949R7 - C++ Identifier Syntax using Unicode ↵Jakub Jelinek3-4/+21
Standard Annex 31 The following patch implements the P1949R7 - C++ Identifier Syntax using Unicode Standard Annex 31 paper. We already allow UTF-8 characters in the source, so that part is already implemented, so IMHO all we need to do is pedwarn instead of just warn for the (default) -Wnormalize=nfc (or for -Wnormalize={id,nkfc}) if the character is not in NFC and to use the unicode XID_Start and XID_Continue derived code properties to find out what characters are allowed (the standard actually adds U+005F to XID_Start, but we are handling the ASCII compatible characters differently already and they aren't allowed in UCNs in identifiers). Instead of hardcoding the large tables in ucnid.tab, this patch makes makeucnid.c read them from the Unicode tables (13.0.0 version at this point). For non-pedantic mode, we accept as 2nd+ char in identifiers a union of valid characters in all supported modes, but for the 1st char it was actually pedantically requiring that it is not any of the characters that may not appear in the currently chosen standard as the first character. This patch changes it such that also what is allowed at the start of an identifier is a union of characters valid at the start of an identifier in any of the pedantic modes. 2021-09-01 Jakub Jelinek <jakub@redhat.com> PR c++/100977 libcpp/ * include/cpplib.h (struct cpp_options): Add cxx23_identifiers. * charset.c (CXX23, NXX23): New enumerators. (CID, NFC, NKC, CTX): Renumber. (ucn_valid_in_identifier): Implement P1949R7 - use CXX23 and NXX23 flags for cxx23_identifiers. For start character in non-pedantic mode, allow characters that are allowed as start characters in any of the supported language modes, rather than disallowing characters allowed only as non-start characters in current mode but for characters from other language modes allowing them even if they are never allowed at start. * init.c (struct lang_flags): Add cxx23_identifiers. (lang_defaults): Add cxx23_identifiers column. (cpp_set_lang): Initialize CPP_OPTION (pfile, cxx23_identifiers). * lex.c (warn_about_normalization): If cxx23_identifiers, use cpp_pedwarning_with_line instead of cpp_warning_with_line for "is not in NFC" diagnostics. * makeucnid.c: Adjust usage comment. (CXX23, NXX23): New enumerators. (all_languages): Add CXX23. (not_NFC, not_NFKC, maybe_not_NFC): Renumber. (read_derivedcore): New function. (write_table): Print also CXX23 and NXX23 columns. (main): Require 5 arguments instead of 4, call read_derivedcore. * ucnid.h: Regenerated using Unicode 13.0.0 files. gcc/testsuite/ * g++.dg/cpp23/normalize1.C: New test. * g++.dg/cpp23/normalize2.C: New test. * g++.dg/cpp23/normalize3.C: New test. * g++.dg/cpp23/normalize4.C: New test. * g++.dg/cpp23/normalize5.C: New test. * g++.dg/cpp23/normalize6.C: New test. * g++.dg/cpp23/normalize7.C: New test. * g++.dg/cpp23/ucnid-1-utf8.C: New test. * g++.dg/cpp23/ucnid-2-utf8.C: New test. * gcc.dg/cpp/ucnid-4.c: Don't expect "not valid at the start of an identifier" errors. * gcc.dg/cpp/ucnid-4-utf8.c: Likewise. * gcc.dg/cpp/ucnid-5-utf8.c: New test.
2021-08-12libcpp: Fix ICE with -Wtraditional preprocessing [PR101638]Jakub Jelinek1-0/+7
The following testcase ICEs in cpp_sys_macro_p, because cpp_sys_macro_p is called for a builtin macro which doesn't use node->value.macro union member but a different one and so dereferencing it ICEs. As the testcase is distilled from contemporary glibc headers, it means basically -Wtraditional now ICEs on almost everything. The fix can be either the patch below, return true for builtin macros, or we could instead return false for builtin macros, or the fix could be also (untested): --- libcpp/expr.c 2021-05-07 10:34:46.345122608 +0200 +++ libcpp/expr.c 2021-08-12 09:54:01.837556365 +0200 @@ -783,13 +783,13 @@ cpp_classify_number (cpp_reader *pfile, /* Traditional C only accepted the 'L' suffix. Suppress warning about 'LL' with -Wno-long-long. */ - if (CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile)) + if (CPP_WTRADITIONAL (pfile)) { int u_or_i = (result & (CPP_N_UNSIGNED|CPP_N_IMAGINARY)); int large = (result & CPP_N_WIDTH) == CPP_N_LARGE && CPP_OPTION (pfile, cpp_warn_long_long); - if (u_or_i || large) + if ((u_or_i || large) && ! cpp_sys_macro_p (pfile)) cpp_warning_with_line (pfile, large ? CPP_W_LONG_LONG : CPP_W_TRADITIONAL, virtual_location, 0, "traditional C rejects the \"%.*s\" suffix", The builtin macros at least currently don't add any suffixes or numbers -Wtraditional would like to warn about. For floating point suffixes, -Wtraditional calls cpp_sys_macro_p only right away before emitting the warning, but in the above case the ICE is because cpp_sys_macro_p is called even if the number doesn't have any suffixes (that is I think always for builtin macros right now). 2021-08-12 Jakub Jelinek <jakub@redhat.com> PR preprocessor/101638 * macro.c (cpp_sys_macro_p): Return true instead of crashing on builtin macros. * gcc.dg/cpp/pr101638.c: New test.
2021-05-20libcpp: Fix up -fdirectives-only handling of // comments on last line not ↵Jakub Jelinek2-0/+11
terminated with newline [PR100646] As can be seen on the testcases, before the -fdirectives-only preprocessing rewrite the preprocessor would assume // comments are terminated by the end of file even when newline wasn't there, but now we error out. The following patch restores the previous behavior. 2021-05-20 Jakub Jelinek <jakub@redhat.com> PR preprocessor/100646 * lex.c (cpp_directive_only_process): Treat end of file as termination for !is_block comments. * gcc.dg/cpp/pr100646-1.c: New test. * gcc.dg/cpp/pr100646-2.c: New test.
2021-05-12libcpp: Fix up -fdirectives-only preprocessing of includes not ending with ↵Jakub Jelinek2-0/+9
newline [PR100392] If a header doesn't end with a new-line, with -fdirectives-only we right now preprocess it as int i = 1;# 2 "pr100392.c" 2 i.e. the line directive isn't on the next line, which means we fail to parse it when compiling. GCC 10 and earlier libcpp/directives-only.c had for this: if (!pfile->state.skipping && cur != base) { /* If the file was not newline terminated, add rlimit, which is guaranteed to point to a newline, to the end of our range. */ if (cur[-1] != '\n') { cur++; CPP_INCREMENT_LINE (pfile, 0); lines++; } cb->print_lines (lines, base, cur - base); } and we have the assertion /* Files always end in a newline or carriage return. We rely on this for character peeking safety. */ gcc_assert (buffer->rlimit[0] == '\n' || buffer->rlimit[0] == '\r'); So, this patch just does readd the more less same thing, so that we emit a newline after the inline even when it wasn't there before. 2021-05-12 Jakub Jelinek <jakub@redhat.com> PR preprocessor/100392 * lex.c (cpp_directive_only_process): If buffer doesn't end with '\n', add buffer->rlimit[0] character to the printed range and CPP_INCREMENT_LINE and increment line_count. * gcc.dg/cpp/pr100392.c: New test. * gcc.dg/cpp/pr100392.h: New file.
2021-05-11preprocessor: Support C2X #elifdef, #elifndefJoseph Myers3-0/+136
C2X adds #elifdef and #elifndef preprocessor directives; these have also been proposed for C++. Implement these directives in libcpp accordingly. In this implementation, #elifdef and #elifndef are treated as non-directives for any language version other than c2x and gnu2x (if the feature is accepted for C++, it can trivially be enabled for relevant C++ versions). In strict conformance modes for prior language versions, this is required, as illustrated by the c11-elifdef-1.c test added. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * include/cpplib.h (struct cpp_options): Add elifdef. * init.c (struct lang_flags): Add elifdef. (lang_defaults): Update to include elifdef initializers. (cpp_set_lang): Set elifdef for pfile based on language. * directives.c (STDC2X, ELIFDEF): New macros. (EXTENSION): Increase value to 3. (DIRECTIVE_TABLE): Add #elifdef and #elifndef. (_cpp_handle_directive): Do not treat ELIFDEF directives as directives for language versions without the #elifdef feature. (do_elif): Handle #elifdef and #elifndef. (do_elifdef, do_elifndef): New functions. gcc/testsuite/ * gcc.dg/cpp/c11-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-2.c: New tests.
2021-03-04c-ppoutput: Fix preprocessing ICE on very large line number [PR99325]Jakub Jelinek2-0/+12
In libcpp, lines are represented as linenum_type, which is unsigned int. The following testcases ICE because maybe_print_line_1 is sometimes called with UNKNOWN_LOCATION (e.g. at pragma eof) and while most of the time the && src_line >= print.src_line && src_line < print.src_line + 8 check doesn't succeed for the src_line of 0 from UNKNOWN_LOCATION, when print.src_line is from very large line numbers (UINT_MAX - 7 and above) it succeeds (with UB on the compiler side) but src_file is NULL for UNKNOWN_LOCATION and so the strcmp call ICEs. As print.src_line can easily wrap around, this patch changes its type to unsigned int to match libcpp, so that we don't invoke UB in the compiler. For print.src_line of UINT_MAX - 7 and above, src_line from UNKNOWN_LOCATION will not pass that test anymore, but when it wraps around to 0, it can, so I've also added a check for src_loc != UNKNOWN_LOCATION (or, if preferred, could be src_file != NULL). Besides fixing the ICE and UB in the compiler, I believe worst case the patch will cause printing a few more line directives in the preprocessed source around the wrapping from lines UINT_MAX - 7 to 0 (but less around the wrapping from INT_MAX to INT_MAX + 1U), but I think those are exceptional cases (sources with > 2billion lines are rare and we warn or error on #line > INT_MAX). 2021-03-04 Jakub Jelinek <jakub@redhat.com> PR c/99325 * c-ppoutput.c (print): Change src_line type from int to unsigned. (token_streamer::stream) Likewise. (maybe_print_line_1): Likewise. Don't strcmp src_file if src_loc is UNKNOWN_LOCATION. * gcc.dg/cpp/line11.c: New test. * gcc.dg/cpp/line12.c: New test.
2021-02-03libcpp: Fix up -fdirectives-only preprocessing [PR98882]Jakub Jelinek1-0/+6
GCC 11 ICEs on all -fdirectives-only preprocessing when the files don't end with a newline. The problem is in the assertion, for empty TUs buffer->cur == buffer->rlimit and so buffer->rlimit[-1] access triggers UB in the preprocessor, for non-empty TUs it refers to the last character in the file, which can be anything. The preprocessor adds a '\n' character (or '\r', in particular if the user file ends with '\r' then it adds another '\r' rather than '\n'), but that is added after the limit, i.e. at buffer->rlimit[0]. Now, if the routine handles occassional bumping of pos to buffer->rlimit + 1, I think it is just the assert that needs changing, usually we read from *pos if pos < limit and then e.g. if it is '\r', look at the following character (which could be one of those '\n' or '\r' at buffer->rlimit[0]). There is also the case where for '\\' before the limit we read following character and if it is '\n', do one thing, if it is '\r' read another character. But in that case if '\\' was the last char in the TU, the limit char will be '\n', so we are ok. 2021-02-03 Jakub Jelinek <jakub@redhat.com> PR preprocessor/98882 * lex.c (cpp_directive_only_process): Don't assert that rlimit[-1] is a newline, instead assert that rlimit[0] is either newline or carriage return. When seeing '\\' followed by '\r', check limit before accessing pos[1]. * gcc.dg/cpp/pr98882.c: New test.
2021-01-19testsuite: aix testsuite adjustmentsDavid Edelsohn1-2/+2
This patch re-enables the DWARF5 tests that seem to be functioning again. It adds a comment to pr41445-7.c that any changes in lines need to be reflected in the expected output. The patch also allows for additional failures in ucs.c and reflects that builtin-sprintf-warn-20.c requires 4 byte wide char support. gcc/testsuite/ChangeLog: * gcc.dg/cpp/ucs.c: Expect Invalid warning for 2byte wchar. * gcc.dg/debug/dwarf2/inline6.c: Remove skip AIX. * gcc.dg/debug/dwarf2/lang-c11.c: Remove skip AIX. * gcc.dg/debug/dwarf2/pr41445-7.c: Remove skip AIX. * gcc.dg/debug/dwarf2/pr41445-8.c: Remove skip AIX. * gcc.dg/tree-ssa/builtin-sprintf-warn-20.c: Require 4byte wchar.
2021-01-04Update copyright years.Jakub Jelinek3-3/+3
2020-12-01driver: Don't imply -dD for -g3 -g0 [PR97989]Jakub Jelinek2-0/+16
The driver enables -dD when preprocessing when -g3 is specified, for obvious reasons that we need the macros to be preserved somewhere for them to make up the debug info. But it enables it even if -g3 is later overridden to -g2, -g1 or -g0, where we in the end don't emit .debug_mac{ros,info}. The following patch passes -dD only if we'll need it. 2020-12-01 Jakub Jelinek <jakub@redhat.com> PR debug/97989 * gcc.c (cpp_unique_options): Add -dD if %:debug-level-gt(2) rather than g3|ggdb3|gstabs3|gxcoff3|gvms3. * gcc.dg/cpp/pr97989-1.c: New test. * gcc.dg/cpp/pr97989-2.c: New test.
2020-11-27preprocessor: Fix #line overflow check [PR97602]Joseph Myers2-0/+10
The preprocessor check for overflow (of linenum_type = unsigned int) when reading the line number in a #line directive is incomplete; it checks "reg < reg_prev" which doesn't cover all cases where multiplying by 10 overflowed. Fix this by checking for overflow before rather than after it occurs (using essentially the same logic as used by e.g. glibc printf when reading width and precision values from strings). Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ 2020-11-27 Joseph Myers <joseph@codesourcery.com> PR preprocessor/97602 * directives.c (strtolinenum): Check for overflow before it occurs. Correct comment. gcc/testsuite/ 2020-11-27 Joseph Myers <joseph@codesourcery.com> PR preprocessor/97602 * gcc.dg/cpp/line9.c, gcc.dg/cpp/line10.c: New tests.
2020-10-20preprocessor: Further fix for EOF in macro args [PR97471]Nathan Sidwell2-15/+0
My previous attempt at fixing this was incorrect. The problem occurs earlier in that _cpp_lex_direct processes the unwinding EOF needs in collect_args mode. This patch changes it not to do that, in the same way as directive parsing works. Also collect_args shouldn't push_back such fake EOFs, and neither should funlike_invocation_p. libcpp/ * lex.c (_cpp_lex_direct): Do not complete EOF processing when parsing_args. * macro.c (collect_args): Do not unwind fake EOF. (funlike_invocation_p): Do not unwind fake EOF. (cpp_context): Replace abort with gcc_assert. gcc/testsuite/ * gcc.dg/cpp/endif.c: Move to ... * c-c++-common/cpp/endif.c: ... here. * gcc.dg/cpp/endif.h: Move to ... * c-c++-common/cpp/endif.h: ... here. * c-c++-common/cpp/eof-2.c: Adjust diagnostic. * c-c++-common/cpp/eof-3.c: Adjust diagnostic.
2020-05-08preprocessor: Reimplement directives only processing, support raw literals.Nathan Sidwell11-161/+0
The existing directives-only code (a) punched a hole through the libcpp interface and (b) didn't support raw string literals. This reimplements this preprocessing mode. I added a proper callback interface, and adjusted c-ppoutput to use it. Sadly I cannot get rid of the libcpp/internal.h include for unrelated reasons. The new scanner is in lex.x, and works doing some backwards scanning when it finds a charater of interest. This reduces the number of cases one has to deal with in forward scanning. It may have different failure mode than forward scanning on bad tokenization. Finally, Moved some cpp tests from the c-specific dg.gcc/cpp directory to the c-c++-common/cpp shared directory, libcpp/ * directives-only.c: Delete. * Makefile.in (libcpp_a_OBJS, libcpp_a_SOURCES): Remove it. * include/cpplib.h (enum CPP_DO_task): New enum. (cpp_directive_only_preprocess): Declare. * internal.h (_cpp_dir_only_callbacks): Delete. (_cpp_preprocess_dir_only): Delete. * lex.c (do_peek_backslask, do_peek_next, do_peek_prev): New. (cpp_directives_only_process): New implementation. gcc/c-family/ Reimplement directives only processing. * c-ppoutput.c (token_streamer): Ne. (directives_only_cb): New. Swallow ... (print_lines_directives_only): ... this. (scan_translation_unit_directives_only): Reimplment using the published interface. gcc/testsuite/ * gcc.dg/cpp/counter-[23].c: Move to c-c+_-common/cpp. * gcc.dg/cpp/dir-only-*: Likewise. * c-c++-common/cpp/dir-only-[78].c: New.
2020-05-07Fix various dg directives.Manfred Schwarb1-1/+1
* gcc.dg/20050121-1.c: Fix broken dg directives. * gcc.dg/analzyer/pr93382.c: Likewise. * gcc.dg/autopar/pr68460.c: Likewise. * gcc.dg/c90-fordecl-1.c: Likewise. * gcc.dg/cpp/trad/funlike-5.c: Likewise. * gcc.dg/debug/dwarf2/dwarf-dfp.c: Likewise. * gcc.dg/debug/dwarf2/dwarf-float.c: Likewise. * gcc.dg/lto/pr52634_0.c: Likewise. * gcc.dg/pr32069.c: Likewise. * gcc.dg/pr35445.c: Likewise. * gcc.dg/pr40172-3.c: Likewise. * gcc.dg/pr87347.c: Likewise. * gcc.dg/pr88660.c: Likewise. * gcc.dg/pr89689.c: Likewise. * gcc.dg/sinatan-2.c: Likewise. * gcc.dg/sinhatanh-1.c: Likewise. * gcc.dg/sinhovercosh-1.c: Likewise. * gcc.dg/tls/opt-9.c: Likewise. * gcc.dg/torture/builtins-1.c: Likewise. * gcc.dg/torture/pr51106-1.c: Likewise. * gcc.dg/torture/pr51106-2.c: Likewise. * gcc.dg/torture/pr80281.c: Likewise. * gcc.dg/torture/pr92252.c: Likewise. * gcc.dg/tree-ssa/pr79448-2.c: Likewise. * gcc.dg/tree-ssa/pr79448.c: Likewise. * gcc.dg/tree-ssa/pr92163.c: Likewise. * gcc.dg/tree-ssa/reassoc-28.c: Likewise. * gcc.dg/tree-ssa/upcast-1.c: Likewise. * gcc.dg/two-types-6.c: Likewise. * gcc.dg/ubsan/c-shift-1.c: Likewise. * gcc.dg/var-expand3.c: Likewise. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: Likewise. * gcc.dg/vect/pr71264.c: Likewise.
2020-01-01Update copyright years.Jakub Jelinek3-3/+3
From-SVN: r279813
2019-12-30Prevent redefinition of WCHAR_MAX from testsuite/gcc.dg/cpp/ucs.cOlivier Hainque1-0/+4
gcc/testsuite/gcc.dg/cpp/ucs.c #include <limits.h> and then crafts a definition of WCHAR_MAX depending on __WCHAR_TYPE__. The test fails in VxWorks configurations because WCHAR_MAX is already exposed by the system limits.h. The patch simply guards the tentative definition by a check verifying if the macro is defined already, so we're using the value exposed by limits.h in this case. 2019-12-30 Olivier Hainque <hainque@adacore.com> * testsuite/gcc.dg/cpp/ucs.c: Prevent redefinition of WCHAR_MAX if already exposed by limits.h. From-SVN: r279795
2019-12-09Byte vs column awareness for diagnostic-show-locus.c (PR 49973)Lewis Hyatt1-1/+1
contrib/ChangeLog 2019-12-09 Lewis Hyatt <lhyatt@gmail.com> PR preprocessor/49973 * unicode/from_glibc/unicode_utils.py: Support script from glibc (commit 464cd3) to extract character widths from Unicode data files. * unicode/from_glibc/utf8_gen.py: Likewise. * unicode/UnicodeData.txt: Unicode v. 12.1.0 data file. * unicode/EastAsianWidth.txt: Likewise. * unicode/PropList.txt: Likewise. * unicode/gen_wcwidth.py: New utility to generate libcpp/generated_cpp_wcwidth.h with help from the glibc support scripts and the Unicode data files. * unicode/unicode-license.txt: Added. * unicode/README: New explanatory file. libcpp/ChangeLog 2019-12-09 Lewis Hyatt <lhyatt@gmail.com> PR preprocessor/49973 * generated_cpp_wcwidth.h: New file generated by ../contrib/unicode/gen_wcwidth.py, supports new cpp_wcwidth function. * charset.c (compute_next_display_width): New function to help implement display columns. (cpp_byte_column_to_display_column): Likewise. (cpp_display_column_to_byte_column): Likewise. (cpp_wcwidth): Likewise. * include/cpplib.h (cpp_byte_column_to_display_column): Declare. (cpp_display_column_to_byte_column): Declare. (cpp_wcwidth): Declare. (cpp_display_width): New function. gcc/ChangeLog 2019-12-09 Lewis Hyatt <lhyatt@gmail.com> PR preprocessor/49973 * input.c (location_compute_display_column): New function to help with multibyte awareness in diagnostics. (test_cpp_utf8): New self-test. (input_c_tests): Call the new test. * input.h (location_compute_display_column): Declare. * diagnostic-show-locus.c: Pervasive changes to add multibyte awareness to all classes and functions. (enum column_unit): New enum. (class exploc_with_display_col): New class. (class layout_point): Convert m_column member to array m_columns[2]. (layout_range::contains_point): Add col_unit argument. (test_layout_range_for_single_point): Pass new argument. (test_layout_range_for_single_line): Likewise. (test_layout_range_for_multiple_lines): Likewise. (line_bounds::convert_to_display_cols): New function. (layout::get_state_at_point): Add col_unit argument. (make_range): Use empty filename rather than dummy filename. (get_line_width_without_trailing_whitespace): Rename to... (get_line_bytes_without_trailing_whitespace): ...this. (test_get_line_width_without_trailing_whitespace): Rename to... (test_get_line_bytes_without_trailing_whitespace): ...this. (class layout): m_exploc changed to exploc_with_display_col from plain expanded_location. (layout::get_linenum_width): New accessor member function. (layout::get_x_offset_display): Likewise. (layout::calculate_linenum_width): New subroutine for the constuctor. (layout::calculate_x_offset_display): Likewise. (layout::layout): Use the new subroutines. Add multibyte awareness. (layout::print_source_line): Add multibyte awareness. (layout::print_line): Likewise. (layout::print_annotation_line): Likewise. (line_label::line_label): Likewise. (layout::print_any_labels): Likewise. (layout::annotation_line_showed_range_p): Likewise. (get_printed_columns): Likewise. (class line_label): Rename m_length to m_display_width. (get_affected_columns): Rename to... (get_affected_range): ...this; add col_unit argument and multibyte awareness. (class correction): Add m_affected_bytes and m_display_cols members. Rename m_len to m_byte_length for clarity. Add multibyte awareness throughout. (correction::insertion_p): Add multibyte awareness. (correction::compute_display_cols): New function. (correction::ensure_terminated): Use new member name m_byte_length. (line_corrections::add_hint): Add multibyte awareness. (layout::print_trailing_fixits): Likewise. (layout::get_x_bound_for_row): Likewise. (test_one_liner_simple_caret_utf8): New self-test analogous to the one with _utf8 suffix removed, testing multibyte awareness. (test_one_liner_caret_and_range_utf8): Likewise. (test_one_liner_multiple_carets_and_ranges_utf8): Likewise. (test_one_liner_fixit_insert_before_utf8): Likewise. (test_one_liner_fixit_insert_after_utf8): Likewise. (test_one_liner_fixit_remove_utf8): Likewise. (test_one_liner_fixit_replace_utf8): Likewise. (test_one_liner_fixit_replace_non_equal_range_utf8): Likewise. (test_one_liner_fixit_replace_equal_secondary_range_utf8): Likewise. (test_one_liner_fixit_validation_adhoc_locations_utf8): Likewise. (test_one_liner_many_fixits_1_utf8): Likewise. (test_one_liner_many_fixits_2_utf8): Likewise. (test_one_liner_labels_utf8): Likewise. (test_diagnostic_show_locus_one_liner_utf8): Likewise. (test_overlapped_fixit_printing_utf8): Likewise. (test_overlapped_fixit_printing): Adapt for changes to get_affected_columns, get_printed_columns and class corrections. (test_overlapped_fixit_printing_2): Likewise. (test_linenum_sep): New constant. (test_left_margin): Likewise. (test_offset_impl): Helper function for new test. (test_layout_x_offset_display_utf8): New test. (diagnostic_show_locus_c_tests): Call new tests. gcc/testsuite/ChangeLog: 2019-12-09 Lewis Hyatt <lhyatt@gmail.com> PR preprocessor/49973 * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (test_show_locus): Tweak so that expected output is the same as before the diagnostic-show-locus.c changes. * gcc.dg/cpp/pr66415-1.c: Likewise. From-SVN: r279137
2019-10-02Handle :: tokens in C for C2x.Joseph Myers11-0/+90
As part of adding [[]]-style attributes, C2x adds the token :: for use in scoped attribute names. This patch adds corresponding support for that token in C to GCC. The token is supported both for C2x and for older gnu* standards (on the basis that extensions are normally supported in older gnu* versions; people will expect to be able to use [[]] attributes, before C2x is the default, without needing to use -std=gnu2x). There are no cases in older C standards where the token : can be followed by a token starting with : in syntactically valid sources; the only cases the :: token could break in older standard C thus are ones involving concatenation of pp-tokens where the result does not end up as tokens (e.g., gets stringized). In GNU C extensions, the main case where :: might appear in existing sources is in asm statements, and the C parser is thus made to handle it like two consecutive : tokens, which the C++ parser already does. A limited test of various positionings of :: in asm statements is added to the testsuite (in particular, to cover the syntax error when :: means too many colons but a single : would be OK), but existing tests cover a variety of styles there anyway. Technically there are cases in Objective-C and OpenMP for which this also changes how previously valid code is lexed: the objc-selector-arg syntax allows multiple consecutive : tokens (although I don't think they are particularly useful there), while OpenMP syntax includes array section syntax such as [:] which, before :: was a token, could also be written as [::> (there might be other OpenMP cases potentially affected, I didn't check all the OpenMP syntax in detail). I don't think either of those cases affects the basis for supporting the :: token in all -std=gnu* modes, or that there is any obvious need to special-case handling of CPP_SCOPE tokens for those constructs the way there is for asm statements. cpp_avoid_paste, which determines when spaces need adding between tokens in preprocessed output where there wouldn't otherwise be whitespace between them (e.g. if stringized), already inserts space between : and : unconditionally, rather than only for C++, so no change is needed there (but a C2x test is added that such space is indeed inserted). Bootstrapped with no regressions on x86-64-pc-linux-gnu. gcc/c: * c-parser.c (c_parser_asm_statement): Handle CPP_SCOPE like two CPP_COLON tokens. gcc/testsuite: * gcc.dg/asm-scope-1.c, gcc.dg/cpp/c11-scope-1.c, gcc.dg/cpp/c17-scope-1.c, gcc.dg/cpp/c2x-scope-1.c, gcc.dg/cpp/c2x-scope-2.c, gcc.dg/cpp/c90-scope-1.c, gcc.dg/cpp/c94-scope-1.c, gcc.dg/cpp/c99-scope-1.c, gcc.dg/cpp/gnu11-scope-1.c, gcc.dg/cpp/gnu17-scope-1.c, gcc.dg/cpp/gnu89-scope-1.c, gcc.dg/cpp/gnu99-scope-1.c: New tests. libcpp: * include/cpplib.h (struct cpp_options): Add member scope. * init.c (struct lang_flags, lang_defaults): Likewise. (cpp_set_lang): Set scope member of pfile. * lex.c (_cpp_lex_direct): Test CPP_OPTION (pfile, scope) not CPP_OPTION (pfile, cplusplus) for creating CPP_SCOPE tokens. From-SVN: r276434
2019-09-26charset.c (UCS_LIMIT): New macro.Eric Botcazou2-3/+5
* charset.c (UCS_LIMIT): New macro. (ucn_valid_in_identifier): Use it instead of a hardcoded constant. (_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than UCS_LIMIT outside of identifiers in C and in C++2a or later. From-SVN: r276167
2019-09-19Support extended characters in C/C++ identifiers (PR c/67224)Lewis Hyatt13-0/+168
libcpp/ChangeLog 2019-09-19 Lewis Hyatt <lhyatt@gmail.com> PR c/67224 * charset.c (_cpp_valid_utf8): New function to help lex UTF-8 tokens. * internal.h (_cpp_valid_utf8): Declare. * lex.c (forms_identifier_p): Use it to recognize UTF-8 identifiers. (_cpp_lex_direct): Handle UTF-8 in identifiers and CPP_OTHER tokens. Do all work in "default" case to avoid slowing down typical code paths. Also handle $ and UCN in the default case for consistency. gcc/Changelog 2019-09-19 Lewis Hyatt <lhyatt@gmail.com> PR c/67224 * doc/cpp.texi: Document support for extended characters in identifiers. * doc/cppopts.texi: Likewise. gcc/testsuite/ChangeLog 2019-09-19 Lewis Hyatt <lhyatt@gmail.com> PR c/67224 * c-c++-common/cpp/ucnid-2011-1-utf8.c: New test. * g++.dg/cpp/ucnid-1-utf8.C: New test. * g++.dg/cpp/ucnid-2-utf8.C: New test. * g++.dg/cpp/ucnid-3-utf8.C: New test. * g++.dg/cpp/ucnid-4-utf8.C: New test. * g++.dg/other/ucnid-1-utf8.C: New test. * gcc.dg/cpp/ucnid-1-utf8.c: New test. * gcc.dg/cpp/ucnid-10-utf8.c: New test. * gcc.dg/cpp/ucnid-11-utf8.c: New test. * gcc.dg/cpp/ucnid-12-utf8.c: New test. * gcc.dg/cpp/ucnid-13-utf8.c: New test. * gcc.dg/cpp/ucnid-14-utf8.c: New test. * gcc.dg/cpp/ucnid-15-utf8.c: New test. * gcc.dg/cpp/ucnid-2-utf8.c: New test. * gcc.dg/cpp/ucnid-3-utf8.c: New test. * gcc.dg/cpp/ucnid-4-utf8.c: New test. * gcc.dg/cpp/ucnid-6-utf8.c: New test. * gcc.dg/cpp/ucnid-7-utf8.c: New test. * gcc.dg/cpp/ucnid-9-utf8.c: New test. * gcc.dg/ucnid-1-utf8.c: New test. * gcc.dg/ucnid-10-utf8.c: New test. * gcc.dg/ucnid-11-utf8.c: New test. * gcc.dg/ucnid-12-utf8.c: New test. * gcc.dg/ucnid-13-utf8.c: New test. * gcc.dg/ucnid-14-utf8.c: New test. * gcc.dg/ucnid-15-utf8.c: New test. * gcc.dg/ucnid-16-utf8.c: New test. * gcc.dg/ucnid-2-utf8.c: New test. * gcc.dg/ucnid-3-utf8.c: New test. * gcc.dg/ucnid-4-utf8.c: New test. * gcc.dg/ucnid-5-utf8.c: New test. * gcc.dg/ucnid-6-utf8.c: New test. * gcc.dg/ucnid-7-utf8.c: New test. * gcc.dg/ucnid-8-utf8.c: New test. * gcc.dg/ucnid-9-utf8.c: New test. From-SVN: r275979
2019-06-24[Darwin, testsuite] Fix isystem-2.c.Iain Sandoe2-2/+9
For the test to succeed there needs to be some header that is to be found in the 'expected' place i.e. <sysroot>/usr/include/. It's important that it is not the name of a header for which fixincludes have been applied, since such headers will be found in the gcc include-fixed dir and, in general, reference additional headers. The dummy sysroot will prevent the additional headers from being found, resulting in a failed test. The fix is to use a header name that isn't expected to be present in a real sysroot. 2019-06-24 Iain Sandoe <iain@sandoe.co.uk> * gcc.dg/cpp/isysroot-1.c (main): Use <example.h> as the test header. * gcc.dg/cpp/usr/include/stdio.h: Rename... * gcc.dg/cpp/usr/include/example.h: ... to this. From-SVN: r272625
2019-05-17trans.c (check_inlining_for_nested_subprog): Quote reserved names.Martin Sebor1-1/+1
gcc/ada/ChangeLog: * gcc-interface/trans.c (check_inlining_for_nested_subprog): Quote reserved names. gcc/brig/ChangeLog: * brigfrontend/brig-control-handler.cc (brig_directive_control_handler::operator): Remove trailing newline from a diagnostic. * brigfrontend/brig-module-handler.cc (brig_directive_module_handler::operator): Remove a duplicated space from a diagnostic. gcc/c/ChangeLog: * c-decl.c (start_decl): Quote keywords, operators, and types in diagnostics. (finish_decl): Same. * c-parser.c (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_transaction_cancel): Same. * c-typeck.c (c_common_type): Same. (build_conditional_expr): Same. (digest_init): Same. (process_init_element): Same. (build_binary_op): Same. gcc/c-family/ChangeLog: * c-attribs.c (handle_no_sanitize_attribute): Quote identifiers, keywords, operators, and types in diagnostics. (handle_scalar_storage_order_attribute): Same. (handle_mode_attribute): Same. (handle_visibility_attribute): Same. (handle_assume_aligned_attribute): Same. (handle_no_split_stack_attribute): Same. * c-common.c (shorten_compare): Same. (c_common_truthvalue_conversion): Same. (cb_get_source_date_epoch): Same. * c-lex.c (cb_def_pragma): Quote keywords, operators, and types in diagnostics. (interpret_float): Same. * c-omp.c (c_finish_omp_for): Same. * c-opts.c (c_common_post_options): Same. * c-pch.c (c_common_pch_pragma): Same. * c-pragma.c (pop_alignment): Same. (handle_pragma_pack): Same. (apply_pragma_weak): Same. (handle_pragma_weak): Same. (handle_pragma_scalar_storage_order): Same. (handle_pragma_redefine_extname): Same. (add_to_renaming_pragma_list): Same. (maybe_apply_renaming_pragma): Same. (push_visibility): Same. (handle_pragma_visibility): Same. (handle_pragma_optimize): Same. (handle_pragma_message): Same. * c-warn.c (warn_for_omitted_condop): Same. (lvalue_error): Same. gcc/cp/ChangeLog: * call.c (print_z_candidate): Wrap diagnostic text in a gettext macro. Adjust. (print_z_candidates): Same. (build_conditional_expr_1): Quote keywords, operators, and types in diagnostics. (build_op_delete_call): Same. (maybe_print_user_conv_context): Wrap diagnostic text in a gettext macro. (convert_like_real): Same. (convert_arg_to_ellipsis): Quote keywords, operators, and types in diagnostics. (build_over_call): Same. (joust): Break up an overlong line. Wrap diagnostic text in a gettext macro. * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English. (cxx_eval_constant_expression): Quote keywords, operators, and types in diagnostics. (potential_constant_expression_1): Same. * cp-gimplify.c (cp_genericize_r): Same. * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types in diagnostics. (type_promotes_to): Same. * decl.c (check_previous_goto_1): Same. (check_goto): Same. (start_decl): Same. (cp_finish_decl): Avoid parenthesizing a sentence for consistency. (grok_op_properties): Quote keywords, operators, and types in diagnostics. * decl2.c (grokfield): Same. (coerce_delete_type): Same. * except.c (is_admissible_throw_operand_or_catch_parameter): Same. * friend.c (do_friend): Quote C++ tokens. * init.c (build_new_1): Quote keywords, operators, and types in diagnostics. (build_vec_delete_1): Same. (build_delete): Same. * lex.c (parse_strconst_pragma): Same. (handle_pragma_implementation): Same. (unqualified_fn_lookup_error): Same. * mangle.c (write_type): Same. * method.c (defaulted_late_check): Avoid two consecutive punctuators. * name-lookup.c (cp_binding_level_debug): Remove a trailing newline. (pop_everything): Same. * parser.c (cp_lexer_start_debugging): Quote a macro name. in a diagnostic (cp_lexer_stop_debugging): Same. (cp_parser_userdef_numeric_literal): Quote a C++ header name in a diagnostic. (cp_parser_nested_name_specifier_opt): Quote keywords, operators, and types in diagnostics. (cp_parser_question_colon_clause): Same. (cp_parser_asm_definition): Same. (cp_parser_init_declarator): Same. (cp_parser_template_declaration_after_parameters): Avoid capitalizing a sentence in a diagnostic. (cp_parser_omp_declare_reduction): Quote keywords, operators, and types in diagnostics. (cp_parser_transaction): Same. * pt.c (maybe_process_partial_specialization): Replace second call to permerror with inform for consistency with other uses. (expand_integer_pack): Quote keywords, operators, and types in diagnostics. * rtti.c (get_typeid): Quote keywords, operators, and types in diagnostics. (build_dynamic_cast_1): Same. * semantics.c (finish_asm_stmt): Same. (finish_label_decl): Same. (finish_bases): Same. (finish_offsetof): Same. (cp_check_omp_declare_reduction): Same. (finish_decltype_type): Same. * tree.c (handle_init_priority_attribute): Same. Add detail to diagnostics. (maybe_warn_zero_as_null_pointer_constant): Same. * typeck.c (cp_build_binary_op): Quote keywords, operators, and types in diagnostics. (cp_build_unary_op): Same. (check_for_casting_away_constness): Same. (build_static_cast): Same. (build_const_cast_1): Same. (maybe_warn_about_returning_address_of_local): Same. (check_return_expr): Same. * typeck2.c (abstract_virtuals_error_sfinae): Same. (digest_init_r): Replace a tab with spaces in a diagnostic. (build_functional_cast): Quote keywords, operators, and types in diagnostics. gcc/d/ChangeLog: * d-builtins.cc (d_init_builtins): Quote keywords, operators, and types in diagnostics. * d-codegen.cc (get_array_length): Same. Replace can't with cannot. * d-convert.cc (convert_expr): Same. * d-frontend.cc (getTypeInfoType): Quote an option name in a diagnostic. * d-lang.cc (d_handle_option): Same. (d_parse_file): Same. * decl.cc: Remove a trailing period from a diagnostic. * expr.cc: Use a directive for an apostrophe. * toir.cc: Quote keywords, operators, and types in diagnostics. * typeinfo.cc (build_typeinfo): Quote an option name in a diagnostic. gcc/fortran/ChangeLog: * gfortranspec.c (append_arg): Spell out the word "argument." gcc/ChangeLog: * config/i386/i386-expand.c (get_element_number): Quote keywords and other internal names in diagnostics. Adjust other diagnostic formatting issues noted by -Wformat-diag. * config/i386/i386-features.c (ix86_mangle_function_version_assembler_name): Same. * config/i386/i386-options.c (ix86_handle_abi_attribute): Same. * config/i386/i386.c (ix86_function_type_abi): Same. (ix86_function_ms_hook_prologue): Same. (classify_argument): Same. (ix86_expand_prologue): Same. (ix86_md_asm_adjust): Same. (ix86_memmodel_check): Same. gcc/ChangeLog: * builtins.c (expand_builtin_atomic_always_lock_free): Quote identifiers, keywords, operators, and types in diagnostics. Correct quoting, spelling, and sentence capitalization issues. (expand_builtin_atomic_is_lock_free): Same. (fold_builtin_next_arg): Same. * cfgexpand.c (expand_one_var): Same. (tree_conflicts_with_clobbers_p): Same. (expand_asm_stmt): Same. (verify_loop_structure): Same. * cgraphunit.c (process_function_and_variable_attributes): Same. * collect-utils.c (collect_execute): Same. * collect2.c (maybe_run_lto_and_relink): Same. (is_lto_object_file): Same. (scan_prog_file): Same. * convert.c (convert_to_real_1): Same. * dwarf2out.c (dwarf2out_begin_prologue): Same. * except.c (verify_eh_tree): Same. * gcc.c (execute): Same. (eval_spec_function): Same. (run_attempt): Same. (driver::set_up_specs): Same. (compare_debug_auxbase_opt_spec_function): Same. * gcov-tool.c (unlink_gcda_file): Same. (do_merge): Same. (do_rewrite): Same. * gcse.c (gcse_or_cprop_is_too_expensive): Same. * gimplify.c (gimplify_asm_expr): Same. (gimplify_adjust_omp_clauses): Same. * hsa-gen.c (gen_hsa_addr_insns): Same. (gen_hsa_insns_for_load): Same. (gen_hsa_cmp_insn_from_gimple): Same. (gen_hsa_insns_for_operation_assignment): Same. (gen_get_level): Same. (gen_hsa_alloca): Same. (omp_simple_builtin::generate): Same. (gen_hsa_atomic_for_builtin): Same. (gen_hsa_insns_for_call): Same. * input.c (dump_location_info): Same. * ipa-devirt.c (compare_virtual_tables): Same. * ira.c (ira_setup_eliminable_regset): Same. * lra-assigns.c (lra_assign): Same. * lra-constraints.c (lra_constraints): Same. * lto-streamer-in.c (lto_input_mode_table): Same. * lto-wrapper.c (get_options_from_collect_gcc_options): Same. (merge_and_complain): Same. (compile_offload_image): Same. (compile_images_for_offload_targets): Same. (debug_objcopy): Same. (run_gcc): Same. (main): Same. * opts.c (print_specific_help): Same. (parse_no_sanitize_attribute): Same. (print_help): Same. (handle_param): Same. * plugin.c (add_new_plugin): Same. (parse_plugin_arg_opt): Same. (try_init_one_plugin): Same. * print-rtl.c (debug_bb_n_slim): Quote identifiers, keywords, operators, and types in diagnostics. Correct quoting and spelling issues. * read-rtl-function.c (parse_edge_flag_token): Same. (function_reader::parse_enum_value): Same. * reg-stack.c (check_asm_stack_operands): Same. * regcprop.c (validate_value_data): Same. * sched-rgn.c (make_pass_sched_fusion): Same. * stmt.c (check_unique_operand_names): Same. * targhooks.c (default_target_option_pragma_parse): Same. * tlink.c (recompile_files): Same. * toplev.c (process_options): Same. (do_compile): Same. * trans-mem.c (diagnose_tm_1): Same. (ipa_tm_scan_irr_block): Same. (ipa_tm_diagnose_transaction): Same. * tree-cfg.c (verify_address): Same. Use get_tree_code_name to format a tree code name in a diagnostic. (verify_types_in_gimple_min_lval): Same. (verify_types_in_gimple_reference): Same. (verify_gimple_call): Same. (verify_gimple_assign_unary): Same. (verify_gimple_assign_binary): Same. (verify_gimple_assign_ternary): Same. (verify_gimple_assign_single): Same. (verify_gimple_switch): Same. (verify_gimple_label): Same. (verify_gimple_phi): Same. (verify_gimple_in_seq): Same. (verify_eh_throw_stmt_node): Same. (collect_subblocks): Same. (gimple_verify_flow_info): Same. (do_warn_unused_result): Same. * tree-inline.c (expand_call_inline): Same. * tree-into-ssa.c (update_ssa): Same. * tree.c (tree_int_cst_elt_check_failed): Same. (tree_vec_elt_check_failed): Same. (omp_clause_operand_check_failed): Same. (verify_type_variant): Same. (verify_type): Same. * value-prof.c (verify_histograms): Same. * varasm.c (assemble_start_function): Same. gcc/lto/ChangeLog: * lto-dump.c (lto_main): Same. * lto.c (stream_out): Same. gcc/objc/ChangeLog: * objc-act.c (objc_begin_catch_clause): Quote keywords and options in diagnostics. (objc_build_throw_stmt): Same. (objc_finish_message_expr): Same. (get_super_receiver): Same. * objc-next-runtime-abi-01.c (objc_next_runtime_abi_01_init): Spell out "less than" in English./ * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Spell out "greater" in English. gcc/testsuite/ChangeLog: * c-c++-common/Wbool-operation-1.c: Adjust text of expected diagnostics. * c-c++-common/Wvarargs-2.c: Same. * c-c++-common/Wvarargs.c: Same. * c-c++-common/pr51768.c: Same. * c-c++-common/tm/inline-asm.c: Same. * c-c++-common/tm/safe-1.c: Same. * g++.dg/asm-qual-1.C: Same. * g++.dg/asm-qual-3.C: Same. * g++.dg/conversion/dynamic1.C: Same. * g++.dg/cpp0x/constexpr-89599.C: Same. * g++.dg/cpp0x/constexpr-cast.C: Same. * g++.dg/cpp0x/constexpr-shift1.C: Same. * g++.dg/cpp0x/lambda/lambda-conv11.C: Same. * g++.dg/cpp0x/nullptr04.C: Same. * g++.dg/cpp0x/static_assert12.C: Same. * g++.dg/cpp0x/static_assert8.C: Same. * g++.dg/cpp1y/lambda-conv1.C: Same. * g++.dg/cpp1y/pr79393-3.C: Same. * g++.dg/cpp1y/static_assert1.C: Same. * g++.dg/cpp1z/constexpr-if4.C: Same. * g++.dg/cpp1z/constexpr-if5.C: Same. * g++.dg/cpp1z/constexpr-if9.C: Same. * g++.dg/eh/goto2.C: Same. * g++.dg/eh/goto3.C: Same. * g++.dg/expr/static_cast8.C: Same. * g++.dg/ext/flexary5.C: Same. * g++.dg/ext/utf-array-short-wchar.C: Same. * g++.dg/ext/utf-array.C: Same. * g++.dg/ext/utf8-2.C: Same. * g++.dg/gomp/loop-4.C: Same. * g++.dg/gomp/macro-4.C: Same. * g++.dg/gomp/udr-1.C: Same. * g++.dg/init/initializer-string-too-long.C: Same. * g++.dg/other/offsetof9.C: Same. * g++.dg/ubsan/pr63956.C: Same. * g++.dg/warn/Wbool-operation-1.C: Same. * g++.dg/warn/Wtype-limits-Wextra.C: Same. * g++.dg/warn/Wtype-limits.C: Same. * g++.dg/wrappers/pr88680.C: Same. * g++.old-deja/g++.mike/eh55.C: Same. * gcc.dg/Wsign-compare-1.c: Same. * gcc.dg/Wtype-limits-Wextra.c: Same. * gcc.dg/Wtype-limits.c: Same. * gcc.dg/Wunknownprag.c: Same. * gcc.dg/Wunsuffixed-float-constants-1.c: Same. * gcc.dg/asm-6.c: Same. * gcc.dg/asm-qual-1.c: Same. * gcc.dg/cast-1.c: Same. * gcc.dg/cast-2.c: Same. * gcc.dg/cast-3.c: Same. * gcc.dg/cpp/source_date_epoch-2.c: Same. * gcc.dg/debug/pr85252.c: Same. * gcc.dg/dfp/cast-bad.c: Same. * gcc.dg/format/gcc_diag-1.c: Same. * gcc.dg/format/gcc_diag-11.c: Same.New test. * gcc.dg/gcc_diag-11.c: Same.New test. * gcc.dg/gnu-cond-expr-2.c: Same. * gcc.dg/gnu-cond-expr-3.c: Same. * gcc.dg/gomp/macro-4.c: Same. * gcc.dg/init-bad-1.c: Same. * gcc.dg/init-bad-2.c: Same. * gcc.dg/init-bad-3.c: Same. * gcc.dg/pr27528.c: Same. * gcc.dg/pr48552-1.c: Same. * gcc.dg/pr48552-2.c: Same. * gcc.dg/pr59846.c: Same. * gcc.dg/pr61096-1.c: Same. * gcc.dg/pr8788-1.c: Same. * gcc.dg/pr90082.c: Same. * gcc.dg/simd-2.c: Same. * gcc.dg/spellcheck-params-2.c: Same. * gcc.dg/spellcheck-params.c: Same. * gcc.dg/strlenopt-49.c: Same. * gcc.dg/tm/pr52141.c: Same. * gcc.dg/torture/pr51106-1.c: Same. * gcc.dg/torture/pr51106-2.c: Same. * gcc.dg/utf-array-short-wchar.c: Same. * gcc.dg/utf-array.c: Same. * gcc.dg/utf8-2.c: Same. * gcc.dg/warn-sprintf-no-nul.c: Same. * gcc.target/i386/asm-flag-0.c: Same. * gcc.target/i386/inline_error.c: Same. * gcc.target/i386/pr30848.c: Same. * gcc.target/i386/pr39082-1.c: Same. * gcc.target/i386/pr39678.c: Same. * gcc.target/i386/pr57756.c: Same. * gcc.target/i386/pr68843-1.c: Same. * gcc.target/i386/pr79804.c: Same. * gcc.target/i386/pr82673.c: Same. * obj-c++.dg/class-protocol-1.mm: Same. * obj-c++.dg/exceptions-3.mm: Same. * obj-c++.dg/exceptions-4.mm: Same. * obj-c++.dg/exceptions-5.mm: Same. * obj-c++.dg/exceptions-6.mm: Same. * obj-c++.dg/method-12.mm: Same. * obj-c++.dg/method-13.mm: Same. * obj-c++.dg/method-6.mm: Same. * obj-c++.dg/method-7.mm: Same. * obj-c++.dg/method-9.mm: Same. * obj-c++.dg/method-lookup-1.mm: Same. * obj-c++.dg/proto-lossage-4.mm: Same. * obj-c++.dg/protocol-qualifier-2.mm: Same. * objc.dg/call-super-2.m: Same. * objc.dg/class-protocol-1.m: Same. * objc.dg/desig-init-1.m: Same. * objc.dg/exceptions-3.m: Same. * objc.dg/exceptions-4.m: Same. * objc.dg/exceptions-5.m: Same. * objc.dg/exceptions-6.m: Same. * objc.dg/method-19.m: Same. * objc.dg/method-2.m: Same. * objc.dg/method-5.m: Same. * objc.dg/method-6.m: Same. * objc.dg/method-7.m: Same. * objc.dg/method-lookup-1.m: Same. * objc.dg/proto-hier-1.m: Same. * objc.dg/proto-lossage-4.m: Same. From-SVN: r271338
2019-03-11Wrap option names in gcc internal messages with %< and %>.Martin Liska3-3/+3
2019-03-11 Martin Liska <mliska@suse.cz> * check-internal-format-escaping.py: New file. 2019-03-11 Martin Liska <mliska@suse.cz> * builtins.c (expand_builtin_thread_pointer): Wrap an option name in a string format message and fix GNU coding style. (expand_builtin_set_thread_pointer): Likewise. * common/config/aarch64/aarch64-common.c (aarch64_rewrite_selected_cpu): Likewise. * common/config/alpha/alpha-common.c (alpha_handle_option): Likewise. * common/config/arc/arc-common.c (arc_handle_option): Likewise. * common/config/arm/arm-common.c (arm_parse_fpu_option): Likewise. * common/config/bfin/bfin-common.c (bfin_handle_option): Likewise. * common/config/i386/i386-common.c (ix86_handle_option): Likewise. * common/config/ia64/ia64-common.c (ia64_handle_option): Likewise. * common/config/m68k/m68k-common.c (m68k_handle_option): Likewise. * common/config/msp430/msp430-common.c (msp430_handle_option): Likewise. * common/config/nds32/nds32-common.c (nds32_handle_option): Likewise. * common/config/powerpcspe/powerpcspe-common.c (rs6000_handle_option): Likewise. * common/config/riscv/riscv-common.c (riscv_subset_list::parsing_subset_version): Likewise. (riscv_subset_list::parse_std_ext): Likewise. (riscv_subset_list::parse_sv_or_non_std_ext): Likewise. (riscv_subset_list::parse): Likewise. * common/config/rs6000/rs6000-common.c (rs6000_handle_option): Likewise. * config/aarch64/aarch64.c (aarch64_parse_one_option_token): Likewise. (aarch64_override_options_internal): Likewise. (aarch64_validate_mcpu): Likewise. (aarch64_validate_march): Likewise. (aarch64_validate_mtune): Likewise. (aarch64_override_options): Likewise. * config/alpha/alpha.c (alpha_option_override): Likewise. * config/arc/arc.c (arc_init): Likewise. (parse_mrgf_banked_regs_option): Likewise. (arc_override_options): Likewise. (arc_expand_builtin_aligned): Likewise. * config/arm/arm-builtins.c (arm_expand_neon_builtin): Likewise. (arm_expand_builtin): Likewise. * config/arm/arm.c (arm_option_check_internal): Likewise. (arm_configure_build_target): Likewise. (arm_option_override): Likewise. (arm_options_perform_arch_sanity_checks): Likewise. (arm_handle_cmse_nonsecure_entry): Likewise. (arm_handle_cmse_nonsecure_call): Likewise. (arm_tls_referenced_p): Likewise. (thumb1_expand_prologue): Likewise. * config/avr/avr.c (avr_option_override): Likewise. * config/bfin/bfin.c (bfin_option_override): Likewise. * config/c6x/c6x.c (c6x_option_override): Likewise. * config/cr16/cr16.c (cr16_override_options): Likewise. * config/cris/cris.c (cris_option_override): Likewise. * config/csky/csky.c (csky_handle_isr_attribute): Likewise. * config/darwin-c.c (macosx_version_as_macro): Likewise. * config/darwin.c (darwin_override_options): Likewise. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/h8300/h8300.c (h8300_option_override): Likewise. * config/i386/i386.c (parse_mtune_ctrl_str): Likewise. (ix86_option_override_internal): Likewise. (warn_once_call_ms2sysv_xlogues): Likewise. (ix86_expand_prologue): Likewise. (split_stack_prologue_scratch_regno): Likewise. (ix86_warn_parameter_passing_abi): Likewise. * config/ia64/ia64.c (fix_range): Likewise. * config/m68k/m68k.c (m68k_option_override): Likewise. * config/microblaze/microblaze.c (microblaze_option_override): Likewise. * config/mips/mips.c (mips_emit_probe_stack_range): Likewise. (mips_set_compression_mode): Likewise. * config/mmix/mmix.c (mmix_option_override): Likewise. * config/mn10300/mn10300.c (mn10300_option_override): Likewise. * config/msp430/msp430.c (msp430_option_override): Likewise. * config/nds32/nds32.c (nds32_option_override): Likewise. * config/nios2/nios2.c (nios2_custom_check_insns): Likewise. (nios2_option_override): Likewise. (nios2_expand_custom_builtin): Likewise. * config/nvptx/mkoffload.c (main): Likewise. * config/nvptx/nvptx.c (diagnose_openacc_conflict): Likewise. * config/pa/pa.c (fix_range): Likewise. (pa_option_override): Likewise. * config/riscv/riscv.c (riscv_parse_cpu): Likewise. (riscv_option_override): Likewise. * config/rl78/rl78.c (rl78_option_override): Likewise. * config/rs6000/aix61.h: Likewise. * config/rs6000/aix71.h: Likewise. * config/rs6000/aix72.h: Likewise. * config/rs6000/driver-rs6000.c (elf_platform): Likewise. * config/rs6000/freebsd64.h: Likewise. * config/rs6000/linux64.h: Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. (rs6000_expand_zeroop_builtin): Likewise. (rs6000_expand_mtfsb_builtin): Likewise. (rs6000_expand_set_fpscr_rn_builtin): Likewise. (rs6000_expand_set_fpscr_drn_builtin): Likewise. (rs6000_invalid_builtin): Likewise. (rs6000_expand_split_stack_prologue): Likewise. * config/rs6000/rtems.h: Likewise. * config/rx/rx.c (valid_psw_flag): Likewise. (rx_expand_builtin): Likewise. * config/s390/s390-c.c (s390_resolve_overloaded_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. (s390_function_profiler): Likewise. (s390_option_override_internal): Likewise. (s390_option_override): Likewise. * config/sh/sh.c (sh_option_override): Likewise. (sh_builtin_saveregs): Likewise. (sh_fix_range): Likewise. * config/sh/vxworks.h: Likewise. * config/sparc/sparc.c (sparc_option_override): Likewise. * config/spu/spu.c (spu_option_override): Likewise. (fix_range): Likewise. * config/visium/visium.c (visium_option_override): Likewise. (visium_handle_interrupt_attr): Likewise. * config/xtensa/xtensa.c (xtensa_option_override): Likewise. * dbgcnt.c (dbg_cnt_set_limit_by_name): Likewise. (dbg_cnt_process_opt): Likewise. * dwarf2out.c (output_dwarf_version): Likewise. * except.c (expand_eh_return): Likewise. * gcc.c (defined): Likewise. (driver_handle_option): Likewise. (process_command): Likewise. (compare_files): Likewise. (driver::prepare_infiles): Likewise. (driver::do_spec_on_infiles): Likewise. (driver::maybe_run_linker): Likewise. * omp-offload.c (oacc_parse_default_dims): Likewise. * opts-global.c (handle_common_deferred_options): Likewise. * opts.c (parse_sanitizer_options): Likewise. (common_handle_option): Likewise. (enable_warning_as_error): Likewise. * passes.c (enable_disable_pass): Likewise. * plugin.c (parse_plugin_arg_opt): Likewise. (default_plugin_dir_name): Likewise. * targhooks.c (default_expand_builtin_saveregs): Likewise. (default_pch_valid_p): Likewise. * toplev.c (init_asm_output): Likewise. (process_options): Likewise. (toplev::run_self_tests): Likewise. * tree-cfg.c (verify_gimple_call): Likewise. * tree-inline.c (inline_forbidden_p_stmt): Likewise. (tree_inlinable_function_p): Likewise. * var-tracking.c (vt_find_locations): Likewise. 2019-03-11 Martin Liska <mliska@suse.cz> * gcc-interface/misc.c (gnat_post_options) Wrap an option name in a string format message and fix GNU coding style.: 2019-03-11 Martin Liska <mliska@suse.cz> * c-attribs.c (handle_nocf_check_attribute): Wrap an option name in a string format message and fix GNU coding style. * c-common.c (vector_types_convertible_p): Likewise. (c_build_vec_perm_expr): Likewise. * c-indentation.c (get_visual_column): Likewise. * c-opts.c (c_common_handle_option): Likewise. (c_common_post_options): Likewise. (sanitize_cpp_opts): Likewise. * c-pch.c (c_common_pch_pragma): Likewise. * c-pragma.c (handle_pragma_pack): Likewise. 2019-03-11 Martin Liska <mliska@suse.cz> * c-decl.c (check_for_loop_decls): Wrap an option name in a string format message and fix GNU coding style. * c-parser.c (c_parser_declspecs): Likewise. 2019-03-11 Martin Liska <mliska@suse.cz> * call.c (convert_arg_to_ellipsis): Wrap an option name in a string format message and fix GNU coding style. (build_over_call): Likewise. * class.c (check_field_decl): Likewise. (layout_nonempty_base_or_field): Likewise. * constexpr.c (cxx_eval_loop_expr): Likewise. * cvt.c (type_promotes_to): Likewise. * decl.c (cxx_init_decl_processing): Likewise. (mark_inline_variable): Likewise. (grokdeclarator): Likewise. * decl2.c (record_mangling): Likewise. * error.c (maybe_warn_cpp0x): Likewise. * except.c (doing_eh): Likewise. * mangle.c (maybe_check_abi_tags): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_userdef_numeric_literal): Likewise. (cp_parser_primary_expression): Likewise. (cp_parser_unqualified_id): Likewise. (cp_parser_pseudo_destructor_name): Likewise. (cp_parser_builtin_offsetof): Likewise. (cp_parser_lambda_expression): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_lambda_declarator_opt): Likewise. (cp_parser_selection_statement): Likewise. (cp_parser_init_statement): Likewise. (cp_parser_decomposition_declaration): Likewise. (cp_parser_function_specifier_opt): Likewise. (cp_parser_static_assert): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_namespace_definition): Likewise. (cp_parser_using_declaration): Likewise. (cp_parser_ctor_initializer_opt_and_function_body): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_type_parameter_key): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_try_block): Likewise. (cp_parser_std_attribute_spec): Likewise. (cp_parser_requires_clause_opt): Likewise. * pt.c (check_template_variable): Likewise. (check_default_tmpl_args): Likewise. (push_tinst_level_loc): Likewise. (instantiate_pending_templates): Likewise. (invalid_nontype_parm_type_p): Likewise. * repo.c (get_base_filename): Likewise. * rtti.c (typeid_ok_p): Likewise. (build_dynamic_cast_1): Likewise. * tree.c (maybe_warn_parm_abi): Likewise. 2019-03-11 Martin Liska <mliska@suse.cz> * decl.c (match_record_decl): Wrap an option name in a string format message and fix GNU coding style. (gfc_match_pointer): Likewise. * expr.c (find_array_section): Likewise. * intrinsic.c (gfc_is_intrinsic): Likewise. * options.c (gfc_post_options): Likewise. * primary.c (match_integer_constant): Likewise. * trans-common.c (translate_common): Likewise. 2019-03-11 Martin Liska <mliska@suse.cz> * lto-lang.c (lto_post_options): Wrap an option name in a string format message and fix GNU coding style. * lto-symtab.c (lto_symtab_merge_decls_2): Likewise. 2019-03-11 Martin Liska <mliska@suse.cz> * g++.dg/conversion/simd3.C (foo): Wrap option names with apostrophe character. * g++.dg/cpp1z/decomp3.C (test): Likewise. (test3): Likewise. * g++.dg/cpp1z/decomp4.C (test): Likewise. * g++.dg/cpp1z/decomp44.C (foo): Likewise. * g++.dg/cpp1z/decomp45.C (f): Likewise. * g++.dg/opt/pr34036.C: Likewise. * g++.dg/spellcheck-c++-11-keyword.C: Likewise. * gcc.dg/c90-fordecl-1.c (foo): Likewise. * gcc.dg/cpp/dir-only-4.c: Likewise. * gcc.dg/cpp/dir-only-5.c: Likewise. * gcc.dg/cpp/pr71591.c: Likewise. * gcc.dg/format/opt-1.c: Likewise. * gcc.dg/format/opt-2.c: Likewise. * gcc.dg/format/opt-3.c: Likewise. * gcc.dg/format/opt-4.c: Likewise. * gcc.dg/format/opt-5.c: Likewise. * gcc.dg/format/opt-6.c: Likewise. * gcc.dg/pr22231.c: Likewise. * gcc.dg/pr33007.c: Likewise. * gcc.dg/simd-1.c (hanneke): Likewise. * gcc.dg/simd-5.c: Likewise. * gcc.dg/simd-6.c: Likewise. * gcc.dg/spellcheck-options-14.c: Likewise. * gcc.dg/spellcheck-options-15.c: Likewise. * gcc.dg/spellcheck-options-16.c: Likewise. * gcc.dg/spellcheck-options-17.c: Likewise. * gcc.dg/tree-ssa/pr23109.c: Likewise. * gcc.dg/tree-ssa/recip-5.c: Likewise. * gcc.target/i386/cet-notrack-1a.c (func): Likewise. (__attribute__): Likewise. * gcc.target/i386/cet-notrack-icf-1.c (fn3): Likewise. * gcc.target/i386/cet-notrack-icf-3.c (__attribute__): Likewise. * gcc.target/powerpc/warn-1.c: Likewise. * gcc.target/powerpc/warn-2.c: Likewise. From-SVN: r269586
2019-01-01Update copyright years.Jakub Jelinek3-3/+3
From-SVN: r267494
2018-08-16[PATCH] Macro definition parameter parsingNathan Sidwell2-8/+8
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00977.html libcpp/ * internal.h (_cpp_save_parameter): Take parmno, not macro. (_cpp_unsave_parameters): Declare. * macro.c (_cpp_save_parameter): Take parm number, not macro. Return true on success. (_cpp_unsave_parameters): New. (parse_params): Take parm_no and variadic pointers, not macro. Reimplement parsing logic. (create_iso_definition): Adjust parse_params changes. Call _cpp_unsave_parameters here. (_cpp_create_definition): Don't unsave params here. * traditional.c (scan_parameters): Take n_param pointer, adjust. (_cpp_create_trad_definition): Ajust scan_parameters change. Call _cpp_unsave_parameters. gcc/testsuite/ * gcc.dg/cpp/macsyntx.c: Adjust expected errors. * gcc.dg/cpp/macsyntx2.c: likewise. From-SVN: r263600
2018-08-15diagnostics: add labeling of source rangesDavid Malcolm1-0/+2
This patch adds the ability to label source ranges within a rich_location, to be printed by diagnostic_show_locus. For example: pr69554-1.c:11:18: error: invalid operands to binary + (have 'const char *' and 'const char *') 11 | return (p + 1) + (q + 1); | ~~~~~~~ ^ ~~~~~~~ | | | | | const char * | const char * The patch implements labels for various type mismatch errors in the C and C++ frontends, and in -Wformat. I implemented it wherever accurate location information was guaranteed (there are other places that could benefit, but we need better location information in those places). The labels can be disabled via -fno-diagnostics-show-labels. Similarly: param-type-mismatch.C: In function 'int test_1(int, int, float)': param-type-mismatch.C:11:27: error: invalid conversion from 'int' to 'const char*' [-fpermissive] 11 | return callee_1 (first, second, third); | ^~~~~~ | | | int param-type-mismatch.C:7:43: note: initializing argument 2 of 'int callee_1(int, const char*, float)' 7 | extern int callee_1 (int one, const char *two, float three); | ~~~~~~~~~~~~^~~ where the first "error" describing the bad argument gets a label describing the type inline (since it's non-obvious from "second"). The "note" describing the type of the param of the callee *doesn't* get a label, since that information is explicit there in the source ("const char *two"). The idea is that in any diagnostic where two aspects of the source aren't in sync it ought to be easier for the user if we directly show them the mismatching aspects inline (e.g. types). As well as type mismatch errors, perhaps labels could also be used for buffer overflow warnings, for describing the capacity of the destination buffer vs the size of what's being written: sprintf (buf, "filename: %s\n", file); ^~~ ~~~~~~~~~~~^~~ | | capacity: 32 10 + strlen(file) + 2 or somesuch. Another idea might be for macro expansion warnings: warning: repeated side effects in macro expansion... x = MIN (p++, q++); ~~~~^~~~~~~~~~ note: ...expanded here as #define MIN(X,Y) (X<Y?X:Y) ^~~ ~ ~ ~ ~ ~ ~ | | | | | | | | | | | q++ | | | | p++ | | | q++ | q++ p++ p++ The patch removes some logic from multiline.exp which special-cased lines ending with a '|' character (thus complicating testing of this patch). I believe that this was a vestige from experiments I did to support strippng dg directives from the output; it was present in the earliest version of multiline.exp I posted: "[RFC, stage1] Richer source location information for gcc 6 (location ranges etc)" https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00837.html and I believe was neved used. gcc/c-family/ChangeLog: * c-format.c: Include "selftest-diagnostic.h" and "gcc-rich-location.h". (format_warning_at_char): Pass NULL for new label params of format_warning_va. (class indirection_suffix): New class. (class range_label_for_format_type_mismatch): New class. (format_type_warning): Move logic for generating "*" suffix to class indirection_suffix. Create "fmt_label" and "param_label" to show their types, and pass them to the format_warning_at_substring calls. (selftest::test_type_mismatch_range_labels): New test. (selftest::c_format_c_tests): Call it. gcc/c/ChangeLog: * c-objc-common.c: Include "gcc-rich-location.h". (c_tree_printer): Move implemenation of '%T' to... (print_type): ...this new function. (range_label_for_type_mismatch::get_text): New function. * c-typeck.c (convert_for_assignment): Add type labels to the rhs range for the various ic_argpass cases. (class maybe_range_label_for_tree_type_mismatch): New class. (build_binary_op): Use it when calling binary_op_error. gcc/cp/ChangeLog: * call.c: Include "gcc-rich-location.h". (convert_like_real): Add range label for "invalid conversion" diagnostic. (perform_implicit_conversion_flags): Add type label to the "could not convert" error. * error.c: Include "gcc-rich-location.h". (range_label_for_type_mismatch::get_text): New function. * typeck.c (convert_for_assignment): Add type label to the "cannot convert" error if a location is available. gcc/ChangeLog: * common.opt (fdiagnostics-show-labels): New option. * diagnostic-show-locus.c (class layout_range): Add field "m_label". (class layout): Add field "m_show_labels_p". (layout_range::layout_range): Add param "label" and use it to initialize m_label. (make_range): Pass in NULL for new "label" param of layout_range's ctor. (layout::layout): Initialize m_show_labels_p. (layout::maybe_add_location_range): Pass in loc_range->m_label when constructing layout_range instances. (struct line_label): New struct. (layout::print_any_labels): New member function. (layout::print_line): Call it if label-printing is enabled. (selftest::test_one_liner_labels): New test. (selftest::test_diagnostic_show_locus_one_liner): Call it. * diagnostic.c (diagnostic_initialize): Initialize context->show_labels_p. * diagnostic.h (struct diagnostic_context): Add field "show_labels_p". * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fno-diagnostics-show-labels. * dwarf2out.c (gen_producer_string): Add OPT_fdiagnostics_show_labels to the ignored options. * gcc-rich-location.c (gcc_rich_location::add_expr): Add "label" param. (gcc_rich_location::maybe_add_expr): Likewise. * gcc-rich-location.h (gcc_rich_location::gcc_rich_location): Add label" param, defaulting to NULL. (gcc_rich_location::add_expr): Add "label" param. (gcc_rich_location::maybe_add_expr): Likewise. (class text_range_label): New class. (class range_label_for_type_mismatch): New class. * gimple-ssa-sprintf.c (fmtwarn): Pass NULL for new label params of format_warning_va. (fmtwarn_n): Likewise for new params of format_warning_n_va. * lto-wrapper.c (merge_and_complain): Add OPT_fdiagnostics_show_labels to the "pick one setting" options. (append_compiler_options): Likewise to the dropped options. (append_diag_options): Likewise to the passed-on options. * opts.c (common_handle_option): Handle the new option. * selftest-diagnostic.c (test_diagnostic_context::test_diagnostic_context): Enable show_labels_p. * substring-locations.c: Include "gcc-rich-location.h". (format_warning_n_va): Add "fmt_label" and "param_label" params and use them as appropriate. (format_warning_va): Add "fmt_label" and "param_label" params, passing them on to format_warning_n_va. (format_warning_at_substring): Likewise. (format_warning_at_substring_n): Likewise. * substring-locations.h (format_warning_va): Add "fmt_label" and "param_label" params. (format_warning_n_va): Likewise. (format_warning_at_substring): Likewise. (format_warning_at_substring_n): Likewise. * toplev.c (general_init): Initialize global_dc->show_labels_p. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/aka3.C: New test. * g++.dg/diagnostic/param-type-mismatch-2.C: Update expected output to show range labels. * g++.dg/diagnostic/param-type-mismatch.C: Likewise. * g++.dg/plugin/plugin.exp (plugin_test_list): Add... * g++.dg/plugin/show-template-tree-color-labels.C: New test. * gcc.dg/bad-binary-ops.c: Update expected output to show range labels. Add an "aka" example. * gcc.dg/cpp/pr66415-1.c: Update expected output to show range labels. * gcc.dg/format/diagnostic-ranges.c: Likewise. * gcc.dg/format/pr72858.c: Likewise. * gcc.dg/format/pr78498.c: Likewise. * gcc.dg/param-type-mismatch.c: Add "-Wpointer-sign" to options. Update expected output to show range labels. Add examples of -Wincompatible-pointer-types and -Wpointer-sign for parameters. * gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c: Update expected output to show range labels. * gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise. (test_very_wide_line): Adjust so that label is at left-clipping boundary. (test_very_wide_line_2): New test. * gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c: Update expected output to show range labels. * gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise. * gcc.dg/plugin/diagnostic-test-show-locus-no-labels.c: New test. * gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update for new param to gcc_rich_location::add_expr. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (add_range): Add "label" param. (test_show_locus): Add examples of labels to various tests. Tweak the "very wide_line" test case and duplicate it, to cover the boundary values for clipping of labels against the left-margin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add diagnostic-test-show-locus-no-labels.c. * gcc.dg/pr69554-1.c: Update expected output to show range labels. Update line numbers of dg-locus directives. * gcc.dg/pr69627.c: Update expected output to show range labels. * lib/multiline.exp (proc _build_multiline_regex): Remove special-case handling of lines with trailing '|'. libcpp/ChangeLog: * include/line-map.h (struct location_range): Add "m_label" field. (class rich_location): Add description of labels to leading comment. (rich_location::rich_location): Add "label" param, defaulting to NULL. (rich_location::add_range): Likewise. (struct label_text): New struct. (class range_label): New abstract base class. * line-map.c (rich_location::rich_location): Add "label" param; use it. (rich_location::add_range): Likewise. From-SVN: r263564