aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-07-28libstdc++: Teach std::distance and std::advance about C++20 iterators [PR102181]Jonathan Wakely2-3/+125
When the C++98 std::distance and std::advance functions (and C++11 std::next and std::prev) are used with C++20 iterators there can be unexpected results, ranging from compilation failure to decreased performance to undefined behaviour. An iterator which satisfies std::input_iterator but does not meet the Cpp17InputIterator requirements might have std::output_iterator_tag for its std::iterator_traits<I>::iterator_category, which means it currently cannot be used with std::advance at all. However, the implementation of std::advance for a Cpp17InputIterator doesn't do anything that isn't valid for iterator types satsifying C++20 std::input_iterator. Similarly, a type satisfying C++20 std::bidirectional_iterator might be usable with std::prev, if it weren't for the fact that its C++17 iterator_category is std::input_iterator_tag. Finally, a type satisfying C++20 std::random_access_iterator might use a slower implementation for std::distance or std::advance if its C++17 iterator_category is not std::random_access_iterator_tag. This commit adds a __promotable_iterator concept to detect C++20 iterators which explicitly define an iterator_concept member, and which either have no iterator_category, or their iterator_category is weaker than their iterator_concept. This is used by std::distance and std::advance to detect iterators which should dispatch based on their iterator_concept instead of their iterator_category. This means that those functions just work and do the right thing for C++20 iterators which would otherwise fail to compile or have suboptimal performance. This is related to LWG 3197, which considers making it undefined to use std::prev with types which do not meet the Cpp17BidirectionalIterator requirements. I think making it work, as in this commit, is a better solution than banning it (or rejecting it at compile-time as libc++ does). PR libstdc++/102181 libstdc++-v3/ChangeLog: * include/bits/stl_iterator_base_funcs.h (distance, advance): Check C++20 iterator concepts and handle appropriately. (__detail::__iter_category_converts_to_concept): New concept. (__detail::__promotable_iterator): New concept. * testsuite/24_iterators/operations/cxx20_iterators.cc: New test. Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-07-28git_commit.py: add "diagnostics" to bug componentsDavid Malcolm1-0/+1
contrib/ChangeLog * gcc-changelog/git_commit.py: Add "diagnostics" to bug components.
2025-07-28restore bootstrap with --enable-checking=release [PR121260]Mikael Pettersson5-5/+15
Current trunk doesn't bootstrap with --enable-checking=release due to improper nesting of namespaces and #if CHECKING_P blocks. This corrects that. gcc/ PR other/121260 * diagnostics/changes.cc: Correct nesting of namespaces and #if CHECKING_P blocks. * diagnostics/context.cc: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/output-spec.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. Signed-off-by: Mikael Pettersson <mikpelinux@gmail.com> Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-28nvptx/nvptx.opt: Update -march-map= for newer sm_xxx: test casesThomas Schwinge15-0/+285
Test cases for commit 60ba2b61af23e6d561c5cbab8df57ea093ade3b3 "nvptx/nvptx.opt: Update -march-map= for newer sm_xxx". gcc/testsuite/ * gcc.target/nvptx/march-map=sm_100.c: New. * gcc.target/nvptx/march-map=sm_100a.c: Likewise. * gcc.target/nvptx/march-map=sm_100f.c: Likewise. * gcc.target/nvptx/march-map=sm_101.c: Likewise. * gcc.target/nvptx/march-map=sm_101a.c: Likewise. * gcc.target/nvptx/march-map=sm_101f.c: Likewise. * gcc.target/nvptx/march-map=sm_103.c: Likewise. * gcc.target/nvptx/march-map=sm_103a.c: Likewise. * gcc.target/nvptx/march-map=sm_103f.c: Likewise. * gcc.target/nvptx/march-map=sm_120.c: Likewise. * gcc.target/nvptx/march-map=sm_120a.c: Likewise. * gcc.target/nvptx/march-map=sm_120f.c: Likewise. * gcc.target/nvptx/march-map=sm_121.c: Likewise. * gcc.target/nvptx/march-map=sm_121a.c: Likewise. * gcc.target/nvptx/march-map=sm_121f.c: Likewise.
2025-07-28nvptx/nvptx.opt: Update -march-map= for newer sm_xxxTobias Burnus1-0/+45
Usage of the -march-map=: "Select the closest available '-march=' value that is not more capable." As PTX ISA 8.6/8.7 (= unreleased CUDA 12.7 + CUDA 12.8) added the Nvidia Blackwell GPUs SM_100, SM_101, and SM_120, it makes sense to add them as well. Note that all three come as sm_XXX and sm_XXXa. PTX ISA 8.8 (CUDA 12.9) added SM_103 and SM_121 and the new 'f' suffix for all SM_1xx. Internally, GCC currently generates the same code for >= sm_80 (Ampere); however, as GCC's -march= also supports sm_89 (Ada), the here added sm_1xxs (Blackwell) will map to sm_89. [Naming note: while ptx code generated for sm_X can also run with sm_Y if Y > X, code generated for sm_XXXa can (generally) only run on the specific hardware; and sm_XXXf implies compatibility with only subsequent targets in the same family.] gcc/ChangeLog: * config/nvptx/nvptx.opt (march-map=): Add sm_100{,f,a}, sm_101{,f,a}, sm_103{,a,f}, sm_120{,a,f} and sm_121{,f,a}.
2025-07-28gcn: Fix CDNA3 atomics' buffer invalidationTobias Burnus1-10/+12
For device (agent) scope atomics - as needed when there is more than one teams, a buffer_wbl2 followed by s_waitcnt is required. When doing the initial porting, the pre-atomic instruction got accidentally replaced by buffer_inv sc1, which is not quite the right instruction. gcc/ChangeLog: * config/gcn/gcn.md (atomic_load, atomic_store, atomic_exchange): Fix CDNA3 L2 cache write-back before atomic instructions.
2025-07-28Const correctness for gather-scatter infoRichard Biener1-6/+6
The following adds const qualification to gather_scatter_info * parameters for various APIs in the vectorizer. * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Make *gs_info const. (vect_build_one_gather_load_call): Likewise. (vect_build_one_scatter_store_call): Likewise. (vect_get_gather_scatter_ops): Likewise. (vect_get_strided_load_store_ops): Likewise.
2025-07-28gcn: Add more s_nop for MI300Tobias Burnus3-38/+55
Implement another case where the CDNA3 ISA documentation requires s_nop, add a comment why another case does not need to be handled. And add one case where an s_nop is required by MI300A hardware but seems to be not mentioned in the CDNA3 ISA documentation. gcc/ChangeLog: * config/gcn/gcn.md (define_attr "vcmp"): Add with values vcmp/vcmpx/no. (*movbi, cstoredi4.., cstore<mode>4): Set it. * config/gcn/gcn-valu.md (vec_cmp<mode>...): Likewise. * config/gcn/gcn.cc (gcn_cmpx_insn_p): Remove. (gcn_md_reorg): Add two new conditions for MI300.
2025-07-28gcn: Add 'nops' insn, extend commentsTobias Burnus3-2/+18
Use 's_nops' with a number instead of multiple of 's_nop' when manually adding 1 to 5 wait state. This helps with the instruction cache and helps a tiny bit with PR119367 where a two-byte variable overflows in the debugging location view handling. Add a comment about 'sc0' to TARGET_GLC_NAME as for atomics it is unrelated to the scope but to whether the result is stored; i.e. using e.g. 'sc1' instead of 'sc0' will have undesired consequences! Update the comment above print_operand_address to document 'R' and 'V'; those are used below as "Temporary hack.", but it makes sense to see them in the list. gcc/ChangeLog: * config/gcn/gcn-opts.h (enum hsaco_attr_type): Add comment about 'sc0'. * config/gcn/gcn.cc (gcn_md_reorg): Use gen_nops instead of gen_nop. (print_operand_address): Document 'R' and 'V' in the pre-function comment as well. * config/gcn/gcn.md (nops): Add.
2025-07-28libstdc++: provide debug impl of P2697 ctor [PR119742]Nathan Myers1-0/+11
This adds the new bitset constructor from string_view defined in P2697 to the debug version of the type. libstdc++-v3/Changelog: PR libstdc++/119742 * include/debug/bitset: Add new ctor.
2025-07-28tree-optimization/121256 - properly support SLP in vectorizable recurrenceRichard Biener3-8/+155
We failed to build the correct initialization vector. For VLA vectors and a non-uniform initialization vector this rejects vectorization for now. PR tree-optimization/121256 * tree-vect-loop.cc (vectorizable_recurr): Build a correct initialization vector for SLP_TREE_LANES > 1. * gcc.dg/vect/vect-recurr-pr121256.c: New testcase. * gcc.dg/vect/vect-recurr-pr121256-2.c: Likewise.
2025-07-28libstdc++: Fix style issues in <mdspan>.Luc Grosheintz1-13/+4
libstdc++-v3/ChangeLog: * include/std/mdspan: Small stylistic adjustments. Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-07-28Move STMT_VINFO_TYPE to SLP_TREE_TYPERichard Biener10-103/+94
I am at a point where I want to store additional information from analysis (from loads and stores) to re-use them at transform stage without repeating the analysis. I do not want to add to stmt_vec_info at this point, so this starts adding kind specific sub-structures by moving the STMT_VINFO_TYPE field to the SLP tree and adding a (dummy for now) union tagged by it to receive such data. The change is largely mechanical after RISC-V has been prepared to have a SLP node around. I have settled for a union (supposed to get pointers to data). As followup this enables getting rid of SLP_TREE_CODE and making VEC_PERM therein a separate type, unifying its handling. * tree-vectorizer.h (_slp_tree::type): Add. (_slp_tree::u): Likewise. (_stmt_vec_info::type): Remove. (STMT_VINFO_TYPE): Likewise. (SLP_TREE_TYPE): New. * tree-vectorizer.cc (vec_info::new_stmt_vec_info): Do not initialize type. * tree-vect-slp.cc (_slp_tree::_slp_tree): Initialize type. (vect_slp_analyze_node_operations): Adjust. (vect_schedule_slp_node): Likewise. * tree-vect-patterns.cc (vect_init_pattern_stmt): Do not copy STMT_VINFO_TYPE. * tree-vect-loop.cc: Set SLP_TREE_TYPE instead of STMT_VINFO_TYPE everywhere. (vect_create_loop_vinfo): Do not set STMT_VINFO_TYPE on loop conditions. * tree-vect-stmts.cc: Set SLP_TREE_TYPE instead of STMT_VINFO_TYPE everywhere. (vect_analyze_stmt): Adjust. (vect_transform_stmt): Likewise. * config/aarch64/aarch64.cc (aarch64_vector_costs::count_ops): Access SLP_TREE_TYPE instead of STMT_VINFO_TYPE. * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Remove non-SLP element-wise load/store matching. * config/rs6000/rs6000.cc (rs6000_cost_data::update_target_cost_per_stmt): Pass in the SLP node. Use that to get at the memory access kind and type. (rs6000_cost_data::add_stmt_cost): Pass down SLP node. * config/riscv/riscv-vector-costs.cc (variable_vectorized_p): Use SLP_TREE_TYPE. (costs::need_additional_vector_vars_p): Likewise. (costs::update_local_live_ranges): Likewise.
2025-07-28ada: Minor typo fix in commentMarc Poulhiès1-1/+1
gcc/ada/ChangeLog: * gcc-interface/trans.cc (gnat_to_gnu): Fix typo in comment.
2025-07-28aarch64: Add tuning model for Olympus core.Jennifer Schmitz3-1/+212
This patch adds a new tuning model for the NVIDIA Olympus core. The values used here are based on the Software Optimization Guide that will be published imminently. Bootstrapped and tested on aarch64-linux-gnu, no regression. OK for trunk? OK to backport to GCC 15? Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com> Co-Authored-By: Dhruv Chawla <dhruvc@nvidia.com> gcc/ChangeLog: * config/aarch64/aarch64-cores.def (olympus): Use olympus tuning model. * config/aarch64/aarch64.cc: Include olympus.h. * config/aarch64/tuning_models/olympus.h: New file.
2025-07-28libstdc++: Refactor tests for mdspan related accessors.Luc Grosheintz1-22/+37
Versions 1, 2 and 3 of the patch for adding aligned_accessor had a bug in the constraints that allowed conversion of aligned_accessor<T, N> a = aligned_accessor<const T, N>{}; and prevented the reverse. The file mdspan/accessors/generic.cc already contains code that checks all variation of the constraint. This commit allows passing in two different accessors. Enabling it to be reused more widely. libstdc++-v3/ChangeLog: * testsuite/23_containers/mdspan/accessors/generic.cc: Refactor test_ctor. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-07-28libstdc++: Support braces as arguments for std::erase on inplace_vector ↵Tomasz Kamiński2-4/+24
[PR121196] PR libstdc++/121196 libstdc++-v3/ChangeLog: * include/std/inplace_vector (std::erase): Provide default argument for _Up parameter. * testsuite/23_containers/inplace_vector/erasure.cc: Add test for using braces-init-list as arguments to erase_if and use function to verify content of inplace_vector Reviewed-by: Patrick Palka <ppalka@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-07-28LoongArch: Remove the definition of CASE_VECTOR_SHORTEN_MODE.Lulu Cheng1-2/+0
On LoongArch, the switch jump-table always stores absolute addresses, so there is no need to define the macro CASE_VECTOR_SHORTEN_MODE. gcc/ChangeLog: * config/loongarch/loongarch.h (CASE_VECTOR_SHORTEN_MODE): Delete.
2025-07-27xtensa: Fix remaining inaccuracies in xtensa_is_insn_L32R_p()Takayuki 'January June' Suwa1-11/+35
The previous fix also had some flaws: - The TARGET_CONST16 check was a bit premature - It didn't take into account the possibility of the RTL expression "(set (reg:SF gpr) (const_int))", especially when TARGET_AUTOLITPOOLS is configured This patch fixes the above. gcc/ChangeLog: * config/xtensa/xtensa.cc (xtensa_is_insn_L32R_p): Re-rewrite to more accurately capture insns that could be L32R machine instructions wherever possible, and add comments that help understand the intent of the process.
2025-07-28Daily bump.GCC Administrator4-1/+96
2025-07-27fortran: Consistently use the same assignment reallocation condition [PR121185]Mikael Morin1-6/+8
This is a follow-up to: r16-2248-gac8e536526393580bc9a4339bab2f8603eff8a47 fortran: Delay evaluation of array bounds after reallocation That revision delayed the evaluation of array bounds, with changes in two places: in the scalarizer where we save expressions without evaluating their values to variables, and in the reallocation code where we evaluate to variables the expressions previously saved. The effect should not have been visible in scalarized code, as the saving to a variable was only delayed after reallocation. Unfortunately, it's actually not the case, and there are cases where expressions that were saved to variables before the change, are no longer after it. The reason for that is differing conditions guarding the omission of the evaluation to variables in the scalarizer on one hand, and the emission of reallocation code with the saving to variables on the other hand. There is an additional check that avoids the emission of reallocation code if we can prove at compile time that both sides of the assignment are conformable. This change moves up the reallocation code condition definition, so that it can be used as well to flag the left hand side array as reallocatable, and omit the evaluation of expressions in the exact same conditions where the reallocation code would catch those unevaluated expressions. An explicit call to gfc_fix_class_refs is added before the evaluation of the reallocation code condition. It was implicit before, by the call to gfc_walk_expr. This is not a correctness issue, but PR #121185, that made the problem apparent, exhibited wrong code examples where the lack of an intermediary variable was making visible a class container at the beginning of an array reference, causing the non-polymorphic array reference to be evaluated in a polymorphic way. The preceding commits have already fixed the PR #121185 test, so I haven't found any addition to the testsuite that would reliably test this change. PR fortran/121185 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_trans_assignment_1): Use the same condition to set the is_alloc_lhs flag and to decide to generate reallocation code. Add explicit call to gfc_fix_class_refs before evaluating the condition.
2025-07-27fortran: Trigger reference saving on pointer dereference [PR121185]Mikael Morin2-18/+60
This is a follow-up to revision: r16-2371-g8f41c87654fd819e48c9f6f1ac3d87e35794d310 fortran: Factor array descriptor references That revision introduced new variables to limit repeated subexpressions in array descriptor references. The change added a walk along the reference from child to parent, that selected subreferences worth saving and applied the saving if the reference proved non-trivial enough. Trivialness was defined in a comment as: only made of a DECL and NOPs and COMPONENTs. But the case of a pointer derefence didn't trigger the saving, so the code was also considering a dereference as if it was trivial. This change triggers the reference saving on pointer dereferences, making the trivialness as defined by the code aligned with the comment. This change is not strictly speaking a bug fix, but PR #121185 exhibited wrong code examples where the lack of a variable hiding the polymorphic leading part of a non-polymorphic array reference was causing the latter to be evaluated in a polymorphic way. PR fortran/121185 gcc/fortran/ChangeLog: * trans-array.cc (set_factored_descriptor_value): Also trigger the saving of the previously selected reference on encountering an INDIRECT_REF. Extract the saving code... (save_ref): ... here as a new function. gcc/testsuite/ChangeLog: * gfortran.dg/assign_14.f90: New test.
2025-07-27fortran: Bound class container lookup after array descriptor [PR121185]Mikael Morin2-0/+46
Don't look for a class container too far after an array descriptor. This avoids generating a polymorphic array reference, using the virtual table of a parent object, to access a non-polymorphic child having a type unrelated to that of the parent. PR fortran/121185 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_get_class_from_expr): Give up class container lookup on the second COMPONENT_REF after an array descriptor. gcc/testsuite/ChangeLog: * gfortran.dg/assign_13.f90: New test.
2025-07-27RISC-V: Add test case for vaadd.vx combine polluting VXRMPan Li4-0/+92
Add asm check to make sure vx combine of vaadd.vx will not pollute the vxrm. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx-fixed-vxrm-1-i8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Add test for vec_duplicate + vaadd.vv combine case 1 with GR2VR cost ↵Pan Li13-2/+67
0, 1 and 2 Add asm dump check test for vec_duplicate + vaadd.vv combine to vaadd.vx, with the GR2VR cost is 0, 1 and 2 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Add test for vec_duplicate + vaadd.vv combine case 0 with GR2VR cost ↵Pan Li18-19/+302
0, 1 and 15 Add asm dump check and run test for vec_duplicate + vaadd.vv combine to vaadd.vx, with the GR2VR cost is 0, 2 and 15 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto. * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test helper macros. * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test data for run test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i16.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i32.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i64.c: New test. * gcc.target/riscv/rvv/autovec/vx_vf/vx_vaadd-run-1-i8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Combine vec_duplicate + vaadd.vv to vaadd.vx on GR2VR costPan Li3-4/+7
This patch would like to combine the vec_duplicate + vaadd.vv to the vaadd.vx. From example as below code. The related pattern will depend on the cost of vec_duplicate from GR2VR. Then the late-combine will take action if the cost of GR2VR is zero, and reject the combination if the GR2VR cost is greater than zero. Assume we have example code like below, GR2VR cost is 0. #define DEF_AVG_FLOOR(NT, WT) \ NT \ test_##NT##_avg_floor(NT x, NT y) \ { \ return (NT)(((WT)x + (WT)y) >> 1); \ } #define AVG_FLOOR_FUNC(T) test_##T##_avg_floor DEF_AVG_FLOOR(int32_t, int64_t) DEF_VX_BINARY_CASE_2_WRAP(T, AVG_FLOOR_FUNC(T), avg_floor) Before this patch: 11 │ beq a3,zero,.L8 12 │ vsetvli a5,zero,e32,m1,ta,ma 13 │ vmv.v.x v2,a2 14 │ slli a3,a3,32 15 │ srli a3,a3,32 16 │ .L3: 17 │ vsetvli a5,a3,e32,m1,ta,ma 18 │ vle32.v v1,0(a1) 19 │ slli a4,a5,2 20 │ sub a3,a3,a5 21 │ add a1,a1,a4 22 │ vaadd.vv v1,v1,v2 23 │ vse32.v v1,0(a0) 24 │ add a0,a0,a4 25 │ bne a3,zero,.L3 After this patch: 11 │ beq a3,zero,.L8 12 │ slli a3,a3,32 13 │ srli a3,a3,32 14 │ .L3: 15 │ vsetvli a5,a3,e32,m1,ta,ma 16 │ vle32.v v1,0(a1) 17 │ slli a4,a5,2 18 │ sub a3,a3,a5 19 │ add a1,a1,a4 20 │ vaadd.vx v1,v1,a2 21 │ vse32.v v1,0(a0) 22 │ add a0,a0,a4 23 │ bne a3,zero,.L3 gcc/ChangeLog: * config/riscv/riscv-v.cc (expand_vx_binary_vxrm_vec_vec_dup): Add new case UNSPEC_VAADD. (expand_vx_binary_vxrm_vec_dup_vec): Ditto. * config/riscv/riscv.cc (riscv_rtx_costs): Ditto. * config/riscv/vector-iterators.md: Add new case UNSPEC_VAADD to iterator. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27RISC-V: Fix another vf FP16 combine run test failuresPan Li2-2/+10
Like Robin's fix for vf combine f16.c run tests, there is still another failures similar. This patch would like to fix it as previous. will commit it directly if the CI agrees. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwnmacc-run-1-f16.c: Add zvfh requirements and options. * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwnmsac-run-1-f16.c: Ditto. Signed-off-by: Pan Li <pan2.li@intel.com>
2025-07-27Daily bump.GCC Administrator4-1/+41
2025-07-27Prevent mixups of IDENTIFIER_TRANSPARENT_ALIAS and IDENTIFIER_INTERNAL_P ↵Nathaniel Shead3-4/+6
better [PR120855] The assertion failure on ASM_OUTPUT_WEAKREF targets since my r16-1738 was caused because the 'TREE_CHAIN (id)' check in assemble_name_resolve no longer implies that ID is a transparent alias, since internal identifiers can have a TREE_CHAIN as well. I still don't think it's possible for a transparent alias to be an internal identifier in the sense added, so this patch simply constrains the assertion better so that it doesn't fail spuriously. I also added a couple of other assertions to help validate this assumption. PR middle-end/120855 gcc/ChangeLog: * cgraphunit.cc (symbol_table::compile): Assert a transparent alias is not an internal identifier. * symtab.cc (symbol_table::change_decl_assembler_name): Likewise. * varasm.cc (assemble_name_resolve): Check for IDENTIFIER_TRANSPARENT_ALIAS instead of just TREE_CHAIN. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
2025-07-27c++/modules: Stream some missing lang_type flagsNathaniel Shead4-4/+73
I noticed that trivial relocation didn't work in modules yet, and there are a couple of other flags that seem potentially useful we weren't streaming. This streams those flags and adds a comment to cp-tree.h in the hope that people will remember about modules when adding more! As a drive-by improvement, update gcc_assert with gcc_checking_assert in lang_type_bools streaming. gcc/cp/ChangeLog: * cp-tree.h (struct lang_type): Add comment mentioning modules. * module.cc (trees_out::lang_type_bools): Stream new flags, use gcc_checking_assert. (trees_in::lang_type_bools): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/class-11_a.H: New test. * g++.dg/modules/class-11_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
2025-07-26diagnostics: move diagnostic.c to diagnostics/context.cc: restore build with ↵Thomas Schwinge1-4/+7
GCC 5 Building with GCC 5, with commit 8d9d9515f5db9bab758e484f3956033150931de5 "diagnostics: move diagnostic.c to diagnostics/context.cc", we got: ../../source-gcc/gcc/diagnostics/context.cc: In member function ‘bool diagnostics::context::diagnostic_impl(rich_location*, const diagnostics::metadata*, diagnostics::option_id, const char*, __va_list_tag (*)[1], diagnostics::kind)’: ../../source-gcc/gcc/diagnostics/context.cc:1514:15: error: ‘kind’ is not a class, namespace, or enumeration if (kind == kind::permerror) ^ ../../source-gcc/gcc/diagnostics/context.cc:1517:22: error: ‘kind’ is not a class, namespace, or enumeration m_permissive ? kind::warning : kind::error); ^ ../../source-gcc/gcc/diagnostics/context.cc:1517:38: error: ‘kind’ is not a class, namespace, or enumeration m_permissive ? kind::warning : kind::error); ^ ../../source-gcc/gcc/diagnostics/context.cc:1523:19: error: ‘kind’ is not a class, namespace, or enumeration if (kind == kind::warning || kind == kind::pedwarn) ^ ../../source-gcc/gcc/diagnostics/context.cc:1523:44: error: ‘kind’ is not a class, namespace, or enumeration if (kind == kind::warning || kind == kind::pedwarn) ^ ../../source-gcc/gcc/diagnostics/context.cc: In member function ‘bool diagnostics::context::diagnostic_n_impl(rich_location*, const diagnostics::metadata*, diagnostics::option_id, long unsigned int, const char*, const char*, __va_list_tag (*)[1], diagnostics::kind)’: ../../source-gcc/gcc/diagnostics/context.cc:1554:15: error: ‘kind’ is not a class, namespace, or enumeration if (kind == kind::warning) ^ make[2]: *** [Makefile:1212: diagnostics/context.o] Error 1 Resolve this similar to, for example, commit r14-4521-g08d0f840dc7ad212ab75d094373b01cbfc004e67 "analyzer: fix build with gcc < 6". gcc/ * diagnostics/context.cc (context::diagnostic_impl) (context::diagnostic_n_impl): In presence of formal parameter 'kind', explicitly state 'diagnostics::' scope for 'kind' enum.
2025-07-26diagnostics: convert diagnostic_t to enum class diagnostics::kind: restore ↵Thomas Schwinge1-1/+1
build with GCC 5 Building with GCC 5, with commit 3cc27ed5b6fb4253d3fe2139dcc6295e85372a3a "diagnostics: convert diagnostic_t to enum class diagnostics::kind", we got: ../../source-gcc/gcc/diagnostics/option-classifier.cc: In member function ‘diagnostics::kind diagnostics::option_classifier::update_effective_level_from_pragmas(diagnostics::diagnostic_info*) const’: ../../source-gcc/gcc/diagnostics/option-classifier.cc:212:20: error: ‘kind’ is not a class, namespace, or enumeration if (kind != kind::unspecified) ^ make[2]: *** [Makefile:1212: diagnostics/option-classifier.o] Error 1 Resolve this similar to, for example, commit r14-4521-g08d0f840dc7ad212ab75d094373b01cbfc004e67 "analyzer: fix build with gcc < 6". gcc/ * diagnostics/option-classifier.cc (update_effective_level_from_pragmas): In presence of local variable 'kind', explicitly state 'diagnostics::' scope for 'kind' enum.
2025-07-26RISC-V: riscv-ext.def: Add allocated group IDs and group bit positionsChristoph Müllner1-15/+15
The riscv-c-api-doc defines a group ID and and a bit position for some extension. Most of them are set in riscv-ext.def, but some are missing and one bit position (for Zilsd) is wrong. This patch replaces the `BITMASK_NOT_YET_ALLOCATED` value for the actual allocated value wherever possible and fixes the bit position for Zilsd. Currently, we don't have any infrastructure to utilize the information that is placed into riscv_ext_info_t::m_bitmask_group_id and riscv_ext_info_t::m_bitmask_group_bit_pos. This also means we can't test. gcc/ChangeLog: * config/riscv/riscv-ext.def: Add allocated group IDs and group bit positions. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
2025-07-26Daily bump.GCC Administrator18-1/+1962
2025-07-25Introduce lazily-created.hDavid Malcolm14-99/+93
No functional change intended. gcc/ChangeLog: * diagnostics/context.cc: Eliminate digraphs::lazy_digraph in favor of lazily_created template. * diagnostics/context.h: Likewise. * diagnostics/digraphs.cc: Likewise, also digraphs::lazy_digraphs. * diagnostics/digraphs.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/metadata.h: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/sink.h: Likewise. * diagnostics/text-sink.h: Likewise. * lazily-created.h: New file. * libgdiagnostics.cc: Eliminate digraphs::lazy_digraph in favor of lazily_created template. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Eliminate digraphs::lazy_digraph and digraphs::lazy_digraphs in favor of lazily_created template. * gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: Define INCLUDE_VECTOR since diagnostics/metadata.h now requires it. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: avoid using "sink" for things that aren't a diagnostics::sinkDavid Malcolm4-206/+208
No functional change intended. gcc/ChangeLog: * diagnostic.h: Use TextOrHtml rather than Sink for template params. * diagnostics/context.h: Likewise. * diagnostics/selftest-context.cc: Use "html_or_text" rather than "sink". * diagnostics/source-printing.cc: Use TextOrHtml rather than Sink for template params. Use "text_out" and "html_out" rather than "sink". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: make context::m_source_printing privateDavid Malcolm26-134/+191
No functional change intended. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Make diagnostics::context::m_source_printing private. gcc/analyzer/ChangeLog: * program-point.cc: Make diagnostics::context::m_source_printing private. gcc/c-family/ChangeLog: * c-common.cc: Make diagnostics::context::m_source_printing private. * c-format.cc: Likewise. * c-opts.cc: Likewise. gcc/ChangeLog: * diagnostic.h (diagnostic_set_caret_max_width): Drop forward decl. (diagnostic_same_line): Make diagnostics::context::m_source_printing private. * diagnostics/context.cc (diagnostic_set_caret_max_width): Convert to... (diagnostics::context::set_caret_max_width): ...this. * diagnostics/context.h (diagnostics::context::get_source_printing_options): New accessors. (diagnostics::context::m_source_printing): Make private. * diagnostics/html-sink.cc: Make diagnostics::context::m_source_printing private. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-context.h (diagnostics::selftest::test_context::colorize_source): New. (diagnostics::selftest::test_context::show_labels): New. (diagnostics::selftest::test_context::show_line_numbers): New. (diagnostics::selftest::test_context::show_ruler): New. (diagnostics::selftest::test_context::show_event_links): New. (diagnostics::selftest::test_context::set_caret_char): New. * diagnostics/source-printing.cc: Make diagnostics::context::m_source_printing private. * diagnostics/text-sink.h: Likewise. * libgdiagnostics.cc: Likewise. * opts.cc: Likewise. * toplev.cc: Likewise. gcc/fortran/ChangeLog: * error.cc: Make diagnostics::context::m_source_printing private. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_show_trees.cc: Make diagnostics::context::m_source_printing private. * gcc.dg/plugin/diagnostic_plugin_test_inlining.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: eliminate ::diagnostic_info typedefDavid Malcolm29-79/+88
No functional change intended. gcc/c-family/ChangeLog: * c-common.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * c-opts.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". gcc/cp/ChangeLog: * constexpr.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * cp-tree.h: Likewise. * error.cc: Likewise. * module.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc: Likewise. gcc/ChangeLog: * diagnostic.h: Eliminate "diagnostic_info" typedef. * diagnostics/context.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * langhooks.cc: Likewise. * libgdiagnostics.cc: Likewise. * rtl-error.cc: Likewise. * substring-locations.cc: Likewise. * toplev.cc: Likewise. * tree-diagnostic.cc: Likewise. * tree-diagnostic.h: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * error.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * gm2-gcc/rtegraph.cc: Likewise. gcc/rust/ChangeLog: * resolve/rust-ice-finalizer.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * resolve/rust-ice-finalizer.h: Likewise. gcc/testsuite/ChangeLog: * g++.dg/plugin/show_template_tree_color_plugin.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". * gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. libcc1/ChangeLog: * context.cc: Update usage of "diagnostic_info" to explicitly refer to "diagnostics::diagnostic_info". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: introduce context-options.hDavid Malcolm3-93/+117
No functional change intended. gcc/ChangeLog: * diagnostic.h (enum diagnostics_column_unit): Move to diagnostics/context-options.h. (enum diagnostics_escape_format): Likewise. (enum diagnostics_output_format): Likewise. (enum diagnostic_path_format): Likewise. (enum diagnostics_extra_output_kind): Likewise. (enum diagnostic_text_art_charset): Likewise. * diagnostics/context-options.h: New file, based on the above material. * diagnostics/context.h: Include it. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move file_cache from input.{cc,h} to diagnostics/file-cache.{cc,h}David Malcolm21-1205/+1308
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Add diagnostics/file-cache.o. * diagnostics/changes.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * diagnostics/context.cc: Likewise. * diagnostics/diagnostics-selftests.cc: Likewise. * diagnostics/diagnostics-selftests.h: Likewise. * diagnostics/file-cache.cc: New file, based on the file_cache and file_cache_slot material in input.cc. * diagnostics/file-cache.h: Likewise for input.h. * diagnostics/selftest-source-printing.h: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * diagnostics/source-printing.cc: Likewise. * final.cc: Likewise. * gcc-rich-location.cc: Likewise. * input.cc (default_charset_callback): Move to diagnostics/file-cache.cc. (file_cache::initialize_input_context): Likewise. (class file_cache_slot): Likewise. (file_cache::tune): Likewise. (file_cache::lookup_file): Likewise. (file_cache::forcibly_evict_file): Likewise. (file_cache::missing_trailing_newline_p): Likewise. (file_cache::add_buffered_content): Likewise. (file_cache::evicted_cache_tab_entry): Likewise. (file_cache::add_file): Likewise. (file_cache::file_cache): Likewise. (file_cache::dump): Likewise. (file_cache::dump): Likewise. (file_cache::lookup_or_add_file): Likewise. (find_end_of_line): Likewise. (file_cache::get_source_line): Likewise. (check_line): Likewise. (test_replacement): Likewise. (test_reading_source_line): Likewise. (test_reading_source_buffer): Likewise. * input.h (class char_span): Move to diagnostics/file-cache.h and into the "diagnostics::" namespace. (class file_cache_slot): Likewise. (class file_cache): Likewise. * libgdiagnostics.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * selftest.cc: Likewise. * selftest.h: Likewise. * substring-locations.h: Likewise. * toplev.cc: Likewise. gcc/c-family/ChangeLog: * c-format.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. * c-indentation.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for file_cache and char_span moving from input.h to diagnostics/file-cache.h and into the "diagnostics::" namespace. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: eliminate some redundant includesDavid Malcolm3-8/+0
No functional change intended. gcc/ChangeLog: * diagnostics/selftest-paths.cc: Don't include "demangle.h" and "backtrace.h". * diagnostics/source-printing.cc: Likewise. * diagnostics/state-graphs.cc: Don't include "graphviz.h", "xml.h", "xml-printer.h", or "intl.h". Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: simplify header filesDavid Malcolm2-36/+36
No functional change intended. gcc/ChangeLog: * diagnostic.h: Move include of "unique-argv.h" and various forward decls into... * diagnostics/context.h: ...here. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostic.c to diagnostics/context.ccDavid Malcolm12-152/+179
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostic.o with diagnostics/context.o. gcc/c-family/ChangeLog: * c-common.cc (c_family_tests): Add include of "diagnostics/diagnostics-selftests.h". Replace c_diagnostic_cc_tests with diagnostics::selftest::context_cc_tests. * c-common.h: Drop c_diagnostic_cc_tests decl. gcc/ChangeLog: * diagnostic.h (num_digits): Move to... (diagnostics::num_digits): ...here. (get_cwe_url): Move to... (diagnostics::get_cwe_url): ...here. (maybe_line_and_column): Move to... (diagnostics::maybe_line_and_column): ...here. * diagnostic.cc: Move to... * diagnostics/context.cc: ...here. * diagnostics/diagnostics-selftests.cc (run_diagnostics_selftests): Add comment about context_cc_tests. * diagnostics/diagnostics-selftests.h: Add context_cc_tests decl. * diagnostics/sarif-sink.cc: Update for file rename. * diagnostics/source-printing.cc: Update for num_digits moving to diagnostics::num_digits. * errors.cc: Update for file rename. * input.cc: Update for num_digits moving to diagnostics::num_digits. libcpp/ChangeLog: * charset.cc: Update comment for file rename. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: convert diagnostic_t to enum class diagnostics::kindDavid Malcolm80-608/+780
No functional change intended. gcc/ChangeLog: * Makefile.in: Replace diagnostic.def with diagnostics/kinds.def. * config/aarch64/aarch64.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * config/i386/i386-options.cc: Likewise. * config/s390/s390.cc: Likewise. * diagnostic-core.h: Replace typedef diagnostic_t with enum class diagnostics::kind in diagnostics/kinds.h and include it. * diagnostic-global-context.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostics/buffering.cc: Likewise. * diagnostics/buffering.h: Likewise. * diagnostics/context.h: Likewise. * diagnostics/diagnostic-info.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostic.def: Move to... * diagnostics/kinds.def: ...here and update for diagnostic_t becoming enum class diagnostics::kind. * diagnostics/kinds.h: New file, based on material in diagnostic-core.h. * diagnostics/lazy-paths.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * diagnostics/option-classifier.cc: Likewise. * diagnostics/option-classifier.h: Likewise. * diagnostics/output-spec.h: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-context.h: Likewise. * diagnostics/sink.h: Likewise. * diagnostics/source-printing.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * diagnostics/text-sink.h: Likewise. * gcc.cc: Likewise. * libgdiagnostics.cc: Likewise. * lto-wrapper.cc: Likewise. * opts-common.cc: Likewise. * opts-diagnostic.h: Likewise. * opts.cc: Likewise. * rtl-error.cc: Likewise. * substring-locations.cc: Likewise. * toplev.cc: Likewise. gcc/ada/ChangeLog: * gcc-interface/trans.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/analyzer/ChangeLog: * pending-diagnostic.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * program-point.cc: Likewise. gcc/c-family/ChangeLog: * c-common.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * c-format.cc: Likewise. * c-lex.cc: Likewise. * c-opts.cc: Likewise. * c-pragma.cc: Likewise. * c-warn.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * c-parser.cc: Likewise. * c-typeck.cc: Likewise. gcc/cobol/ChangeLog: * util.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/cp/ChangeLog: * call.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * constexpr.cc: Likewise. * cp-tree.h: Likewise. * decl.cc: Likewise. * error.cc: Likewise. * init.cc: Likewise. * method.cc: Likewise. * module.cc: Likewise. * parser.cc: Likewise. * pt.cc: Likewise. * semantics.cc: Likewise. * typeck.cc: Likewise. * typeck2.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/fortran/ChangeLog: * cpp.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * error.cc: Likewise. * options.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * gm2-gcc/rtegraph.cc: Likewise. gcc/rust/ChangeLog: * backend/rust-tree.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * backend/rust-tree.h: Likewise. * resolve/rust-ast-resolve-expr.cc: Likewise. * resolve/rust-ice-finalizer.cc: Likewise. * resolve/rust-ice-finalizer.h: Likewise. * resolve/rust-late-name-resolver-2.0.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. * lib/gcc-dg.exp: Likewise. libcpp/ChangeLog: * internal.h: Update comment for diagnostic_t becoming enum class diagnostics::kind. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: rename diagnostic_option_id to diagnostics::option_id and move ↵David Malcolm33-158/+188
to its own header No functional change intended. gcc/c-family/ChangeLog: * c-common.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * c-common.h: Likewise. * c-cppbuiltin.cc: Likewise. * known-headers.cc: Likewise. * known-headers.h: Likewise. gcc/c/ChangeLog: * c-decl.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * c-errors.cc: Likewise. * c-tree.h: Likewise. gcc/cobol/ChangeLog: * util.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. gcc/cp/ChangeLog: * cp-tree.h: Update for renaming of diagnostic_option_id to diagnostics::option_id. * decl.cc: Likewise. * error.cc: Likewise. * name-lookup.cc: Likewise. gcc/ChangeLog: * diagnostic-core.h: Include "diagnostics/option-id.h". (struct diagnostic_option_id): Move there, renaming to diagnostics::option_id. * diagnostic-global-context.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostics/context.h: Likewise. * diagnostics/diagnostic-info.h: Likewise. * diagnostics/lazy-paths.cc: Likewise. * diagnostics/option-classifier.cc: Likewise. * diagnostics/option-classifier.h: Likewise. * diagnostics/option-id.h: New file, taken from material in diagnostic-core.h. * diagnostics/selftest-context.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * diagnostics/selftest-context.h: Likewise. * ipa-pure-const.cc: Likewise. * lto-wrapper.cc: Likewise. * opts-common.cc: Likewise. * opts-diagnostic.h: Likewise. * opts.cc: Likewise. * substring-locations.cc: Likewise. * substring-locations.h: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25Rename diagnostic-spec.{cc,h} to gcc-diagnostic-spec.{cc,h}David Malcolm5-8/+9
This has GCC-specific stuff in it (options and "GTY"), and so should not be in the "diagnostics/" subdir, and should avoid a "diagnostics" prefix in its name. No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostic-spec.o with gcc-diagnostic-spec.o. (GTFILES): Replace diagnostic-spec.h with gcc-diagnostic-spec.h. * diagnostic-spec.cc: Move to... * gcc-diagnostic-spec.cc: ...here. * diagnostic-spec.h: Move to... * gcc-diagnostic-spec.h: ...here. * gengtype.cc (open_base_files): Replace diagnostic-spec.h with gcc-diagnostic-spec.h. * warning-control.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostics::edit_context -> diagnostics::changes::change_setDavid Malcolm13-191/+207
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS-libcommon): Replace diagnostics/changes.o with diagnostics/edit-context.o. * diagnostic.cc: Update for move of diagnostics/edit-context.h to diagnostics/changes.h. (diagnostics::context::initialize): Update for renaming of m_edit_context_ptr to m_fixits_change_set. (diagnostics::context::finish): Likewise. (diagnostics::context::create_edit_context): Rename to... (diagnostics::context::initialize_fixits_change_set): ...this and update for other renamings. (diagnostics::context::report_diagnostic): Update for renaming of m_edit_context_ptr to m_fixits_change_set. * diagnostic.h (diagnostics::edit_context): Drop forward decl * diagnostics/edit-context.cc: Move to... * diagnostics/changes.cc: ...here. Update for move of diagnostics/edit-context.h to diagnostics/changes.h. Rename diagnostics::edit_context to diagnostics::changes::change_set. Rename diagnostics::edited_file to diagnostics::changes::changed_file. Rename diagnostics::edited_line to diagnostics::changes::changed_line. * diagnostics/edit-context.h: Move to... * diagnostics/changes.h: ...here, renaming as above. * diagnostics/context.h (diagnostics::changes::change_set): New forward decl. (diagnostics::context::create_edit_context): Rename to... (diagnostics::context::initialize_fixits_change_set): ...this. (diagnostics::context::get_edit_context): Rename to... (diagnostics::context::get_fixits_change_set): ...this. (diagnostics::context::m_edit_context_ptr): Rename to... (diagnostics::context::m_fixits_change_set): ..this and update type. * diagnostics/diagnostics-selftests.cc: Update for renaming. * diagnostics/diagnostics-selftests.h: Likewise. * diagnostics/html-sink.cc: Update for above changes. * libgdiagnostics.cc: Likewise. * toplev.cc: Likewise. gcc/c-family/ChangeLog: * c-common.cc: Update comment for renaming of edit_context. gcc/testsuite/ChangeLog: * gcc.dg/plugin/expensive_selftests_plugin.cc: Update for change from edit-context.h to changes.h. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: reorganize selftestsDavid Malcolm25-386/+525
No functional change intended. gcc/ChangeLog: * Makefile.in (OBJS): Move diagnostics/lazy-paths.o to... (OBJS-libcommon): ...here. Add diagnostics/diagnostics-selftests.o. * diagnostic.cc: Update for move of selftest::test_diagnostic_context to diagnostics::selftest::test_context. * diagnostics/color.cc: Move selftests from selftest:: to diagnostics::selftest::. * diagnostics/diagnostics-selftests.cc: New file. * diagnostics/diagnostics-selftests.h: New file. * diagnostics/digraphs.cc: Move selftests from selftest:: to diagnostics::selftest::. * diagnostics/edit-context.cc: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostics/lazy-paths.cc: Likewise. Eliminate use of "tree" by porting selftests from simple-diagnostic-path.h to diagnostics/selftest-paths.h. * diagnostics/output-spec.cc: Move selftests from selftest:: to diagnostics::selftest::. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Move selftest::test_diagnostic_context to diagnostics::selftest::test_context. * diagnostics/selftest-context.h: Likewise. * diagnostics/selftest-logical-locations.cc: Move selftests from selftest:: to diagnostics::logical_locations::selftest::. * diagnostics/selftest-logical-locations.h: Move selftest::logical_location_manager to diagnostics::logical_locations::selftest::logical_location_manager. * diagnostics/selftest-paths.cc: Move selftest::test_diagnostic_path to diagnostics::paths::selftest::test_path. Move selftest::test_diagnostic_event to diagnostics::paths::selftest::test_event. * diagnostics/selftest-paths.h: Likewise, and move selftest::test_diagnostic_thread to diagnostics::paths::selftest::test_thread. * diagnostics/selftest-source-printing.h: Move selftest::diagnostic_show_locus_fixture to diagnostics::selftest::source_printing_fixture. * diagnostics/source-printing.cc: Move selftests from selftest:: to diagnostics::selftest:: and update for renames. * diagnostics/state-graphs.cc: Likewise. * selftest-run-tests.cc: Include "diagnostics/diagnostics-selftests.h". (selftest::run_tests): Replace invocation of the various diagnostics selftests with a call to diagnostics::selftest::run_diagnostics_selftests. * selftest.h: Move decls of the various per-file diagnostics invocation functions to diagnostics/diagnostics-selftests.h, renaming due to diagostics prefix being implied by namespace. gcc/c-family/ChangeLog: * c-format.cc (test_type_mismatch_range_labels): Update for move of selftest::test_diagnostic_context to diagnostics::selftest::test_context. gcc/testsuite/ChangeLog: * gcc.dg/plugin/expensive_selftests_plugin.cc: Update for move of selftest::test_diagnostic_context to diagnostics::selftest::test_context. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: gcc/diagnostic-url.h -> gcc/diagnostics/url.hDavid Malcolm7-9/+9
No functional change intended. gcc/ChangeLog: * common.opt: Update for move of diagnostic-url.h to diagnostics/url.h. * diagnostic.cc: Likewise. * diagnostics/color.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * diagnostic-url.h: Move to... * diagnostics/url.h: ...here. * libgdiagnostics.cc: Update for move of diagnostic-url.h to diagnostics/url.h. * pretty-print.h: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>