Skip to content
Snippets Groups Projects
  1. Feb 22, 2023
    • Thomas Schwinge's avatar
      Add '-Wno-complain-wrong-lang', and use it in... · 320dc51c
      Thomas Schwinge authored
      Add '-Wno-complain-wrong-lang', and use it in 'gcc/testsuite/lib/target-supports.exp:check_compile' and elsewhere
      
      I noticed that GCC/Rust recently lost all LTO variants in torture testing:
      
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O0  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O1  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2  (test for excess errors)
          -PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
          -PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O3 -g  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -Os  (test for excess errors)
      
      Etc.
      
      The reason is that when probing for availability of LTO, we run into:
      
          spawn [...]/build-gcc/gcc/testsuite/rust/../../gccrs -B[...]/build-gcc/gcc/testsuite/rust/../../ -fdiagnostics-plain-output -frust-incomplete-and-experimental-compiler-do-not-use -flto -c -o lto8274.o lto8274.c
          cc1: warning: command-line option '-frust-incomplete-and-experimental-compiler-do-not-use' is valid for Rust but not for C
      
      For GCC/Rust testing, this flag is (as of recently) defaulted in
      'gcc/testsuite/lib/rust.exp:rust_init':
      
          lappend ALWAYS_RUSTFLAGS "additional_flags=-frust-incomplete-and-experimental-compiler-do-not-use"
      
      A few more "command-line option [...] is valid for [...] but not for [...]"
      instances were found in the test suite logs, when more than one language is
      involved.
      
      With '-Wno-complain-wrong-lang' used in
      'gcc/testsuite/lib/target-supports.exp:check_compile', we get back:
      
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O0  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O1  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2  (test for excess errors)
          +PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fno-use-linker-plugin -flto-partition=none  (test for excess errors)
          +PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -O3 -g  (test for excess errors)
           PASS: rust/compile/torture/all_doc_comment_line_blocks.rs   -Os  (test for excess errors)
      
      Etc., and in total:
      
                          === rust Summary for unix ===
      
          # of expected passes            [-4990-]{+6718+}
          # of expected failures          [-39-]{+51+}
      
      Anything that 'gcc/opts-global.cc:complain_wrong_lang' might do is cut
      short by '-Wno-complain-wrong-lang', not just the one 'warning'
      diagnostic.  This corresponds to what already exists via
      'lang_hooks.complain_wrong_lang_p'.
      
      The 'gcc/opts-common.cc:prune_options' changes follow the same rationale
      as PR67640 "driver passes -fdiagnostics-color= always last": we need to
      process '-Wno-complain-wrong-lang' early, so that it properly affects
      other options appearing before it on the command line.
      
      	gcc/
      	* common.opt (-Wcomplain-wrong-lang): New.
      	* doc/invoke.texi (-Wno-complain-wrong-lang): Document it.
      	* opts-common.cc (prune_options): Handle it.
      	* opts-global.cc (complain_wrong_lang): Use it.
      	gcc/testsuite/
      	* gcc.dg/Wcomplain-wrong-lang-1.c: New.
      	* gcc.dg/Wcomplain-wrong-lang-2.c: Likewise.
      	* gcc.dg/Wcomplain-wrong-lang-3.c: Likewise.
      	* gcc.dg/Wcomplain-wrong-lang-4.c: Likewise.
      	* gcc.dg/Wcomplain-wrong-lang-5.c: Likewise.
      	* lib/target-supports.exp (check_compile): Use
      	'-Wno-complain-wrong-lang'.
      	* g++.dg/abi/empty12.C: Likewise.
      	* g++.dg/abi/empty13.C: Likewise.
      	* g++.dg/abi/empty14.C: Likewise.
      	* g++.dg/abi/empty15.C: Likewise.
      	* g++.dg/abi/empty16.C: Likewise.
      	* g++.dg/abi/empty17.C: Likewise.
      	* g++.dg/abi/empty18.C: Likewise.
      	* g++.dg/abi/empty19.C: Likewise.
      	* g++.dg/abi/empty22.C: Likewise.
      	* g++.dg/abi/empty25.C: Likewise.
      	* g++.dg/abi/empty26.C: Likewise.
      	* gfortran.dg/bind-c-contiguous-1.f90: Likewise.
      	* gfortran.dg/bind-c-contiguous-4.f90: Likewise.
      	* gfortran.dg/bind-c-contiguous-5.f90: Likewise.
      	libgomp/
      	* testsuite/libgomp.fortran/alloc-10.f90: Use
      	'-Wno-complain-wrong-lang'.
      	* testsuite/libgomp.fortran/alloc-11.f90: Likewise.
      	* testsuite/libgomp.fortran/alloc-7.f90: Likewise.
      	* testsuite/libgomp.fortran/alloc-9.f90: Likewise.
      	* testsuite/libgomp.fortran/allocate-1.f90: Likewise.
      	* testsuite/libgomp.fortran/depend-4.f90: Likewise.
      	* testsuite/libgomp.fortran/depend-5.f90: Likewise.
      	* testsuite/libgomp.fortran/depend-6.f90: Likewise.
      	* testsuite/libgomp.fortran/depend-7.f90: Likewise.
      	* testsuite/libgomp.fortran/depend-inoutset-1.f90: Likewise.
      	* testsuite/libgomp.fortran/examples-4/declare_target-1.f90:
      	Likewise.
      	* testsuite/libgomp.fortran/examples-4/declare_target-2.f90:
      	Likewise.
      	* testsuite/libgomp.fortran/order-reproducible-1.f90: Likewise.
      	* testsuite/libgomp.fortran/order-reproducible-2.f90: Likewise.
      	* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
      	* testsuite/libgomp.fortran/task-detach-6.f90: Remove left-over
      	'dg-prune-output'.
      320dc51c
    • Thomas Schwinge's avatar
      Rust: Don't depend on unused 'target-libffi', 'target-libbacktrace' · 7411eca4
      Thomas Schwinge authored
      For example:
      
          configure: error: "libffi has not been ported to nvptx-unknown-none."
      
      Follow-up to commit a75f038c
      "gccrs: Add config-lang.in", which said:
      
      > This was a copy/paste from gccgo front-end. We do not use any of the
      > target_libs yet, [...]
      
      	gcc/rust/
      	* config-lang.in (target_libs): Remove.
      7411eca4
    • Thomas Schwinge's avatar
      In 'contrib/config-list.mk', clarify i686-symbolics-gnu to i686-gnu · 10f08513
      Thomas Schwinge authored
      Already in the first revision of 'contrib/config-list.mk', i686-symbolics-gnu
      has been present, but it's not clear to me whether that was meant to be
      Symbolics as in the manufacturer, <https://en.wikipedia.org/wiki/Symbolics>,
      with GNU (that is, GNU/Hurd) kernel/operating system (user land), or Symbolics
      kernel with GNU operating system (user land)?
      
      I can't find any mention of "Symbolics" in the history of 'config.sub'
      upstream.
      
      Either way, GCC configures i686-symbolics-gnu exactly the same as i686-gnu:
      
          $ sed -n -e '/Using .* host machine hooks\.$/q' -e '/^Using the following target machine macro files:$/,$p' log/i686-gnu-make.out
          Using the following target machine macro files:
                  [...]/gcc/config/vxworks-dummy.h
                  [...]/gcc/config/i386/i386.h
                  [...]/gcc/config/i386/unix.h
                  [...]/gcc/config/i386/att.h
                  [...]/gcc/config/elfos.h
                  [...]/gcc/config/gnu-user.h
                  [...]/gcc/config/glibc-stdint.h
                  [...]/gcc/config/i386/gnu-user-common.h
                  [...]/gcc/config/i386/gnu-user.h
                  [...]/gcc/config/gnu.h
                  [...]/gcc/config/i386/gnu.h
                  [...]/gcc/config/initfini-array.h
      
      ..., so let's clarify i686-symbolics-gnu to i686-gnu.
      
      	contrib/
      	* config-list.mk (LIST): Clarify i686-symbolics-gnu to i686-gnu.
      10f08513
    • GCC Administrator's avatar
      Daily bump. · c3bf22d9
      GCC Administrator authored
      c3bf22d9
  2. Feb 21, 2023
    • David Malcolm's avatar
      analyzer: stop exploring the path after certain diagnostics [PR108830] · 8f636915
      David Malcolm authored
      
      PR analyzer/108830 reports a situation in which there are lots of
      followup -Wanalyzer-null-dereference warnings after the first access of
      a NULL pointer, leading to very noisy output from -fanalyzer.
      
      The analyzer's logic for stopping emitting multiple warnings from a
      state machine doesn't quite work for NULL pointers: it attempts to
      transition the malloc state machine's NULL pointer to the "stop" state,
      which doesn't seem to make much sense in retrospect, and seems to get
      confused over types.
      
      Similarly, poisoned_value_diagnostic can be very noisy for uninit
      variables, emitting a warning for every access to an uninitialized
      variable.  In theory, region_model::check_for_poison makes some attempts
      to suppress followups, but only for the symbolic value itself; if the
      user's code keeps accessing the same region, we would get a warning on
      each one.  For example, this showed up in Doom's s_sound.c where there
      were 7 followup uninit warnings after the first uninit warning in
      "S_ChangeMusic".
      
      This patch adds an extra mechanism, giving pending diagnostics the
      option of stopping the analysis of an execution path if they're saved
      for emission on it, and turning this on for these warnings:
        -Wanalyzer-null-dereference
        -Wanalyzer-null-argument
        -Wanalyzer-use-after-free
        -Wanalyzer-use-of-pointer-in-stale-stack-frame
        -Wanalyzer-use-of-uninitialized-value
      
      Doing so should hopefully reduce the cascades of diagnostics that
      -fanalyzer can sometimes emit.
      
      I added a -fno-analyzer-suppress-followups for the cases where you
      really want the followup warnings (e.g. in some DejaGnu tests, and
      for microbenchmarks of UB detection, such as PR analyzer/104224).
      
      Integration testing shows this patch reduces the number of probable
      false positives reported by 94, and finds one more true positive:
      
      Comparison: 9.34% -> 10.91%
        GOOD:  66 ->  67  (+1)
         BAD: 641 -> 547 (-94)
      
      where the affected warnings/projects are:
      
        -Wanalyzer-null-dereference: 0.00% GOOD: 0 BAD: 269 -> 239 (-30)
           Unclassified: 257 -> 228 (-29)
                        apr-1.7.0:  12 ->   5  (-7)
                             doom:   1 ->   0  (-1)
                    haproxy-2.7.1:  47 ->  41  (-6)
             ImageMagick-7.1.0-57:  13 ->   9  (-4)
                       qemu-7.2.0: 165 -> 154 (-11)
      
            Known false: 7 -> 6 (-1)
                         xz-5.4.0:   4 ->   3  (-1)
      
        -Wanalyzer-use-of-uninitialized-value: 0.00% GOOD: 0 BAD: 143 -> 80 (-63)
            Known false: 47 -> 16 (-31)
                             doom: 42 -> 11 (-31)
      
           Unclassified: 96 -> 64 (-32)
                    coreutils-9.1: 14 -> 10  (-4)
                    haproxy-2.7.1: 29 -> 23  (-6)
                       qemu-7.2.0: 48 -> 26 (-22)
      
        -Wanalyzer-null-argument: 0.00% -> 2.33% GOOD: 0 -> 1 (+1) BAD: 43 -> 42 (-1)
           Unclassified: 39 -> 38 (-1)
            due to coreutils-9.1: 9 -> 8 (-1)
      
          True positive: 0 -> 1 (+1)
            (in haproxy-2.7.1)
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/108830
      	* analyzer.opt (fanalyzer-suppress-followups): New option.
      	* engine.cc (impl_region_model_context::warn): Terminate the path
      	if the diagnostic's terminate_path_p vfunc returns true and
      	-fanalyzer-suppress-followups is true (the default).
      	(impl_sm_context::warn): Likewise, for both overloads.
      	* pending-diagnostic.h (pending_diagnostic::terminate_path_p): New
      	vfunc.
      	* program-state.cc (program_state::on_edge): Terminate the path if
      	the ctxt requests it during updating the edge.
      	* region-model.cc (poisoned_value_diagnostic::terminate_path_p):
      	New vfunc.
      	* sm-malloc.cc (null_deref::terminate_path_p): New vfunc.
      	(null_arg::terminate_path_p): New vfunc.
      
      gcc/ChangeLog:
      	PR analyzer/108830
      	* doc/invoke.texi: Document -fno-analyzer-suppress-followups.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/108830
      	* gcc.dg/analyzer/attribute-nonnull.c: Update for
      	-Wanalyzer-use-of-uninitialized-value terminating analysis along
      	a path.
      	* gcc.dg/analyzer/call-summaries-2.c: Likewise.
      	* gcc.dg/analyzer/data-model-1.c: Likewise.
      	* gcc.dg/analyzer/data-model-5.c: Likewise.
      	* gcc.dg/analyzer/doom-s_sound-pr108867.c: New test.
      	* gcc.dg/analyzer/memset-CVE-2017-18549-1.c: Add
      	-fno-analyzer-suppress-followups.
      	* gcc.dg/analyzer/null-deref-pr108830.c: New test.
      	* gcc.dg/analyzer/pipe-1.c: Add -fno-analyzer-suppress-followups.
      	* gcc.dg/analyzer/pipe-void-return.c: Likewise.
      	* gcc.dg/analyzer/pipe2-1.c: Likewise.
      	* gcc.dg/analyzer/pr101547.c: Update for
      	-Wanalyzer-use-of-uninitialized-value terminating analysis along
      	a path.
      	* gcc.dg/analyzer/pr101875.c: Likewise.
      	* gcc.dg/analyzer/pr104224-split.c: New test, based on...
      	* gcc.dg/analyzer/pr104224.c: Add
      	-fno-analyzer-suppress-followups.
      	* gcc.dg/analyzer/realloc-2.c: Add
      	-fno-analyzer-suppress-followups.
      	* gcc.dg/analyzer/realloc-3.c: Likewise.
      	* gcc.dg/analyzer/realloc-5.c: Likewise.
      	* gcc.dg/analyzer/stdarg-1-ms_abi.c: Likewise.
      	* gcc.dg/analyzer/stdarg-1-sysv_abi.c: Likewise.
      	* gcc.dg/analyzer/stdarg-1.c: Likewise.
      	* gcc.dg/analyzer/symbolic-1.c: Likewise.
      	* gcc.dg/analyzer/symbolic-7.c: Update for
      	-Wanalyzer-use-of-uninitialized-value terminating analysis along a
      	path.
      	* gcc.dg/analyzer/uninit-4.c: Likewise.
      	* gcc.dg/analyzer/uninit-8.c: New test.
      	* gcc.dg/analyzer/uninit-pr94713.c: Update for
      	-Wanalyzer-use-of-uninitialized-value terminating analysis along a
      	path.
      	* gcc.dg/analyzer/zlib-6a.c: Add -fno-analyzer-suppress-followups.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      8f636915
    • Max Filippov's avatar
      gcc: xtensa: fix PR target/108876 · b2ef02e8
      Max Filippov authored
      gcc/
      	PR target/108876
      	* config/xtensa/xtensa.cc (xtensa_expand_epilogue): Drop emit_use
      	for A0_REG.
      	* config/xtensa/xtensa.md (sibcall, sibcall_internal)
      	(sibcall_value, sibcall_value_internal): Add 'use' expression
      	for A0_REG.
      b2ef02e8
    • Harald Anlauf's avatar
      Fortran: improve checking of character length specification [PR96025] · 6c1b825b
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/96025
      	* parse.cc (check_function_result_typed): Improve type check of
      	specification expression for character length and return status.
      	(parse_spec): Use status from above.
      	* resolve.cc (resolve_fntype): Prevent use of invalid specification
      	expression for character length.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/96025
      	* gfortran.dg/pr96025.f90: New test.
      6c1b825b
    • Iain Buclaw's avatar
      libphobos: Merge upstream phobos e5a521ab2. · f77948c5
      Iain Buclaw authored
      Phobos changes:
      
          - Unicode tables have been updated to version 15.
      
      libphobos/ChangeLog:
      
      	* src/MERGE: Merge upstream phobos e5a521ab2.
      f77948c5
    • Iain Buclaw's avatar
      d: Merge upstream dmd, druntime 09faa4eacd, phobos 13ef27a56. · f99303eb
      Iain Buclaw authored
      D front-end changes:
      
      	- Import dmd v2.102.0-beta.1
      	- `static assert' now supports multiple message arguments.
      
      D runtime changes:
      
      	- Import druntime v2.102.0-beta.1
      	- The default `Throwable.TraceInfo' generation now is `@nogc'.
      	- `Object.factory' method has now been deprecated.
      
      Phobos changes:
      
      	- Import phobos v2.102.0-beta.1
      	- Added float- and double-precision implementations for log
      	  function families in std.math.
      	- `std.typecons.Unique' now calls `destroy` on struct types
      
      gcc/d/ChangeLog:
      
      	* Make-lang.in (D_FRONTEND_OBJS): Add d/location.o.
      	* d-lang.cc (d_init_options): Update for new front-end interface.
      	(d_post_options): Call Loc::set after handling options.
      	* dmd/MERGE: Merge upstream dmd 09faa4eacd.
      	* dmd/VERSION: Bump version to v2.102.0-beta.1.
      
      libphobos/ChangeLog:
      
      	* libdruntime/MERGE: Merge upstream druntime 09faa4eacd.
      	* src/MERGE: Merge upstream phobos 13ef27a56.
      	* testsuite/libphobos.exceptions/refcounted.d: Add test for chained
      	reference counted exceptions.
      	* testsuite/libphobos.shared/finalize.d: Add dg-warning for deprecated
      	factory interfaces.
      	* testsuite/libphobos.gc/issue22843.d: New test.
      
      gcc/testsuite/ChangeLog:
      
      	* gdc.dg/simd2a.d: Update.
      	* gdc.dg/simd2b.d: Update.
      	* gdc.dg/simd2c.d: Update.
      	* gdc.dg/simd2d.d: Update.
      	* gdc.dg/simd2e.d: Update.
      	* gdc.dg/simd2f.d: Update.
      	* gdc.dg/simd2g.d: Update.
      	* gdc.dg/simd2h.d: Update.
      	* gdc.dg/simd2i.d: Update.
      	* gdc.dg/simd2j.d: Update.
      f99303eb
    • Iain Buclaw's avatar
      d: Only handle the left-to-right evaluation of a call expression during gimplify · 7e9dd9de
      Iain Buclaw authored
      Removes an unnecessary rewriting of the front-end AST during lowering.
      
      gcc/d/ChangeLog:
      
      	* d-codegen.cc (d_build_call): Remove front-end expansion of
      	side-effects in a call expression.
      	* d-gimplify.cc (d_gimplify_call_expr): Gimplify the callee before its
      	arguments.
      7e9dd9de
    • Iain Buclaw's avatar
      d: Set doing_semantic_analysis_p before calling functionSemantic3 · 8063de4a
      Iain Buclaw authored
      As functions which have semantic analysis ran late may still require
      the use of CTFE built-ins to be evaluated.
      
      gcc/d/ChangeLog:
      
      	* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set
      	doing_semantic_analysis_p before calling functionSemantic3.
      
      gcc/testsuite/ChangeLog:
      
      	* gdc.dg/ctfeintrinsics.d: New test.
      8063de4a
    • Iain Buclaw's avatar
      libphobos: Add @nogc to gcc.backtrace and gcc.libbacktrace modules. · dfd39ed3
      Iain Buclaw authored
      libphobos/ChangeLog:
      
      	* libdruntime/gcc/backtrace.d (simpleErrorCallback): Add @nogc.
      	(LibBacktrace.initLibBacktrace): Likewise.
      	(LibBacktrace.this): Likewise.
      	(UnwindBacktrace.this): Likewise.
      	(getBacktrace): Likewise.
      	(getBacktraceSymbols): Likewise.
      	* libdruntime/gcc/libbacktrace.d.in (backtrace_create_state):
      	Likewise.
      	(backtrace_full): Likewise.
      	(backtrace_simple): Likewise.
      	(backtrace_print): Likewise.
      	(backtrace_pcinfo): Likewise.
      	(backtrace_syminfo): Likewise.
      dfd39ed3
    • Richard Biener's avatar
      tree-optimization/108691 - remove trigger-happy assert · 1dd033b8
      Richard Biener authored
      The following gets rid of the idea that we should prevent setjmp
      like calls from popping up in uncontrolled way in the IL for now.
      The solution is probably to handle it similar as noreturn has
      the ctrl-altering flag on stmts, but use another flag, for example
      ctrl-receiving which would also make sure the stmt is first.
      
      	PR tree-optimization/108691
      	* tree-ssa-dce.cc (eliminate_unnecessary_stmts): Remove
      	assert about calls_setjmp not becoming true when it was false.
      
      	* gcc.dg/pr108691.c: New testcase.
      1dd033b8
    • Richard Biener's avatar
      tree-optimization/108793 - niter compute type mismatch · a7e706df
      Richard Biener authored
      When computing the number of iterations until wrap types are mixed up,
      eventually leading to checking ICEs with a pointer bitwise inversion.
      The following uses niter_type for the calculation.
      
      	PR tree-optimization/108793
      	* tree-ssa-loop-niter.cc (number_of_iterations_until_wrap):
      	Use convert operands to niter_type when computing num.
      
      	* gcc.dg/torture/pr108793.c: New testcase.
      a7e706df
    • Thomas Schwinge's avatar
      Update copyright years. · e28c5b33
      Thomas Schwinge authored
      ... which accidentally had gotten reverted in recent
      commit r13-6156-g1e8eb102200902e12c1b00e867e338be0a92c292
      "gccrs: dump: Emit visibility when dumping items".
      e28c5b33
    • Raiki Tamura's avatar
      gccrs: add math intrinsics · ecb409b2
      Raiki Tamura authored
      gcc/rust/ChangeLog:
      
      	* backend/rust-builtins.cc (BuiltinsContext::setup_math_fns): New functions.
      
      gcc/testsuite/ChangeLog:
      
      	* rust/compile/torture/intrinsics-math.rs: New test.
      ecb409b2
    • Arthur Cohen's avatar
      gccrs: const evaluator: Remove get_nth_callarg · 064bbd0f
      Arthur Cohen authored
      We only used one path of the C++ folder's get_nth_callarg function:
      CALL_EXPR_ARG. Replace all calls to get_nth_callarg by macro calls to
      CALL_EXPR_ARG
      
      gcc/rust/ChangeLog:
      
      	* backend/rust-constexpr.cc (get_nth_callarg): Remove function.
      	(rs_bind_parameters_in_call): Use CALL_EXPR_ARG instead.
      	(potential_constant_expression_1): Likewise.
      064bbd0f
    • Thomas Schwinge's avatar
      gccrs: Repair 'gcc/rust/lang.opt' comment · b9203d82
      Thomas Schwinge authored
      ... lost in #1527 commit 138a6260124740208b8f3aff2e38617f43b05fe8
      "rust: Add -frust-compile-until option".
      
      gcc/rust/ChangeLog:
      
      	* lang.opt: Fix ordering of file.
      b9203d82
    • Philip Herron's avatar
      gccrs: Cleanup unused parameters to fix the bootstrap build · 9f455ed8
      Philip Herron authored
      gcc/rust/ChangeLog:
      
      	* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Remove unused parameters.
      	* backend/rust-constexpr.cc (constant_value_1): Likewise.
      	(fold_non_dependent_init): Likewise.
      	* backend/rust-tree.cc (publicly_uniquely_derived_p): Likewise.
      	(instantiation_dependent_expression_p): Likewise.
      	(type_has_nontrivial_copy_init): Likewise.
      	(is_normal_capture_proxy): Likewise.
      	(resolve_nondeduced_context): Likewise.
      	(undeduced_auto_decl): Likewise.
      	(require_deduced_type): Likewise.
      	* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
      	* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
      	* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::visit): Likewise.
      	* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
      	* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
      	* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
      	* checks/lints/rust-lint-unused-var.cc (unused_var_walk_fn): Likewise.
      	* expand/rust-macro-builtins.cc (try_expand_single_string_literal): Likewise.
      	(try_expand_many_expr): Likewise.
      	(parse_single_string_literal): Likewise.
      	(MacroBuiltin::assert_handler): Likewise.
      	(MacroBuiltin::file_handler): Likewise.
      	(MacroBuiltin::column_handler): Likewise.
      	(MacroBuiltin::concat_handler): Likewise.
      	(MacroBuiltin::env_handler): Likewise.
      	(MacroBuiltin::line_handler): Likewise.
      	* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
      	(ASTLoweringBase::handle_doc_item_attribute): Likewise.
      	* hir/rust-hir-dump.cc (Dump::visit): Likewise.
      	* hir/tree/rust-hir-full-test.cc (ConstGenericParam::accept_vis): Likewise.
      	* lex/rust-lex.cc (Lexer::parse_utf8_escape): Likewise.
      	(Lexer::parse_string): Likewise.
      	(Lexer::parse_char_or_lifetime): Likewise.
      	* lex/rust-lex.h: Likewise.
      	* metadata/rust-export-metadata.cc: Likewise.
      	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
      	* resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise.
      	(ResolveTypeToCanonicalPath::visit): Likewise.
      	* resolve/rust-ast-verify-assignee.h: Likewise.
      	* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
      	* typecheck/rust-hir-type-check-expr.h: Likewise.
      	* typecheck/rust-hir-type-check-item.h: Likewise.
      	* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
      	* typecheck/rust-tyty-rules.h: Likewise.
      	* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
      9f455ed8
    • Philip Herron's avatar
      gccrs: Skip this debug test case which is failing on the latest mac-os... · 03df9a04
      Philip Herron authored
      gccrs: Skip this debug test case which is failing on the latest mac-os devtools and its only for debug info
      
      gcc/testsuite/ChangeLog:
      
      	* rust/debug/chartype.rs: Skip testcases on Darwin architectures.
      03df9a04
    • Philip Herron's avatar
      gccrs: Fix undefined behaviour issues on macos · e7a69d45
      Philip Herron authored
      This adds missing copy constructors to HIR::PathExprSegment which were
      wrongly defaulting to empty vectors when apply specified generic arguments
      to method calls.
      
      gcc/rust/ChangeLog:
      
      	* hir/tree/rust-hir-expr.h: Add const `get_method_name`.
      	* hir/tree/rust-hir-full-decls.h (struct GenericArgs): Move from `struct`...
      	(class GenericArgs): ...to `class`.
      	* hir/tree/rust-hir-path.h (struct GenericArgs): Likewise.
      	(class GenericArgs): Clear `type_args` in copy constructor.
      	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Reorder
      	debug print.
      	* typecheck/rust-tyty.h: Add default constructors for `SubstitutionArgumentMappings`.
      e7a69d45
    • Philip Herron's avatar
      gccrs: Add initial support for argument capture of closures · 92389b46
      Philip Herron authored
      When we have a closure expression that captures a parent function's
      variable we must setup the closure data to contain this. Ignoring
      moveability and mutability requires for now, this patch creates the closure
      structure with fields for each of the captured variables. When it comes to
      compilation of the closure expression in order to support nested closures
      we must setup a context of implicit mappings so that for all path
      resolution we hit this implicit closure mappings lookups code before any
      lookup_var_decl as this decl will not exist so the order here is important
      during path resolution which is a similar problem to match expression
      destructuring.
      
      Fixes #195
      
      gcc/rust/ChangeLog:
      
      	* backend/rust-compile-context.cc (Context::push_closure_context): New function.
      	(Context::pop_closure_context): Likewise.
      	(Context::insert_closure_binding): Likewise.
      	(Context::lookup_closure_binding): Likewise.
      	* backend/rust-compile-context.h: Declare new functions and closure mappings.
      	* backend/rust-compile-expr.cc (CompileExpr::visit): Visit captures properly.
      	(CompileExpr::generate_closure_function): Compile captures properly.
      	* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Check for
      	closure bindings.
      	* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Compile capture list's
      	types as well.
      
      gcc/testsuite/ChangeLog:
      
      	* rust/execute/torture/closure3.rs: New test.
      92389b46
    • Philip Herron's avatar
      gccrs: Add capture tracking to the type info for closures · eb120222
      Philip Herron authored
      gcc/rust/ChangeLog:
      
      	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Pass captures
      	properly to `TyTy::ClosureType` constructor.
      	* typecheck/rust-tyty.cc (ClosureType::as_string): Fix string representation.
      	(ClosureType::clone): Pass `captures` argument.
      	* typecheck/rust-tyty.h: Add `captures` field.
      eb120222
    • Philip Herron's avatar
      gccrs: Add closure binding's tracking to name resolution · f7c258b2
      Philip Herron authored
      When we have a closure block referencing variables in a parent function,
      we must track what these are. We do this by having a context of closures
      so if we have a variable reference and its declared in a rib whose node id
      is less than the node id of the closure's node id we know it must be a
      captured variable. We also need to iterate all possible closure contexts
      as we might be in the case of a nested closure.
      
      Addresses #195
      
      gcc/rust/ChangeLog:
      
      	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Use proper closure
      	contexts.
      	* resolve/rust-name-resolver.cc (Scope::lookup_decl_type): New function.
      	(Scope::lookup_rib_for_decl): Likewise.
      	(Resolver::insert_resolved_name): Insert captured items.
      	(Resolver::push_closure_context): New function.
      	(Resolver::pop_closure_context): Likewise.
      	(Resolver::insert_captured_item): Likewise.
      	(Resolver::decl_needs_capture): Likewise.
      	(Resolver::get_captures): Likewise.
      	* resolve/rust-name-resolver.h: Declare new functions.
      f7c258b2
    • Philip Herron's avatar
      gccrs: Refactor name resolver to take a Rib::ItemType · 32a4659c
      Philip Herron authored
      This allows us to track the type of declaration that is stored within a
      Rib.
      
      gcc/rust/ChangeLog:
      
      	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add Rib argument.
      	(ResolveExpr::resolve_closure_param): Likewise.
      	* resolve/rust-ast-resolve-implitem.h: Likewise.
      	* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise.
      	(ResolveItem::visit): Likewise.
      	* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
      	* resolve/rust-ast-resolve-pattern.h: Likewise.
      	* resolve/rust-ast-resolve-stmt.h: Likewise.
      	* resolve/rust-ast-resolve-toplevel.h: Likewise.
      	* resolve/rust-ast-resolve-type.h: Likewise.
      	* resolve/rust-name-resolver.cc (Rib::lookup_decl_type): Likewise.
      	(Scope::insert): Likewise.
      	(Resolver::insert_builtin_types): Likewise.
      	* resolve/rust-name-resolver.h: Likewise.
      32a4659c
    • Philip Herron's avatar
      gccrs: Get rid of make builtin macro · 01af6693
      Philip Herron authored
      This macro is a mess and a helper method is much better for this case.
      
      gcc/rust/ChangeLog:
      
      	* resolve/rust-name-resolver.cc (MKBUILTIN_TYPE): Remove macro.
      	(Rib::Rib): Remove `mappings` field.
      	(Resolver::generate_builtins): Use `setup_builtin` instead of macro.
      	(Resolver::setup_builtin): New function.
      	* resolve/rust-name-resolver.h: Declare `setup_builtin`, add FIXME
      	comment.
      01af6693
    • Raiki Tamura's avatar
      gccrs: Improve lexer dump · 0ef795c3
      Raiki Tamura authored
      
      gcc/rust/ChangeLog:
      
      	* lex/rust-lex.cc (Lexer::Lexer): Add `dump_lex` boolean flag.
      	(Lexer::skip_token): Dump tokens if flag is enabled.
      	(Lexer::dump_and_skip): New function.
      	* lex/rust-lex.h: Include optional.h and declare functions.
      	* parse/rust-parse-impl.h (Parser::debug_dump_lex_output): Remove old
      	unused function.
      	* parse/rust-parse.h: Likewise.
      	* rust-session-manager.cc (Session::compile_crate): Pass lexer dump
      	option to lexer.
      	(Session::dump_lex): New function.
      	* util/rust-optional.h: Add missing constructor.
      
      Signed-off-by: default avatarRaiki Tamura <tamaron1203@gmail.com>
      0ef795c3
    • Dave's avatar
      gccrs: Remove default location. Add visibility location to create_* functions · 78c70a50
      Dave authored
      gcc/rust/ChangeLog:
      
      	* ast/rust-item.h: Remoe default location for Visibility class.
      	* parse/rust-parse-impl.h (Parser::parse_visibility): Pass proper location
      	when instantiating visibilities.
      78c70a50
    • Jakub Dupak's avatar
      gccrs: ast: Dump no comma after self in fn params if it is the last one · 567494f7
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      567494f7
    • Jakub Dupak's avatar
      gccrs: ast: Dump remove /* stmp */ comment to not clutter the dump · 0e44abb1
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Remove extraneous string when
      	dumping statements.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      0e44abb1
    • Jakub Dupak's avatar
      gccrs: ast: Remove unused include in rust-ast-dump.cc · ce13edd8
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc: Remove unused include.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      ce13edd8
    • Jakub Dupak's avatar
      gccrs: ast: Dump generic parameters · b8863414
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      	* ast/rust-ast-dump.h: Likewise.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      b8863414
    • Jakub Dupak's avatar
      gccrs: ast: Dump type param type · 1acb7e02
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      1acb7e02
    • Jakub Dupak's avatar
      gccrs: ast: Dump trait object type one bound · 0bb33cb5
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      0bb33cb5
    • Jakub Dupak's avatar
      gccrs: ast: Dump parenthesised type · e311e9b7
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      e311e9b7
    • Jakub Dupak's avatar
      gccrs: ast: Dump trait object type · 7ed4a0eb
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      7ed4a0eb
    • Jakub Dupak's avatar
      gccrs: ast: Dump impl trait type · 638f65b2
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      638f65b2
    • Jakub Dupak's avatar
      gccrs: ast: Dump impl trait type one bound · ca06115e
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      ca06115e
    • Jakub Dupak's avatar
      gccrs: ast: Dump bare function type · ae1f6b3a
      Jakub Dupak authored
      
      + Return FunctionQualifiers as ref to work in ast dump
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      	* ast/rust-ast-dump.h: Add missing getter declaration.
      	* ast/rust-ast-full-test.cc (BareFunctionType::as_string): Fix bare function
      	string representation.
      	* ast/rust-type.h (class BareFunctionType): Declare said getter.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      ae1f6b3a
    • Jakub Dupak's avatar
      gccrs: ast: Dump inferred type · ee0166fa
      Jakub Dupak authored
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
      
      Signed-off-by: default avatarJakub Dupak <dev@jakubdupak.com>
      ee0166fa
Loading