aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit
AgeCommit message (Collapse)AuthorFilesLines
2024-07-06Daily bump.GCC Administrator1-0/+22
2024-07-05libgccjit: Allow comparing array typesAntoni Boucher2-0/+18
gcc/jit/ChangeLog: * jit-common.h: Add array_type class. * jit-recording.h (type::dyn_cast_array_type, memento_of_get_aligned::dyn_cast_array_type, array_type::dyn_cast_array_type, array_type::is_same_type_as): New methods. gcc/testsuite/ChangeLog: * jit.dg/test-types.c: Add array type comparison to the test.
2024-07-05libgccjit: Add support for the type bfloat16Antoni Boucher5-2/+23
gcc/jit/ChangeLog: PR jit/112574 * docs/topics/types.rst: Document GCC_JIT_TYPE_BFLOAT16. * jit-common.h: Update NUM_GCC_JIT_TYPES. * jit-playback.cc (get_tree_node_for_type): Support bfloat16. * jit-recording.cc (recording::memento_of_get_type::get_size, recording::memento_of_get_type::dereference, recording::memento_of_get_type::is_int, recording::memento_of_get_type::is_signed, recording::memento_of_get_type::is_float, recording::memento_of_get_type::is_bool): Support bfloat16. * libgccjit.h (enum gcc_jit_types): Add GCC_JIT_TYPE_BFLOAT16. gcc/testsuite/ChangeLog: PR jit/112574 * jit.dg/all-non-failing-tests.h: New test test-bfloat16.c. * jit.dg/test-types.c: Test GCC_JIT_TYPE_BFLOAT16. * jit.dg/test-bfloat16.c: New test.
2024-06-30Daily bump.GCC Administrator1-0/+8
2024-06-29jit: Fix Darwin bootstrap after r15-1699.Iain Sandoe1-2/+2
r15-1699-g445c62ee492 contains changes that trigger two maybe-uninitialized warnings on Darwin, which result in a bootstrap failure. Note that the warnings are false positives, in fact the variables should be initialized in the cases of a switch (all values of the switch condition are covered). Fixed here by providing default initializations for the relevant variables. gcc/jit/ChangeLog: * jit-recording.cc (recording::memento_of_typeinfo::make_debug_string): Default the value of ident. (recording::memento_of_typeinfo::write_reproducer): Default the value of type. Signed-off-by: Iain Sandoe <iains@gcc.gnu.org>
2024-06-28Daily bump.GCC Administrator1-0/+20
2024-06-27libgccjit: Add ability to get the alignment of a typeAntoni Boucher9-15/+142
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_28): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_context_new_alignof. * jit-playback.cc (new_alignof): New method. * jit-playback.h: New method. * jit-recording.cc (recording::context::new_alignof): New method. (recording::memento_of_sizeof::replay_into, recording::memento_of_typeinfo::replay_into, recording::memento_of_sizeof::make_debug_string, recording::memento_of_typeinfo::make_debug_string, recording::memento_of_sizeof::write_reproducer, recording::memento_of_typeinfo::write_reproducer): Rename. * jit-recording.h (enum type_info_type): New enum. (class memento_of_sizeof class memento_of_typeinfo): Rename. * libgccjit.cc (gcc_jit_context_new_alignof): New function. * libgccjit.h (gcc_jit_context_new_alignof): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-alignof.c: New test.
2024-06-26Daily bump.GCC Administrator1-0/+7
2024-06-25Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode_for_floating_typeKewen Lin1-4/+8
Currently how we determine which mode will be used for a floating point type is that for a given type precision (size) call mode_for_size to get the first mode which has this size in the specified class. On Powerpc, we have three modes (TF/KF/IF) having the same mode precision 128 (see[1]), so the processing forces us to have to place TF at the first place, it would require us to make more adjustment in some generic code to avoid some unexpected mode conversions and it would be even worse if we get rid of TF eventually one day. And as Joseph pointed out in [2], "floating types should have their mode, not a poorly defined precision value", as Joseph and Richi suggested, this patch is to introduce one hook mode_for_floating_type which returns the corresponding mode for type float, double or long double. The default implementation returns SFmode for float and DFmode for double or long double. For ports which need special treatment, there are some other patches for their own port specific implementation (referring to how {,LONG_}DOUBLE_TYPE_SIZE get used there). For all generic uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, depending on the context, some of them are replaced with TYPE_PRECISION of the according type node, some other are replaced with GET_MODE_PRECISION on the mode from mode_for_floating_type. This patch also poisons {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, so most defines of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in port specific are removed, but there are still some which are good to be kept for readability then they get renamed with port specific prefix. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651017.html [2] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html gcc/jit/ChangeLog: * jit-recording.cc (recording::memento_of_get_type::get_size): Update macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE. gcc/ChangeLog: * coretypes.h (enum tree_index): Forward declaration. * defaults.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * doc/rtl.texi: Update document by replacing {FLOAT,DOUBLE}_TYPE_SIZE with C type {float,double}. * doc/tm.texi.in: Document new hook mode_for_floating_type, remove document entries for {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE and update document for WIDEST_HARDWARE_FP_SIZE. * doc/tm.texi: Regenerate. * emit-rtl.cc (init_emit_once): Replace DOUBLE_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_DOUBLE_TYPE. * real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use TYPE_PRECISION of long_double_type_node to replace LONG_DOUBLE_TYPE_SIZE. * system.h (FLOAT_TYPE_SIZE): Poison. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * target.def (mode_for_floating_type): New hook. * targhooks.cc (default_mode_for_floating_type): New function. (default_scalar_mode_supported_p): Update macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE. * targhooks.h (default_mode_for_floating_type): New declaration. * tree-core.h (enum tree_index): Specify underlying type unsigned to sync with forward declaration in coretypes.h. (NUM_FLOATN_TYPES): Explicitly convert to int. (NUM_FLOATNX_TYPES): Likewise. (NUM_FLOATN_NX_TYPES): Likewise. * tree.cc (build_common_tree_nodes): Update macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling targetm.c.mode_for_floating_type with TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE and set type mode accordingly. * config/arc/arc.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/bpf/bpf.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/epiphany/epiphany.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/fr30/fr30.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/frv/frv.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/ft32/ft32.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/gcn/gcn.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/iq2000/iq2000.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/lm32/lm32.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/m32c/m32c.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/m32r/m32r.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/microblaze/microblaze.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/mmix/mmix.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/moxie/moxie.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/msp430/msp430.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/nds32/nds32.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/nios2/nios2.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/nvptx/nvptx.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/or1k/or1k.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pdp11/pdp11.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pru/pru.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/stormy16/stormy16.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/visium/visium.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/xtensa/xtensa.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rs6000/rs6000.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (rs6000_c_mode_for_floating_type): New function. * config/rs6000/rs6000.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/aarch64/aarch64.cc (aarch64_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/aarch64/aarch64.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/alpha/alpha.cc (alpha_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/alpha/alpha.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/avr/avr.cc (avr_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/avr/avr.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/i386/i386.cc (ix86_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/i386/i386.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/ia64/ia64.cc (ia64_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/ia64/ia64.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/riscv/riscv.cc (riscv_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/riscv/riscv.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rl78/rl78.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (rl78_c_mode_for_floating_type): New function. * config/rl78/rl78.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/rx/rx.cc (rx_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/rx/rx.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/s390/s390.cc (s390_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/s390/s390.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. * config/sh/sh.cc (sh_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/sh/sh.h (LONG_DOUBLE_TYPE_SIZE): Remove. * config/h8300/h8300.cc (h8300_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/h8300/h8300.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Remove. (DOUBLE_TYPE_MODE): New macro. * config/h8300/linux.h (DOUBLE_TYPE_SIZE): Remove. (DOUBLE_TYPE_MODE): New macro. * config/loongarch/loongarch.cc (loongarch_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/loongarch/loongarch.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (LA_LONG_DOUBLE_TYPE_SIZE): ... this. (UNITS_PER_FPVALUE): Replace LONG_DOUBLE_TYPE_SIZE with LA_LONG_DOUBLE_TYPE_SIZE. (MAX_FIXED_MODE_SIZE): Likewise. (STRUCTURE_SIZE_BOUNDARY): Likewise. (BIGGEST_ALIGNMENT): Likewise. * config/m68k/m68k.cc (m68k_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/m68k/m68k.h (LONG_DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_MODE): New macro. * config/m68k/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_MODE): New macro. * config/mips/mips.cc (mips_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/mips/mips.h (UNITS_PER_FPVALUE): Replace LONG_DOUBLE_TYPE_SIZE with MIPS_LONG_DOUBLE_TYPE_SIZE. (MAX_FIXED_MODE_SIZE): Likewise. (STRUCTURE_SIZE_BOUNDARY): Likewise. (BIGGEST_ALIGNMENT): Likewise. (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (MIPS_LONG_DOUBLE_TYPE_SIZE): ... this. * config/mips/n32-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (MIPS_LONG_DOUBLE_TYPE_SIZE): ... this. * config/pa/pa.cc (pa_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (pa_scalar_mode_supported_p): Rename FLOAT_TYPE_SIZE to PA_FLOAT_TYPE_SIZE, rename DOUBLE_TYPE_SIZE to PA_DOUBLE_TYPE_SIZE and rename LONG_DOUBLE_TYPE_SIZE to PA_LONG_DOUBLE_TYPE_SIZE. * config/pa/pa.h (PA_FLOAT_TYPE_SIZE): New macro. (PA_DOUBLE_TYPE_SIZE): Likewise. (PA_LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pa/pa-64.h (FLOAT_TYPE_SIZE): Rename to ... (PA_FLOAT_TYPE_SIZE): ... this. (DOUBLE_TYPE_SIZE): Rename to ... (PA_DOUBLE_TYPE_SIZE): ... this. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (PA_LONG_DOUBLE_TYPE_SIZE): ... this. * config/pa/pa-hpux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (PA_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sparc.cc (sparc_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Likewise. (LONG_DOUBLE_TYPE_SIZE): Likewise. (sparc_type_code): Replace FLOAT_TYPE_SIZE with TYPE_PRECISION of float_type_node. * config/sparc/sparc.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. * config/sparc/freebsd.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/linux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/linux64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/openbsd64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sol2.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sp-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/sparc/sp64-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. * config/bfin/bfin.h (FLOAT_TYPE_SIZE): Rename to ... (BFIN_FLOAT_TYPE_SIZE): ... this. (DOUBLE_TYPE_SIZE): Rename to ... (BFIN_DOUBLE_TYPE_SIZE): ... this. (LONG_DOUBLE_TYPE_SIZE): Remove. (UNITS_PER_FLOAT): Replace FLOAT_TYPE_SIZE with BFIN_FLOAT_TYPE_SIZE. (UNITS_PER_DOUBLE): Replace DOUBLE_TYPE_SIZE with BFIN_DOUBLE_TYPE_SIZE.
2024-06-13Daily bump.GCC Administrator1-0/+5
2024-06-12pretty_printer: make all fields privateDavid Malcolm1-1/+1
No functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc (access_range::dump): Update for fields of pretty_printer becoming private. * call-details.cc (call_details::dump): Likewise. * call-summary.cc (call_summary::dump): Likewise. (call_summary_replay::dump): Likewise. * checker-event.cc (checker_event::debug): Likewise. * constraint-manager.cc (range::dump): Likewise. (bounded_range::dump): Likewise. (constraint_manager::dump): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. (exploded_path::dump_to_file): Likewise. * feasible-graph.cc (feasible_graph::dump_feasible_path): Likewise. * program-point.cc (program_point::dump): Likewise. * program-state.cc (extrinsic_state::dump_to_file): Likewise. (sm_state_map::dump): Likewise. (program_state::dump_to_file): Likewise. * ranges.cc (symbolic_byte_offset::dump): Likewise. (symbolic_byte_range::dump): Likewise. * record-layout.cc (record_layout::dump): Likewise. * region-model-reachability.cc (reachable_regions::dump): Likewise. * region-model.cc (region_to_value_map::dump): Likewise. (region_model::dump): Likewise. (model_merger::dump): Likewise. * region-model.h (one_way_id_map<T>::dump): Likewise. * region.cc (region_offset::dump): Likewise. (region::dump): Likewise. * sm-malloc.cc (deallocator_set::dump): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (bit_range::dump): Likewise. (byte_range::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (supergraph::dump_dot_to_file): Likewise. (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc (dump_ads): Update for fields of pretty_printer becoming private. * c-pretty-print.cc: Likewise throughout. gcc/c/ChangeLog: * c-objc-common.cc (print_type): Update for fields of pretty_printer becoming private. (c_tree_printer): Likewise. gcc/cp/ChangeLog: * cxx-pretty-print.cc: Update throughout for fields of pretty_printer becoming private. * error.cc: Likewise. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::urls_init): Update for fields of pretty_printer becoming private. (diagnostic_context::print_any_cwe): Likewise. (diagnostic_context::print_any_rules): Likewise. (diagnostic_context::print_option_information): Likewise. * diagnostic.h (diagnostic_format_decoder): Likewise. (diagnostic_prefixing_rule): Likewise, fixing typo. * digraph.cc (test_dump_to_dot): Likewise. * digraph.h (digraph<GraphTraits>::dump_dot_to_file): Likewise. * dumpfile.cc (dump_pretty_printer::emit_any_pending_textual_chunks): Likewise. * gimple-pretty-print.cc (print_gimple_stmt): Likewise. (print_gimple_expr): Likewise. (print_gimple_seq): Likewise. (dump_ssaname_info_to_file): Likewise. (gimple_dump_bb): Likewise. * graph.cc (print_graph_cfg): Likewise. (start_graph_dump): Likewise. * langhooks.cc (lhd_print_error_function): Likewise. * lto-wrapper.cc (print_lto_docs_link): Likewise. * pretty-print.cc (pp_set_real_maximum_length): Convert to... (pretty_printer::set_real_maximum_length): ...this. (pp_clear_state): Convert to... (pretty_printer::clear_state): ...this. (pp_wrap_text): Update for pp_remaining_character_count_for_line becoming a member function. (urlify_quoted_string): Update for fields of pretty_printer becoming private. (pp_format): Convert to... (pretty_printer::format): ...this. Reduce the scope of local variables "old_line_length" and "old_wrapping_mode" and make const. Reduce the scope of locals "args", "new_chunk_array", "curarg", "any_unnumbered", and "any_numbered". (pp_output_formatted_text): Update for fields of pretty_printer becoming private. (pp_flush): Likewise. (pp_really_flush): Likewise. (pp_set_line_maximum_length): Likewise. (pp_set_prefix): Convert to... (pretty_printer::set_prefix): ...this. (pp_take_prefix): Update for fields of pretty_printer gaining "m_" prefixes. (pp_destroy_prefix): Likewise. (pp_emit_prefix): Convert to... (pretty_printer::emit_prefix): ...this. (pretty_printer::pretty_printer): Update both ctors for fields gaining "m_" prefixes. (pretty_printer::~pretty_printer): Likewise for dtor. (pp_append_text): Update for pp_emit_prefix becoming pretty_printer::emit_prefix. (pp_remaining_character_count_for_line): Convert to... (pretty_printer::remaining_character_count_for_line): ...this. (pp_character): Update for above change. (pp_maybe_space): Convert to... (pretty_printer::maybe_space): ...this. (pp_begin_url): Convert to... (pretty_printer::begin_url): ...this. (get_end_url_string): Update for fields of pretty_printer becoming private. (pp_end_url): Convert to... (pretty_printer::end_url): ...this. (selftest::test_pretty_printer::test_pretty_printer): Update for fields of pretty_printer becoming private. (selftest::test_urls): Likewise. (selftest::test_null_urls): Likewise. (selftest::test_urlification): Likewise. * pretty-print.h (pp_line_cutoff): Convert from macro to inline function. (pp_prefixing_rule): Likewise. (pp_wrapping_mode): Likewise. (pp_format_decoder): Likewise. (pp_needs_newline): Likewise. (pp_indentation): Likewise. (pp_translate_identifiers): Likewise. (pp_show_color): Likewise. (pp_buffer): Likewise. (pp_get_prefix): Add forward decl to allow friend decl. (pp_take_prefix): Likewise. (pp_destroy_prefix): Likewise. (class pretty_printer): Fix typo in leading comment. Add "friend" decls for the various new accessor functions that were formerly macros and for pp_get_prefix, pp_take_prefix, and pp_destroy_prefix. Make all fields private. (pretty_printer::set_output_stream): New. (pretty_printer::set_prefix): New decl. (pretty_printer::emit_prefix): New decl. (pretty_printer::format): New decl. (pretty_printer::maybe_space): New decl. (pretty_printer::supports_urls_p): New. (pretty_printer::get_url_format): New. (pretty_printer::set_url_format): New. (pretty_printer::begin_url): New decl. (pretty_printer::end_url): New decl. (pretty_printer::set_verbatim_wrapping): New. (pretty_printer::set_padding): New. (pretty_printer::get_padding): New. (pretty_printer::clear_state): New decl. (pretty_printer::set_real_maximum_length): New decl. (pretty_printer::remaining_character_count_for_line): New decl. (pretty_printer::buffer): Rename to... (pretty_printer::m_buffer): ...this. (pretty_printer::prefix): Rename to... (pretty_printer::m_prefix): ...this; (pretty_printer::padding): Rename to... (pretty_printer::m_padding): ...this; (pretty_printer::maximum_length): Rename to... (pretty_printer::m_maximum_length): ...this; (pretty_printer::indent_skip): Rename to... (pretty_printer::m_indent_skip): ...this; (pretty_printer::wrapping): Rename to... (pretty_printer::m_wrapping): ...this; (pretty_printer::format_decoder): Rename to... (pretty_printer::m_format_decoder): ...this; (pretty_printer::emitted_prefix): Rename to... (pretty_printer::m_emitted_prefix): ...this; (pretty_printer::need_newline): Rename to... (pretty_printer::m_need_newline): ...this; (pretty_printer::translate_identifiers): Rename to... (pretty_printer::m_translate_identifiers): ...this; (pretty_printer::show_color): Rename to... (pretty_printer::m_show_color): ...this; (pretty_printer::url_format): Rename to... (pretty_printer::m_url_format): ...this; (pp_get_prefix): Reformat. (pp_format_postprocessor): New inline function. (pp_take_prefix): Move decl to before class pretty_printer. (pp_destroy_prefix): Likewise. (pp_set_prefix): Convert to inline function. (pp_emit_prefix): Convert to inline function. (pp_format): Convert to inline function. (pp_maybe_space): Convert to inline function. (pp_begin_url): Convert to inline function. (pp_end_url): Convert to inline function. (pp_set_verbatim_wrapping): Convert from macro to inline function, renaming... (pp_set_verbatim_wrapping_): ...this. * print-rtl.cc (dump_value_slim): Update for fields of pretty_printer becoming private. (dump_insn_slim): Likewise. (dump_rtl_slim): Likewise. * print-tree.cc (print_node): Likewise. * sched-rgn.cc (dump_rgn_dependencies_dot): Likewise. * text-art/canvas.cc (canvas::print_to_pp): Likewise. (canvas::debug): Likewise. (selftest::test_canvas_urls): Likewise. * text-art/dump.h (dump_to_file): Likewise. * text-art/selftests.cc (selftest::assert_canvas_streq): Likewise. * text-art/style.cc (style::print_changes): Likewise. * text-art/styled-string.cc (styled_string::from_fmt_va): Likewise. * tree-diagnostic-path.cc (control_flow_tests): Update for pp_show_color becoming an inline function. * tree-loop-distribution.cc (dot_rdg_1): Update for fields of pretty_printer becoming private. * tree-pretty-print.cc (maybe_init_pretty_print): Likewise. * value-range.cc (vrange::dump): Likewise. (irange_bitmask::dump): Likewise. gcc/fortran/ChangeLog: * error.cc (gfc_clear_pp_buffer): Likewise. (gfc_warning): Likewise. (gfc_warning_check): Likewise. (gfc_error_opt): Likewise. (gfc_error_check): Likewise. gcc/jit/ChangeLog: * jit-recording.cc (recording::function::dump_to_dot): Update for fields of pretty_printer becoming private. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info): Update for fields of pretty_printer becoming private. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-06-12Daily bump.GCC Administrator1-0/+6
2024-06-11Fix building JIT with musl libc [PR115442]Andrew Pinski1-1/+1
Just like r13-6662-g0e6f87835ccabf but this time for jit/jit-recording.cc. Pushed as obvious after a quick build to make sure jit still builds. gcc/jit/ChangeLog: PR jit/115442 * jit-recording.cc: Define INCLUDE_SSTREAM before including system.h and don't directly incldue sstream. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-04-10Daily bump.GCC Administrator1-0/+5
2024-04-09Fix up duplicated words mostly in comments, part 2Jakub Jelinek1-1/+1
Another patch from eyeballing git grep -v 'long long\|optab optab\|template template\|double double' | grep ' \([a-zA-Z]\+\) \1 ' output, this time in gcc/ subdirectory. 2024-04-09 Jakub Jelinek <jakub@redhat.com> gcc/ * expr.cc (convert_mode_scalar): Fix duplicated words in comment; into into -> it into. * function.h (function::cond_uids): Fix duplicated words in comment; same same -> same. * config/riscv/riscv-vector-costs.cc (costs::adjust_vect_cost_per_loop): Fix duplicated words in comment; model model -> model. * config/riscv/riscv-vector-builtins-shapes.cc (build_base): Fix duplicated words in comment; for for -> for. * config/riscv/riscv-avlprop.cc (pass_avlprop::execute): Fix duplicated words in comment; more more -> more. * config/aarch64/driver-aarch64.cc (host_detect_local_cpu): Fix duplicated words in comment; be be -> be. * tree-profile.cc (masking_vectors): Fix duplicated words in comment; has has -> has, the the -> the. * value-range.cc (irange::set_range_from_bitmask): Fix duplicated words in comment; the the -> the. * gcov.cc (add_condition_counts): Fix duplicated words in comment; to to -> to. * vr-values.cc (get_scev_info): Fix duplicated words in comment; the the -> to the. * tree-vrp.cc (fully_replaceable): Fix duplicated words in comment; by by -> by. * mode-switching.cc (single_succ_confluence_n): Fix duplicated words in comment; the the -> the. * tree-ssa-phiopt.cc (value_replacement): Fix duplicated words in comment; can can -> we can. * gimple-range-phi.cc (phi_analyzer::process_phi): Fix duplicated words in comment; it it -> it is. * tree-ssa-sccvn.cc (visit_phi): Fix duplicated words in comment; to to -> to. * rtl-ssa/accesses.h (use_info::next_debug_insn_use): Fix duplicated words in comment; if if -> if. * doc/options.texi (InverseMask): Fix duplicated words; and and -> and. Change take to takes. * doc/invoke.texi (fanalyzer-undo-inlining): Fix duplicated words; be be -> be. (-minline-memops-threshold): Likewise. gcc/analyzer/ * analyzer.opt (Wanalyzer-undefined-behavior-strtok): Fix duplicated words; in in -> in. * program-state.cc (sm_state_map::replay_call_summary): Fix duplicated words in comment; to to -> to. (program_state::replay_call_summary): Likewise. * region-model.cc (region_model::replay_call_summary): Likewise. gcc/c/ * c-decl.cc (previous_tag): Fix duplicated words in comment; the the -> the. (diagnose_mismatched_decls): Fix duplicated words in comment; about about -> about. gcc/cp/ * constexpr.cc (build_new_constexpr_heap_type): Fix duplicated words in comment; is is -> is. * cp-tree.def (CO_RETURN_EXPR): Fix duplicated words in comment; for for -> for. * parser.cc (fixup_blocks_walker): Fix duplicated words in comment; is is -> is. * semantics.cc (fixup_template_type): Fix duplicated words in comment; for for -> for. (finish_omp_for): Fix duplicated words in comment; the the -> the. * pt.cc (more_specialized_fn): Fix duplicated words in comment; think think -> think. (type_targs_deducible_from): Fix duplicated words in comment; the the -> the. gcc/jit/ * docs/topics/expressions.rst (Constructor expressions): Fix duplicated words; have have -> have.
2024-04-03Daily bump.GCC Administrator1-0/+6
2024-04-02jit, Darwin: Implement library exports list.Iain Sandoe2-17/+263
Currently, we have no exports list for libgccjit, which means that all symbols are exported, including those from libstdc++ which is linked statically into the lib. This causes failures when the shared libstdc++ is used but some c++ symbols are satisfied from libgccjit. This implements an export file for Darwin (which is currently manually created by cross-checking libgccjit.map). Ideally we'd script this, at some point. Update libtool current and age to reflect the current ABI version (we are not bumping the SO name at this stage). This fixes a number of new failures in jit testing. gcc/jit/ChangeLog: * Make-lang.in: Implement exports list, and use a shared libgcc. * libgccjit.exports: New file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2024-03-30Daily bump.GCC Administrator1-0/+4
2024-03-29[PATCH] Allow `gcc_jit_type_get_size` to work with pointersGuillaume Gomez1-2/+2
gcc/jit/ChangeLog: * libgccjit.cc (gcc_jit_type_get_size): Add pointer support
2024-02-11Daily bump.GCC Administrator1-0/+5
2024-02-10Use HOST_SIZE_T_PRINT_* and HOST_WIDE_INT_T_PRINT_* some moreJakub Jelinek1-4/+4
I went through suspicios %l in format strings of *printf family functions combined with casts to (long) or (unsigned long) and tried to find out the types of the original expressions that were cast. Quite a few had size_t type, so I've used the new HOST_SIZE_T_PRINT_* macros together with cast to fmt_size_t for those, and then there were quite a few HOST_WIDE_INTs cast to long, used HOST_WIDE_INT_PRINT_* for those without casts. There was one case of a weird unsigned int variable used with %lu and (long) cast too. 2024-02-10 Jakub Jelinek <jakub@redhat.com> gcc/ * ipa-icf.cc (sem_item_optimizer::process_cong_reduction, sem_item_optimizer::dump_cong_classes): Use HOST_SIZE_T_PRINT_UNSIGNED and casts to fmt_size_t instead of "%lu" and casts to unsigned long. * tree.cc (print_debug_expr_statistics): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. (print_value_expr_statistics, print_type_hash_statistics): Likewise. * dwarf2out.cc (output_macinfo_op): Use HOST_WIDE_INT_PRINT_UNSIGNED instead of "%lu" and casts to unsigned long. * gcov-dump.cc (dump_gcov_file): Use %u instead of %lu and casts to unsigned long. * tree-ssa-dom.cc (htab_statistics): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. * cfgexpand.cc (dump_stack_var_partition): Use HOST_SIZE_T_PRINT_UNSIGNED and casts to fmt_size_t instead of "%lu" and casts to unsigned long. * gengtype.cc (adjust_field_rtx_def): Likewise. * tree-into-ssa.cc (htab_statistics): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. * postreload-gcse.cc (dump_hash_table): Likewise. * ggc-page.cc (alloc_page): Use HOST_SIZE_T_PRINT_UNSIGNED and casts to fmt_size_t instead of "%lu" and casts to unsigned long. (ggc_internal_alloc, ggc_free): Likewise. * genpreds.cc (write_lookup_constraint_1): Likewise. (write_insn_constraint_len): Likewise. * tree-dfa.cc (dump_dfa_stats): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. * varasm.cc (output_constant_pool_contents): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld" and casts to long. * var-tracking.cc (dump_var): Likewise. gcc/c-family/ * c-ada-spec.cc (dump_template_types): Use HOST_SIZE_T_PRINT_UNSIGNED and casts to fmt_size_t instead of "%lu" and casts to unsigned long. gcc/c/ * c-decl.cc (get_parm_array_spec): Use HOST_WIDE_INT_PRINT_UNSIGNED instead of "%lu" and casts to unsigned long or unsigned long long. gcc/cp/ * tree.cc (debug_binfo): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld" and casts to long. * pt.cc (print_template_statistics): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. * class.cc (dump_class_hierarchy_1): Use HOST_WIDE_INT_PRINT_UNSIGNED instead of "%lu" and casts to unsigned long. For TYPE_ALIGN, use %u instead of %lu and drop casts to unsigned long. * parser.cc (cp_lexer_peek_nth_token): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. gcc/fortran/ * trans-common.cc (build_common_decl): Use %wu instead of %lu and casts to unsigned long. * resolve.cc (resolve_ordinary_assign): Use %wd instead of %ld and casts to long. * array.cc (gfc_resolve_character_array_constructor): Likewise. * data.cc (create_character_initializer): Likewise. gcc/jit/ * jit-playback.cc (new_bitcast): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld" and casts to long. gcc/lto/ * lto-common.cc (print_lto_report_1): Use HOST_SIZE_T_PRINT_DEC and casts to fmt_size_t instead of "%ld" and casts to long. Use %d instead of %ld and casts to long for searches and collisions.
2024-02-03Daily bump.GCC Administrator1-0/+15
2024-02-02libgccjit: Implement sizeof operatorAntoni Boucher9-0/+149
gcc/jit/ChangeLog: * docs/topics/compatibility.rst (LIBGCCJIT_ABI_27): New ABI tag. * docs/topics/expressions.rst: Document gcc_jit_context_new_sizeof. * jit-playback.cc (new_sizeof): New method. * jit-playback.h (new_sizeof): New method. * jit-recording.cc (recording::context::new_sizeof, recording::memento_of_sizeof::replay_into, recording::memento_of_sizeof::make_debug_string, recording::memento_of_sizeof::write_reproducer): New methods. * jit-recording.h (class memento_of_sizeof): New class. * libgccjit.cc (gcc_jit_context_new_sizeof): New function. * libgccjit.h (gcc_jit_context_new_sizeof): New function. * libgccjit.map: New function. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-sizeof.c: New test.
2024-01-20Daily bump.GCC Administrator1-0/+13
2024-01-19libgccjit: Add missing builtins needed by optimizationsAntoni Boucher1-0/+3
gcc/jit/ChangeLog: * jit-builtins.cc (ensure_optimization_builtins_exist): Add popcount builtins. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: New test. * jit.dg/test-popcount.c: New test.
2024-01-19libgccjit: Make is_int return false on vector typesAntoni Boucher2-3/+15
gcc/jit/ChangeLog: * jit-recording.h (is_numeric_vector, vector_type::new_int): New functions. * libgccjit.cc (gcc_jit_context_new_unary_op, gcc_jit_context_new_binary_op): add checks for is_numeric_vector. gcc/testsuite/ChangeLog: * jit.dg/test-reflection.c: Add check to make sure gcc_jit_type_is_integral returns 0 on a vector type.
2024-01-13Daily bump.GCC Administrator1-0/+52
2024-01-12[PATCH] libgccjit: Add support for function attributes and variable attributes.Guillaume Gomez11-73/+1055
gcc/jit/ChangeLog: * dummy-frontend.cc (handle_alias_attribute): New function. (handle_always_inline_attribute): New function. (handle_cold_attribute): New function. (handle_fnspec_attribute): New function. (handle_format_arg_attribute): New function. (handle_format_attribute): New function. (handle_noinline_attribute): New function. (handle_target_attribute): New function. (handle_used_attribute): New function. (handle_visibility_attribute): New function. (handle_weak_attribute): New function. (handle_alias_ifunc_attribute): New function. * jit-playback.cc (fn_attribute_to_string): New function. (variable_attribute_to_string): New function. (global_new_decl): Add attributes support. (set_variable_attribute): New function. (new_global): Add attributes support. (new_global_initialized): Add attributes support. (new_local): Add attributes support. * jit-playback.h (fn_attribute_to_string): New function. (set_variable_attribute): New function. * jit-recording.cc (recording::lvalue::add_attribute): New function. (recording::function::function): New function. (recording::function::write_to_dump): Add attributes support. (recording::function::add_attribute): New function. (recording::function::add_string_attribute): New function. (recording::function::add_integer_array_attribute): New function. (recording::global::replay_into): Add attributes support. (recording::local::replay_into): Add attributes support. * jit-recording.h: Add attributes support. * libgccjit.cc (gcc_jit_function_add_attribute): New function. (gcc_jit_function_add_string_attribute): New function. (gcc_jit_function_add_integer_array_attribute): New function. (gcc_jit_lvalue_add_attribute): New function. * libgccjit.h (enum gcc_jit_fn_attribute): New enum. (gcc_jit_function_add_attribute): New function. (gcc_jit_function_add_string_attribute): New function. (gcc_jit_function_add_integer_array_attribute): New function. (enum gcc_jit_variable_attribute): New function. (gcc_jit_lvalue_add_string_attribute): New function. * libgccjit.map: Declare new functions. gcc/testsuite/ChangeLog: * jit.dg/all-non-failing-tests.h: Add new attributes tests. * jit.dg/jit.exp: Add `jit-verify-assembler-output-not` test command. * jit.dg/test-restrict-attribute.c: New test. * jit.dg/test-alias-attribute.c: New test. * jit.dg/test-always_inline-attribute.c: New test. * jit.dg/test-cold-attribute.c: New test. * jit.dg/test-const-attribute.c: New test. * jit.dg/test-noinline-attribute.c: New test. * jit.dg/test-nonnull-attribute.c: New test. * jit.dg/test-pure-attribute.c: New test. * jit.dg/test-used-attribute.c: New test. * jit.dg/test-variable-attribute.c: New test. * jit.dg/test-weak-attribute.c: New test. gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Add documentation for LIBGCCJIT_ABI_26. * docs/topics/functions.rst: Add documentation for new functions. * docs/topics/expressions.rst: Add documentation for new functions. Co-authored-by: Antoni Boucher <bouanto@zoho.com> Signed-off-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-01-03Update copyright years.Jakub Jelinek69-110/+110
2024-01-03Update Copyright year in ChangeLog filesJakub Jelinek1-1/+1
2023 -> 2024
2023-12-07Daily bump.GCC Administrator1-0/+11
2023-12-06diagnostics: use const and references for diagnostic_infoDavid Malcolm3-6/+7
No functional change intended. gcc/c-family/ChangeLog: * c-opts.cc (c_diagnostic_finalizer): Make "diagnostic" param const. gcc/cp/ChangeLog: * cp-tree.h (cxx_print_error_function): Make diagnostic_info param const. * error.cc (cxx_print_error_function): Likewise. (cp_diagnostic_starter): Likewise. (cp_print_error_function): Likewise. gcc/ChangeLog: * diagnostic-format-json.cc (on_begin_diagnostic): Convert param to const reference. (on_end_diagnostic): Likewise. (json_output_format::on_end_diagnostic): Likewise. * diagnostic-format-sarif.cc (sarif_invocation::add_notification_for_ice): Likewise. (sarif_result::on_nested_diagnostic): Likewise. (sarif_ice_notification::sarif_ice_notification): Likewise. (sarif_builder::end_diagnostic): Likewise. (sarif_builder::make_result_object): Likewise. (make_reporting_descriptor_object_for_warning): Likewise. (sarif_builder::make_locations_arr): Likewise. (sarif_output_format::on_begin_diagnostic): Likewise. (sarif_output_format::on_end_diagnostic): Likewise. * diagnostic.cc (default_diagnostic_starter): Make diagnostic_info param const. (default_diagnostic_finalizer): Likewise. (diagnostic_context::report_diagnostic): Pass diagnostic by reference to on_{begin,end}_diagnostic. (diagnostic_text_output_format::on_begin_diagnostic): Convert param to const reference. (diagnostic_text_output_format::on_end_diagnostic): Likewise. * diagnostic.h (diagnostic_starter_fn): Make diagnostic_info param const. (diagnostic_finalizer_fn): Likeewise. (diagnostic_output_format::on_begin_diagnostic): Convert param to const reference. (diagnostic_output_format::on_end_diagnostic): Likewise. (diagnostic_text_output_format::on_begin_diagnostic): Likewise. (diagnostic_text_output_format::on_end_diagnostic): Likewise. (default_diagnostic_starter): Make diagnostic_info param const. (default_diagnostic_finalizer): Likewise. * langhooks-def.h (lhd_print_error_function): Make diagnostic_info param const. * langhooks.cc (lhd_print_error_function): Likewise. * langhooks.h (lang_hooks::print_error_function): Likewise. * tree-diagnostic.cc (diagnostic_report_current_function): Likewise. (default_tree_diagnostic_starter): Likewise. (virt_loc_aware_diagnostic_finalizer): Likewise. * tree-diagnostic.h (diagnostic_report_current_function): Likewise. (virt_loc_aware_diagnostic_finalizer): Likewise. gcc/fortran/ChangeLog: * error.cc (gfc_diagnostic_starter): Make diagnostic_info param const. (gfc_diagnostic_finalizer): Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc (jit_begin_diagnostic): Make diagnostic_info param const. (jit_end_diagnostic): Likewise. Pass to add_diagnostic by reference. * jit-playback.cc (jit::playback::context::add_diagnostic): Convert diagnostic_info to const reference. * jit-playback.h (jit::playback::context::add_diagnostic): Likewise. gcc/testsuite/ChangeLog: * g++.dg/plugin/show_template_tree_color_plugin.c (noop_starter_fn): Make diagnostic_info param const. * gcc.dg/plugin/diagnostic_group_plugin.c (test_diagnostic_starter): Likewise. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (custom_diagnostic_finalizer): Likewise. * gcc.dg/plugin/location_overflow_plugin.c (verify_unpacked_ranges): Likewise. (verify_no_columns): Likewise. libcc1/ChangeLog: * context.cc (plugin_print_error_function): Make diagnostic_info param const. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-12-06Daily bump.GCC Administrator1-0/+6
2023-12-05Restore build with GCC 4.8 to GCC 5Richard Sandiford1-2/+2
GCC 5 and earlier applied array-to-pointer decay too early, which affected the new attribute namespace code. A reduced example of the construct that the attribute code uses is: struct S { template<__SIZE_TYPE__ N> S(int (&)[N]); }; struct T { int a; S b; }; int a[] = { 1 }; T t = { 1, a }; This was fixed by f85e1317f8ea933f5c615680353bd646f480f7d3 (PR 16333 et al). This patch tries to add a minimally-invasive workaround. gcc/ada/ * gcc-interface/utils.cc (gnat_internal_attribute_table): Add extra braces to work around PR 16333 in older compilers. gcc/ * attribs.cc (handle_ignored_attributes_option): Add extra braces to work around PR 16333 in older compilers. * config/aarch64/aarch64.cc (aarch64_gnu_attribute_table): Likewise. (aarch64_arm_attribute_table): Likewise. * config/arm/arm.cc (arm_gnu_attribute_table): Likewise. * config/i386/i386-options.cc (ix86_gnu_attribute_table): Likewise. * config/ia64/ia64.cc (ia64_gnu_attribute_table): Likewise. * config/rs6000/rs6000.cc (rs6000_gnu_attribute_table): Likewise. * target-def.h (TARGET_GNU_ATTRIBUTES): Likewise. * genhooks.cc (emit_init_macros): Likewise, when emitting the instantiation of TARGET_ATTRIBUTE_TABLE. * langhooks-def.h (LANG_HOOKS_INITIALIZER): Likewise, when instantiating LANG_HOOKS_ATTRIBUTE_TABLE. (LANG_HOOKS_ATTRIBUTE_TABLE): Define to be empty by default. * target.def (attribute_table): Likewise. gcc/c-family/ * c-attribs.cc (c_common_gnu_attribute_table): Add extra braces to work around PR 16333 in older compilers. gcc/c/ * c-decl.cc (std_attribute_table): Add extra braces to work around PR 16333 in older compilers. gcc/cp/ * tree.cc (cxx_gnu_attribute_table): Add extra braces to work around PR 16333 in older compilers. gcc/d/ * d-attribs.cc (d_langhook_common_attribute_table): Add extra braces to work around PR 16333 in older compilers. (d_langhook_gnu_attribute_table): Likewise. gcc/fortran/ * f95-lang.cc (gfc_gnu_attribute_table): Add extra braces to work around PR 16333 in older compilers. gcc/jit/ * dummy-frontend.cc (jit_gnu_attribute_table): Add extra braces to work around PR 16333 in older compilers. (jit_format_attribute_table): Likewise. gcc/lto/ * lto-lang.cc (lto_gnu_attribute_table): Add extra braces to work around PR 16333 in older compilers. (lto_format_attribute_table): Likewise.
2023-12-03Daily bump.GCC Administrator1-0/+13
2023-12-02Allow target attributes in non-gnu namespacesRichard Sandiford1-10/+22
Currently there are four static sources of attributes: - LANG_HOOKS_ATTRIBUTE_TABLE - LANG_HOOKS_COMMON_ATTRIBUTE_TABLE - LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE - TARGET_ATTRIBUTE_TABLE All of the attributes in these tables go in the "gnu" namespace. This means that they can use the traditional GNU __attribute__((...)) syntax and the standard [[gnu::...]] syntax. Standard attributes are registered dynamically with a null namespace. There are no supported attributes in other namespaces (clang, vendor namespaces, etc.). This patch tries to generalise things by making the namespace part of the attribute specification. It's usual for multiple attributes to be defined in the same namespace, so rather than adding the namespace to each individual definition, it seemed better to group attributes in the same namespace together. This would also allow us to reuse the same table for clang attributes that are written with the GNU syntax, or other similar situations where the attribute can be accessed via multiple "spellings". The patch therefore adds a scoped_attribute_specs that contains a namespace and a list of attributes in that namespace. It's still possible to have multiple scoped_attribute_specs for the same namespace. E.g. it makes sense to keep the C++-specific, C/C++-common, and format-related attributes in separate tables, even though they're all GNU attributes. Current lists of attributes are terminated by a null name. Rather than keep that for the new structure, it seemed neater to use an array_slice. This also makes the tables slighly more compact. In general, a target might want to support attributes in multiple namespaces. Rather than have a separate hook for each possibility (like the three langhooks above), it seemed better to make TARGET_ATTRIBUTE_TABLE a table of tables. Specifically, it's an array_slice of scoped_attribute_specs. We can do the same thing for langhooks, which allows the three hooks above to be merged into a single LANG_HOOKS_ATTRIBUTE_TABLE. It also allows the standard attributes to be registered statically and checked by the usual attribs.cc checks. The patch adds a TARGET_GNU_ATTRIBUTES helper for the common case in which a target wants a single table of gnu attributes. It can only be used if the table is free of preprocessor directives. There are probably other things we need to do to make vendor namespaces work smoothly. E.g. in principle it would be good to make exclusion sets namespace-aware. But to some extent we have that with standard vs. gnu attributes too. This patch is just supposed to be a first step. gcc/ * attribs.h (scoped_attribute_specs): New structure. (register_scoped_attributes): Take a reference to a scoped_attribute_specs instead of separate namespace and array parameters. * plugin.h (register_scoped_attributes): Likewise. * attribs.cc (register_scoped_attributes): Likewise. (attribute_tables): Change into an array of scoped_attribute_specs pointers. Reduce to 1 element for frontends and 1 element for targets. (empty_attribute_table): Delete. (check_attribute_tables): Update for changes to attribute_tables. Use a hash_set to identify duplicates. (handle_ignored_attributes_option): Update for above changes. (init_attributes): Likewise. (excl_pair): Delete. (test_attribute_exclusions): Update for above changes. Don't enforce symmetry for standard attributes in the top-level namespace. * langhooks-def.h (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Likewise. (LANG_HOOKS_INITIALIZER): Update accordingly. (LANG_HOOKS_ATTRIBUTE_TABLE): Define to an empty constructor. * langhooks.h (lang_hooks::common_attribute_table): Delete. (lang_hooks::format_attribute_table): Likewise. (lang_hooks::attribute_table): Redefine to an array of scoped_attribute_specs pointers. * target-def.h (TARGET_GNU_ATTRIBUTES): New macro. * target.def (attribute_spec): Redefine to return an array of scoped_attribute_specs pointers. * tree-inline.cc (function_attribute_inlinable_p): Update accordingly. * doc/tm.texi: Regenerate. * config/aarch64/aarch64.cc (aarch64_attribute_table): Define using TARGET_GNU_ATTRIBUTES. * config/alpha/alpha.cc (vms_attribute_table): Likewise. * config/avr/avr.cc (avr_attribute_table): Likewise. * config/bfin/bfin.cc (bfin_attribute_table): Likewise. * config/bpf/bpf.cc (bpf_attribute_table): Likewise. * config/csky/csky.cc (csky_attribute_table): Likewise. * config/epiphany/epiphany.cc (epiphany_attribute_table): Likewise. * config/gcn/gcn.cc (gcn_attribute_table): Likewise. * config/h8300/h8300.cc (h8300_attribute_table): Likewise. * config/loongarch/loongarch.cc (loongarch_attribute_table): Likewise. * config/m32c/m32c.cc (m32c_attribute_table): Likewise. * config/m32r/m32r.cc (m32r_attribute_table): Likewise. * config/m68k/m68k.cc (m68k_attribute_table): Likewise. * config/mcore/mcore.cc (mcore_attribute_table): Likewise. * config/microblaze/microblaze.cc (microblaze_attribute_table): Likewise. * config/mips/mips.cc (mips_attribute_table): Likewise. * config/msp430/msp430.cc (msp430_attribute_table): Likewise. * config/nds32/nds32.cc (nds32_attribute_table): Likewise. * config/nvptx/nvptx.cc (nvptx_attribute_table): Likewise. * config/riscv/riscv.cc (riscv_attribute_table): Likewise. * config/rl78/rl78.cc (rl78_attribute_table): Likewise. * config/rx/rx.cc (rx_attribute_table): Likewise. * config/s390/s390.cc (s390_attribute_table): Likewise. * config/sh/sh.cc (sh_attribute_table): Likewise. * config/sparc/sparc.cc (sparc_attribute_table): Likewise. * config/stormy16/stormy16.cc (xstormy16_attribute_table): Likewise. * config/v850/v850.cc (v850_attribute_table): Likewise. * config/visium/visium.cc (visium_attribute_table): Likewise. * config/arc/arc.cc (arc_attribute_table): Likewise. Move further down file. * config/arm/arm.cc (arm_attribute_table): Update for above changes, using... (arm_gnu_attributes, arm_gnu_attribute_table): ...these new globals. * config/i386/i386-options.h (ix86_attribute_table): Delete. (ix86_gnu_attribute_table): Declare. * config/i386/i386-options.cc (ix86_attribute_table): Replace with... (ix86_gnu_attributes, ix86_gnu_attribute_table): ...these two globals. * config/i386/i386.cc (ix86_attribute_table): Define as an array of scoped_attribute_specs pointers. * config/ia64/ia64.cc (ia64_attribute_table): Update for above changes, using... (ia64_gnu_attributes, ia64_gnu_attribute_table): ...these new globals. * config/rs6000/rs6000.cc (rs6000_attribute_table): Update for above changes, using... (rs6000_gnu_attributes, rs6000_gnu_attribute_table): ...these new globals. gcc/ada/ * gcc-interface/gigi.h (gnat_internal_attribute_table): Change type to scoped_attribute_specs. * gcc-interface/utils.cc (gnat_internal_attribute_table): Likewise, using... (gnat_internal_attributes): ...this as the underlying array. * gcc-interface/misc.cc (gnat_attribute_table): New global. (LANG_HOOKS_ATTRIBUTE_TABLE): Use it. gcc/c-family/ * c-common.h (c_common_attribute_table): Replace with... (c_common_gnu_attribute_table): ...this. (c_common_format_attribute_table): Change type to scoped_attribute_specs. * c-attribs.cc (c_common_attribute_table): Replace with... (c_common_gnu_attributes, c_common_gnu_attribute_table): ...these new globals. (c_common_format_attribute_table): Change type to scoped_attribute_specs, using... (c_common_format_attributes): ...this as the underlying array. gcc/c/ * c-tree.h (std_attribute_table): Declare. * c-decl.cc (std_attribute_table): Change type to scoped_attribute_specs, using... (std_attributes): ...this as the underlying array. (c_init_decl_processing): Remove call to register_scoped_attributes. * c-objc-common.h (c_objc_attribute_table): New global. (LANG_HOOKS_ATTRIBUTE_TABLE): Use it. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete. gcc/cp/ * cp-tree.h (cxx_attribute_table): Delete. (cxx_gnu_attribute_table, std_attribute_table): Declare. * cp-objcp-common.h (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete. (cp_objcp_attribute_table): New table. (LANG_HOOKS_ATTRIBUTE_TABLE): Redefine. * tree.cc (cxx_attribute_table): Replace with... (cxx_gnu_attributes, cxx_gnu_attribute_table): ...these globals. (std_attribute_table): Change type to scoped_attribute_specs, using... (std_attributes): ...this as the underlying array. (init_tree): Remove call to register_scoped_attributes. gcc/d/ * d-tree.h (d_langhook_attribute_table): Replace with... (d_langhook_gnu_attribute_table): ...this. (d_langhook_common_attribute_table): Change type to scoped_attribute_specs. * d-attribs.cc (d_langhook_common_attribute_table): Change type to scoped_attribute_specs, using... (d_langhook_common_attributes): ...this as the underlying array. (d_langhook_attribute_table): Replace with... (d_langhook_gnu_attributes, d_langhook_gnu_attribute_table): ...these new globals. (uda_attribute_p): Update accordingly, and update for new targetm.attribute_table type. * d-lang.cc (d_langhook_attribute_table): New global. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete. gcc/fortran/ * f95-lang.cc: Include attribs.h. (gfc_attribute_table): Change to an array of scoped_attribute_specs pointers, using... (gfc_gnu_attributes, gfc_gnu_attribute_table): ...these new globals. gcc/jit/ * dummy-frontend.cc (jit_format_attribute_table): Change type to scoped_attribute_specs, using... (jit_format_attributes): ...this as the underlying array. (jit_attribute_table): Change to an array of scoped_attribute_specs pointers, using... (jit_gnu_attributes, jit_gnu_attribute_table): ...these new globals for the original array. Include the format attributes. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_ATTRIBUTE_TABLE): Define. gcc/lto/ * lto-lang.cc (lto_format_attribute_table): Change type to scoped_attribute_specs, using... (lto_format_attributes): ...this as the underlying array. (lto_attribute_table): Change to an array of scoped_attribute_specs pointers, using... (lto_gnu_attributes, lto_gnu_attribute_table): ...these new globals for the original array. Include the format attributes. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete. (LANG_HOOKS_ATTRIBUTE_TABLE): Define.
2023-11-14Daily bump.GCC Administrator1-0/+4
2023-11-09Add missing declaration of get_restrict in C++ interfaceGuillaume Gomez1-0/+1
gcc/jit/ChangeLog: * libgccjit++.h:
2023-11-05Daily bump.GCC Administrator1-0/+5
2023-11-03diagnostics: convert diagnostic_context to a classDavid Malcolm2-3/+3
This patch: - converts "struct diagnostic_context" to "class diagnostic_context". - ensures all data members have an "m_" prefix, except for "printer", which has so many uses that renaming would be painful. - makes most of the data members private - converts much of the diagnostic_* functions to member functions of diagnostic_context, adding compatibility wrappers for users such as the Fortran frontend, and making as many as possible private. No functional change intended. gcc/ChangeLog: * common.opt (fdiagnostics-text-art-charset=): Remove refererence to diagnostic-text-art.h. * coretypes.h (struct diagnostic_context): Replace forward decl with... (class diagnostic_context): ...this. * diagnostic-format-json.cc: Update for changes to diagnostic_context. * diagnostic-format-sarif.cc: Likewise. * diagnostic-show-locus.cc: Likewise. * diagnostic-text-art.h: Deleted file, moving content... (enum diagnostic_text_art_charset): ...to diagnostic.h, (DIAGNOSTICS_TEXT_ART_CHARSET_DEFAULT): ...deleting, (diagnostics_text_art_charset_init): ...deleting in favor of diagnostic_context::set_text_art_charset. * diagnostic.cc: Remove include of "diagnostic-text-art.h". (pedantic_warning_kind): Update for field renaming. (permissive_error_kind): Likewise. (permissive_error_option): Likewise. (diagnostic_initialize): Convert to... (diagnostic_context::initialize): ...this, updating for field renamings. (diagnostic_color_init): Convert to... (diagnostic_context::color_init): ...this. (diagnostic_urls_init): Convert to... (diagnostic_context::urls_init): ...this. (diagnostic_initialize_input_context): Convert to... (diagnostic_context::initialize_input_context): ...this. (diagnostic_finish): Convert to... (diagnostic_context::finish): ...this, updating for field renamings. (diagnostic_context::set_output_format): New. (diagnostic_context::set_client_data_hooks): New. (diagnostic_context::create_edit_context): New. (diagnostic_converted_column): Convert to... (diagnostic_context::converted_column): ...this. (diagnostic_get_location_text): Update for field renaming. (diagnostic_check_max_errors): Convert to... (diagnostic_context::check_max_errors): ...this, updating for field renamings. (diagnostic_action_after_output): Convert to... (diagnostic_context::action_after_output): ...this, updating for field renamings. (last_module_changed_p): Delete. (set_last_module): Delete. (includes_seen): Convert to... (diagnostic_context::includes_seen_p): ...this, updating for field renamings. (diagnostic_report_current_module): Convert to... (diagnostic_context::report_current_module): ...this, updating for field renamings, and replacing uses of last_module_changed_p and set_last_module to simple field accesses. (diagnostic_show_any_path): Convert to... (diagnostic_context::show_any_path): ...this. (diagnostic_classify_diagnostic): Convert to... (diagnostic_context::classify_diagnostic): ...this, updating for field renamings. (diagnostic_push_diagnostics): Convert to... (diagnostic_context::push_diagnostics): ...this, updating for field renamings. (diagnostic_pop_diagnostics): Convert to... (diagnostic_context::pop_diagnostics): ...this, updating for field renamings. (get_any_inlining_info): Convert to... (diagnostic_context::get_any_inlining_info): ...this, updating for field renamings. (update_effective_level_from_pragmas): Convert to... (diagnostic_context::update_effective_level_from_pragmas): ...this, updating for field renamings. (print_any_cwe): Convert to... (diagnostic_context::print_any_cwe): ...this. (print_any_rules): Convert to... (diagnostic_context::print_any_rules): ...this. (print_option_information): Convert to... (diagnostic_context::print_option_information): ...this, updating for field renamings. (diagnostic_enabled): Convert to... (diagnostic_context::diagnostic_enabled): ...this, updating for field renamings. (warning_enabled_at): Convert to... (diagnostic_context::warning_enabled_at): ...this. (diagnostic_report_diagnostic): Convert to... (diagnostic_context::report_diagnostic): ...this, updating for field renamings and conversions to member functions. (diagnostic_append_note): Update for field renaming. (diagnostic_impl): Use diagnostic_context::report_diagnostic directly. (diagnostic_n_impl): Likewise. (diagnostic_emit_diagram): Convert to... (diagnostic_context::emit_diagram): ...this, updating for field renamings. (error_recursion): Convert to... (diagnostic_context::error_recursion): ...this. (diagnostic_text_output_format::~diagnostic_text_output_format): Use accessor. (diagnostics_text_art_charset_init): Convert to... (diagnostic_context::set_text_art_charset): ...this. (assert_location_text): Update for field renamings. * diagnostic.h (enum diagnostic_text_art_charset): Move here from diagnostic-text-art.h. (struct diagnostic_context): Convert to... (class diagnostic_context): ...this. (diagnostic_context::ice_handler_callback_t): New typedef. (diagnostic_context::set_locations_callback_t): New typedef. (diagnostic_context::initialize): New decl. (diagnostic_context::color_init): New decl. (diagnostic_context::urls_init): New decl. (diagnostic_context::file_cache_init): New decl. (diagnostic_context::finish): New decl. (diagnostic_context::set_set_locations_callback): New. (diagnostic_context::initialize_input_context): New decl. (diagnostic_context::warning_enabled_at): New decl. (diagnostic_context::option_unspecified_p): New. (diagnostic_context::report_diagnostic): New decl. (diagnostic_context::report_current_module): New decl. (diagnostic_context::check_max_errors): New decl. (diagnostic_context::action_after_output): New decl. (diagnostic_context::classify_diagnostic): New decl. (diagnostic_context::push_diagnostics): New decl. (diagnostic_context::pop_diagnostics): New decl. (diagnostic_context::emit_diagram): New decl. (diagnostic_context::set_output_format): New decl. (diagnostic_context::set_text_art_charset): New decl. (diagnostic_context::set_client_data_hooks): New decl. (diagnostic_context::create_edit_context): New decl. (diagnostic_context::set_warning_as_error_requested): New. (diagnostic_context::set_report_bug): New. (diagnostic_context::set_extra_output_kind): New. (diagnostic_context::set_show_cwe): New. (diagnostic_context::set_show_rules): New. (diagnostic_context::set_path_format): New. (diagnostic_context::set_show_path_depths): New. (diagnostic_context::set_show_option_requested): New. (diagnostic_context::set_max_errors): New. (diagnostic_context::set_escape_format): New. (diagnostic_context::set_ice_handler_callback): New. (diagnostic_context::warning_as_error_requested_p): New. (diagnostic_context::show_path_depths_p): New. (diagnostic_context::get_path_format): New. (diagnostic_context::get_escape_format): New. (diagnostic_context::get_file_cache): New. (diagnostic_context::get_edit_context): New. (diagnostic_context::get_client_data_hooks): New. (diagnostic_context::get_diagram_theme): New. (diagnostic_context::converted_column): New decl. (diagnostic_context::diagnostic_count): New. (diagnostic_context::includes_seen_p): New decl. (diagnostic_context::print_any_cwe): New decl. (diagnostic_context::print_any_rules): New decl. (diagnostic_context::print_option_information): New decl. (diagnostic_context::show_any_path): New decl. (diagnostic_context::error_recursion): New decl. (diagnostic_context::diagnostic_enabled): New decl. (diagnostic_context::get_any_inlining_info): New decl. (diagnostic_context::update_effective_level_from_pragmas): New decl. (diagnostic_context::m_file_cache): Make private. (diagnostic_context::diagnostic_count): Rename to... (diagnostic_context::m_diagnostic_count): ...this and make private. (diagnostic_context::warning_as_error_requested): Rename to... (diagnostic_context::m_warning_as_error_requested): ...this and make private. (diagnostic_context::n_opts): Rename to... (diagnostic_context::m_n_opts): ...this and make private. (diagnostic_context::classify_diagnostic): Rename to... (diagnostic_context::m_classify_diagnostic): ...this and make private. (diagnostic_context::classification_history): Rename to... (diagnostic_context::m_classification_history): ...this and make private. (diagnostic_context::n_classification_history): Rename to... (diagnostic_context::m_n_classification_history): ...this and make private. (diagnostic_context::push_list): Rename to... (diagnostic_context::m_push_list): ...this and make private. (diagnostic_context::n_push): Rename to... (diagnostic_context::m_n_push): ...this and make private. (diagnostic_context::show_cwe): Rename to... (diagnostic_context::m_show_cwe): ...this and make private. (diagnostic_context::show_rules): Rename to... (diagnostic_context::m_show_rules): ...this and make private. (diagnostic_context::path_format): Rename to... (diagnostic_context::m_path_format): ...this and make private. (diagnostic_context::show_path_depths): Rename to... (diagnostic_context::m_show_path_depths): ...this and make private. (diagnostic_context::show_option_requested): Rename to... (diagnostic_context::m_show_option_requested): ...this and make private. (diagnostic_context::abort_on_error): Rename to... (diagnostic_context::m_abort_on_error): ...this. (diagnostic_context::show_column): Rename to... (diagnostic_context::m_show_column): ...this. (diagnostic_context::pedantic_errors): Rename to... (diagnostic_context::m_pedantic_errors): ...this. (diagnostic_context::permissive): Rename to... (diagnostic_context::m_permissive): ...this. (diagnostic_context::opt_permissive): Rename to... (diagnostic_context::m_opt_permissive): ...this. (diagnostic_context::fatal_errors): Rename to... (diagnostic_context::m_fatal_errors): ...this. (diagnostic_context::dc_inhibit_warnings): Rename to... (diagnostic_context::m_inhibit_warnings): ...this. (diagnostic_context::dc_warn_system_headers): Rename to... (diagnostic_context::m_warn_system_headers): ...this. (diagnostic_context::max_errors): Rename to... (diagnostic_context::m_max_errors): ...this and make private. (diagnostic_context::internal_error): Rename to... (diagnostic_context::m_internal_error): ...this. (diagnostic_context::option_enabled): Rename to... (diagnostic_context::m_option_enabled): ...this. (diagnostic_context::option_state): Rename to... (diagnostic_context::m_option_state): ...this. (diagnostic_context::option_name): Rename to... (diagnostic_context::m_option_name): ...this. (diagnostic_context::get_option_url): Rename to... (diagnostic_context::m_get_option_url): ...this. (diagnostic_context::print_path): Rename to... (diagnostic_context::m_print_path): ...this. (diagnostic_context::make_json_for_path): Rename to... (diagnostic_context::m_make_json_for_path): ...this. (diagnostic_context::x_data): Rename to... (diagnostic_context::m_client_aux_data): ...this. (diagnostic_context::last_location): Rename to... (diagnostic_context::m_last_location): ...this. (diagnostic_context::last_module): Rename to... (diagnostic_context::m_last_module): ...this and make private. (diagnostic_context::lock): Rename to... (diagnostic_context::m_lock): ...this and make private. (diagnostic_context::lang_mask): Rename to... (diagnostic_context::m_lang_mask): ...this. (diagnostic_context::inhibit_notes_p): Rename to... (diagnostic_context::m_inhibit_notes_p): ...this. (diagnostic_context::report_bug): Rename to... (diagnostic_context::m_report_bug): ...this and make private. (diagnostic_context::extra_output_kind): Rename to... (diagnostic_context::m_extra_output_kind): ...this and make private. (diagnostic_context::column_unit): Rename to... (diagnostic_context::m_column_unit): ...this and make private. (diagnostic_context::column_origin): Rename to... (diagnostic_context::m_column_origin): ...this and make private. (diagnostic_context::tabstop): Rename to... (diagnostic_context::m_tabstop): ...this and make private. (diagnostic_context::escape_format): Rename to... (diagnostic_context::m_escape_format): ...this and make private. (diagnostic_context::edit_context_ptr): Rename to... (diagnostic_context::m_edit_context_ptr): ...this and make private. (diagnostic_context::set_locations_cb): Rename to... (diagnostic_context::m_set_locations_cb): ...this and make private. (diagnostic_context::ice_handler_cb): Rename to... (diagnostic_context::m_ice_handler_cb): ...this and make private. (diagnostic_context::includes_seen): Rename to... (diagnostic_context::m_includes_seen): ...this and make private. (diagnostic_inhibit_notes): Update for field renaming. (diagnostic_context_auxiliary_data): Likewise. (diagnostic_abort_on_error): Convert from macro to inline function and update for field renaming. (diagnostic_kind_count): Convert from macro to inline function and use diagnostic_count accessor. (diagnostic_report_warnings_p): Update for field renaming. (diagnostic_initialize): Convert decl to inline function calling into diagnostic_context. (diagnostic_color_init): Likewise. (diagnostic_urls_init): Likewise. (diagnostic_urls_init): Likewise. (diagnostic_finish): Likewise. (diagnostic_report_current_module): Likewise. (diagnostic_show_any_path): Delete decl. (diagnostic_initialize_input_context): Convert decl to inline function calling into diagnostic_context. (diagnostic_classify_diagnostic): Likewise. (diagnostic_push_diagnostics): Likewise. (diagnostic_pop_diagnostics): Likewise. (diagnostic_report_diagnostic): Likewise. (diagnostic_action_after_output): Likewise. (diagnostic_check_max_errors): Likewise. (diagnostic_file_cache_fini): Delete decl. (diagnostic_converted_column): Delete decl. (warning_enabled_at): Convert decl to inline function calling into diagnostic_context. (option_unspecified_p): New. (diagnostic_emit_diagram): Delete decl. * gcc.cc: Remove include of "diagnostic-text-art.h". Update for changes to diagnostic_context. * input.cc (diagnostic_file_cache_init): Move implementation to... (diagnostic_context::file_cache_init): ...this new member function. (diagnostic_file_cache_fini): Delete. (diagnostics_file_cache_forcibly_evict_file): Update for m_file_cache becoming private. (location_get_source_line): Likewise. (get_source_file_content): Likewise. (location_missing_trailing_newline): Likewise. * input.h (diagnostics_file_cache_fini): Delete. * langhooks.cc: Update for changes to diagnostic_context. * lto-wrapper.cc: Likewise. * opts.cc: Remove include of "diagnostic-text-art.h". Update for changes to diagnostic_context. * selftest-diagnostic.cc: Update for changes to diagnostic_context. * toplev.cc: Likewise. * tree-diagnostic-path.cc: Likewise. * tree-diagnostic.cc: Likewise. gcc/ada/ChangeLog: * gcc-interface/misc.cc: Update for changes to diagnostic_context. gcc/analyzer/ChangeLog: * bounds-checking.cc: Update for changes to diagnostic_context. gcc/c-family/ChangeLog: * c-common.cc: Update for changes to diagnostic_context. * c-indentation.cc: Likewise. * c-opts.cc: Likewise. * c-warn.cc: Likewise. gcc/cp/ChangeLog: * call.cc: Update for changes to diagnostic_context. * class.cc: Likewise. * decl.cc: Likewise. * error.cc: Likewise. * except.cc: Likewise. * pt.cc: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update for changes to diagnostic_context. * error.cc: Likewise. * options.cc: Likewise. gcc/jit/ChangeLog: * jit-playback.cc: Update for changes to diagnostic_context. * jit-playback.h: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_group_plugin.c: Update for changes to diagnostic_context. * gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-10-26Daily bump.GCC Administrator1-0/+5
2023-10-25jit: dump string literal initializers correctlyVibhav Pant1-1/+1
Signed-off-by: David Malcolm <dmalcolm@redhat.com> gcc/jit/ChangeLog: * jit-recording.cc (recording::global::write_to_dump): Fix dump of string literal initializers. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-10-23Daily bump.GCC Administrator1-0/+4
2023-10-22Config,Darwin: Allow for configuring Darwin to use embedded runpath.Iain Sandoe1-1/+1
Recent Darwin versions place contraints on the use of run paths specified in environment variables. This breaks some assumptions in the GCC build. This change allows the user to configure a Darwin build to use '@rpath/libraryname.dylib' in library names and then to add an embedded runpath to executables (and libraries with dependents). The embedded runpath is added by default unless the user adds '-nodefaultrpaths' to the link line. For an installed compiler, it means that any executable built with that compiler will reference the runtimes installed with the compiler (equivalent to hard-coding the library path into the name of the library). During build-time configurations any "-B" entries will be added to the runpath thus the newly-built libraries will be found by exes. Since the install name is set in libtool, that decision needs to be available here (but might also cause dependent ones in Makefiles, so we need to export a conditional). This facility is not available for Darwin 8 or earlier, however the existing environment variable runpath does work there. We default this on for systems where the external DYLD_LIBRARY_PATH does not work and off for Darwin 8 or earlier. For systems that can use either method, if the value is unset, we use the default (which is currently DYLD_LIBRARY_PATH). ChangeLog: * configure: Regenerate. * configure.ac: Do not add default runpaths to GCC exes when we are building -static-libstdc++/-static-libgcc (the default). * libtool.m4: Add 'enable-darwin-at-runpath'. Act on the enable flag to alter Darwin libraries to use @rpath names. gcc/ChangeLog: * aclocal.m4: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths. * config/darwin.h: Handle Darwin rpaths. * config/darwin.opt: Handle Darwin rpaths. * Makefile.in: Handle Darwin rpaths. gcc/ada/ChangeLog: * gcc-interface/Makefile.in: Handle Darwin rpaths. gcc/jit/ChangeLog: * Make-lang.in: Handle Darwin rpaths. libatomic/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths. libbacktrace/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths. libcc1/ChangeLog: * configure: Regenerate. libffi/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. libgcc/ChangeLog: * config/t-slibgcc-darwin: Generate libgcc_s with an @rpath name. * config.host: Handle Darwin rpaths. libgfortran/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths libgm2/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths. * libm2cor/Makefile.am: Handle Darwin rpaths. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.am: Handle Darwin rpaths. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.am: Handle Darwin rpaths. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.am: Handle Darwin rpaths. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.am: Handle Darwin rpaths. * libm2pim/Makefile.in: Regenerate. libgomp/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths libitm/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths. libobjc/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths. libphobos/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths. * libdruntime/Makefile.am: Handle Darwin rpaths. * libdruntime/Makefile.in: Regenerate. * src/Makefile.am: Handle Darwin rpaths. * src/Makefile.in: Regenerate. libquadmath/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths. libsanitizer/ChangeLog: * asan/Makefile.am: Handle Darwin rpaths. * asan/Makefile.in: Regenerate. * configure: Regenerate. * hwasan/Makefile.am: Handle Darwin rpaths. * hwasan/Makefile.in: Regenerate. * lsan/Makefile.am: Handle Darwin rpaths. * lsan/Makefile.in: Regenerate. * tsan/Makefile.am: Handle Darwin rpaths. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.am: Handle Darwin rpaths. * ubsan/Makefile.in: Regenerate. libssp/ChangeLog: * Makefile.am: Handle Darwin rpaths. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Handle Darwin rpaths. libstdc++-v3/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths. * src/Makefile.am: Handle Darwin rpaths. * src/Makefile.in: Regenerate. libvtv/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths. lto-plugin/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths. zlib/ChangeLog: * configure: Regenerate. * configure.ac: Handle Darwin rpaths.
2023-10-03Daily bump.GCC Administrator1-0/+5
2023-10-02diagnostics: add diagnostic_output_format classDavid Malcolm1-2/+2
Eliminate various global variables in the json/sarif output code by bundling together callbacks and state into a new diagnostic_output_format class, with per-output-format subclasses. No functional change intended. gcc/ChangeLog: * diagnostic-format-json.cc (toplevel_array): Remove global in favor of json_output_format::m_top_level_array. (cur_group): Likewise, for json_output_format::m_cur_group. (cur_children_array): Likewise, for json_output_format::m_cur_children_array. (class json_output_format): New. (json_begin_diagnostic): Remove, in favor of json_output_format::on_begin_diagnostic. (json_end_diagnostic): Convert to... (json_output_format::on_end_diagnostic): ...this. (json_begin_group): Remove, in favor of json_output_format::on_begin_group. (json_end_group): Remove, in favor of json_output_format::on_end_group. (json_flush_to_file): Remove, in favor of json_output_format::flush_to_file. (json_stderr_final_cb): Remove, in favor of json_output_format dtor. (json_output_base_file_name): Remove global. (class json_stderr_output_format): New. (json_file_final_cb): Remove. (class json_file_output_format): New. (json_emit_diagram): Remove. (diagnostic_output_format_init_json): Update. (diagnostic_output_format_init_json_file): Update. * diagnostic-format-sarif.cc (the_builder): Remove this global, moving to a field of the sarif_output_format. (sarif_builder::maybe_make_artifact_content_object): Use the context's m_file_cache. (get_source_lines): Convert to... (sarif_builder::get_source_lines): ...this, using context's m_file_cache. (sarif_begin_diagnostic): Remove, in favor of sarif_output_format::on_begin_diagnostic. (sarif_end_diagnostic): Remove, in favor of sarif_output_format::on_end_diagnostic. (sarif_begin_group): Remove, in favor of sarif_output_format::on_begin_group. (sarif_end_group): Remove, in favor of sarif_output_format::on_end_group. (sarif_flush_to_file): Delete. (sarif_stderr_final_cb): Delete. (sarif_output_base_file_name): Delete. (sarif_file_final_cb): Delete. (class sarif_output_format): New. (sarif_emit_diagram): Delete. (class sarif_stream_output_format): New. (class sarif_file_output_format): New. (diagnostic_output_format_init_sarif): Update. (diagnostic_output_format_init_sarif_stderr): Update. (diagnostic_output_format_init_sarif_file): Update. (diagnostic_output_format_init_sarif_stream): Update. * diagnostic-show-locus.cc (diagnostic_show_locus): Update. * diagnostic.cc (default_diagnostic_final_cb): Delete, moving to diagnostic_text_output_format's dtor. (diagnostic_initialize): Update, making a new instance of diagnostic_text_output_format. (diagnostic_finish): Delete m_output_format, rather than calling final_cb. (diagnostic_report_diagnostic): Assert that m_output_format is non-NULL. Replace call to begin_group_cb with call to m_output_format->on_begin_group. Replace call to diagnostic_starter with call to m_output_format->on_begin_diagnostic. Replace call to diagnostic_finalizer with call to m_output_format->on_end_diagnostic. (diagnostic_emit_diagram): Replace both optional call to m_diagrams.m_emission_cb and default implementation with call to m_output_format->on_diagram. Move default implementation to diagnostic_text_output_format::on_diagram. (auto_diagnostic_group::~auto_diagnostic_group): Replace call to end_group_cb with call to m_output_format->on_end_group. (diagnostic_text_output_format::~diagnostic_text_output_format): New, based on default_diagnostic_final_cb. (diagnostic_text_output_format::on_begin_diagnostic): New, based on code from diagnostic_report_diagnostic. (diagnostic_text_output_format::on_end_diagnostic): Likewise. (diagnostic_text_output_format::on_diagram): New, based on code from diagnostic_emit_diagram. * diagnostic.h (class diagnostic_output_format): New. (class diagnostic_text_output_format): New. (diagnostic_context::begin_diagnostic): Move to... (diagnostic_context::m_text_callbacks::begin_diagnostic): ...here. (diagnostic_context::start_span): Move to... (diagnostic_context::m_text_callbacks::start_span): ...here. (diagnostic_context::end_diagnostic): Move to... (diagnostic_context::m_text_callbacks::end_diagnostic): ...here. (diagnostic_context::begin_group_cb): Remove, in favor of m_output_format->on_begin_group. (diagnostic_context::end_group_cb): Remove, in favor of m_output_format->on_end_group. (diagnostic_context::final_cb): Remove, in favor of m_output_format's dtor. (diagnostic_context::m_output_format): New field. (diagnostic_context::m_diagrams.m_emission_cb): Remove, in favor of m_output_format->on_diagram. (diagnostic_starter): Update. (diagnostic_finalizer): Update. (diagnostic_output_format_init_sarif_stream): New. * input.cc (location_get_source_line): Move implementation apart from call to diagnostic_file_cache_init to... (file_cache::get_source_line): ...this new function... (location_get_source_line): ...and reintroduce, rewritten in terms of file_cache::get_source_line. (get_source_file_content): Likewise, refactor into... (file_cache::get_source_file_content): ...this new function. * input.h (file_cache::get_source_line): New decl. (file_cache::get_source_file_content): New decl. * selftest-diagnostic.cc (test_diagnostic_context::test_diagnostic_context): Update. * tree-diagnostic-path.cc (event_range::print): Update for change to diagnostic_context's start_span callback. gcc/fortran/ChangeLog: * error.cc (gfc_diagnostics_init): Update for change to start_span. gcc/jit/ChangeLog: * dummy-frontend.cc (jit_langhook_init): Update for change to diagnostic_context callbacks. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_group_plugin.c (test_begin_group_cb, test_end_group_cb): Replace with... (class test_output_format): ...this new subclass. (plugin_init): Update. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-09-01Daily bump.GCC Administrator1-0/+4
2023-08-31Darwin: homogenize spelling of macOSFrancois-Xavier Coudert1-1/+1
gcc/ChangeLog: * config.in: Regenerate. * config/darwin-c.cc: Change spelling to macOS. * config/darwin-driver.cc: Likewise. * config/darwin.h: Likewise. * configure.ac: Likewise. * doc/contrib.texi: Likewise. * doc/extend.texi: Likewise. * doc/invoke.texi: Likewise. * doc/plugins.texi: Likewise. * doc/tm.texi: Regenerate. * doc/tm.texi.in: Change spelling to macOS. * plugin.cc: Likewise. gcc/analyzer/ChangeLog: * kf.cc: Change spelling to macOS. gcc/c-family/ChangeLog: * c.opt: Change spelling to macOS. gcc/fortran/ChangeLog: * gfortran.texi: Likewise. gcc/jit/ChangeLog: * jit-playback.cc: Change spelling to macOS. gcc/objc/ChangeLog: * objc-act.cc: Change spelling to macOS.
2023-08-30Daily bump.GCC Administrator1-0/+16
2023-08-29libgccjit: add support for `restrict` attribute on function parametersGuillaume Gomez10-2/+136
gcc/jit/Changelog: * jit-playback.cc: Remove trailing whitespace characters. * jit-playback.h: Add get_restrict method. * jit-recording.cc: Add get_restrict methods. * jit-recording.h: Add get_restrict methods. * libgccjit++.h: Add get_restrict methods. * libgccjit.cc: Add gcc_jit_type_get_restrict. * libgccjit.h: Declare gcc_jit_type_get_restrict. * libgccjit.map: Declare gcc_jit_type_get_restrict. gcc/testsuite/ChangeLog: * jit.dg/test-restrict.c: Add test for __restrict__ attribute. * jit.dg/all-non-failing-tests.h: Add test-restrict.c to the list. gcc/jit/ChangeLog: * docs/topics/compatibility.rst: Add documentation for LIBGCCJIT_ABI_25. * docs/topics/types.rst: Add documentation for gcc_jit_type_get_restrict. Signed-off-by: Guillaume Gomez <guillaume1.gomez@gmail.com>