1. 28 Nov, 2018 32 commits
  2. 27 Nov, 2018 8 commits
    • re PR c++/88187 (ICE on (invalid) C++ code when compiled with -std=c++17: Segmentation fault) · d1a27eae
      	PR c++/88187
      	* decl.c (grokdeclarator): Don't diagnose deduction guide errors
      	if !funcdecl_p.
      
      	* g++.dg/other/pr88187.C: New test.
      
      From-SVN: r266537
      Jakub Jelinek committed
    • compiler: tweaks for importing inline function bodies · 08e10724
          
          Track whether we've seen an error when importing a function; we will
          use error tracking to avoid knock-on errors.
          
          Stop importing identifiers at a ')'.
          
          Provide a way to adjust the indentation level while importing.
          
          Reviewed-on: https://go-review.googlesource.com/c/150072
      
      From-SVN: r266536
      Ian Lance Taylor committed
    • Clean up temporary files created by std::filesystem testsuite · c718ff41
      	* testsuite/27_io/filesystem/operations/canonical.cc: Remove
      	directory created by test.
      	* testsuite/27_io/filesystem/operations/symlink_status.cc: Remove
      	symlink created by test.
      
      From-SVN: r266535
      Jonathan Wakely committed
    • compiler: record final type for numeric expressions · 9b4e458b
          
          Inlinable function bodies are generated after the determine_types pass,
          so we know the type for all constants.  Rather than try to determine
          it again when inlining, record the type in the export data, using a
          $convert expression.  Reduce the number of explicit $convert
          expressions by recording a type context with the expected type in
          cases where that type is known.
          
          Reviewed-on: https://go-review.googlesource.com/c/150071
      
      From-SVN: r266534
      Ian Lance Taylor committed
    • PR libstdc++/67843 set shared_ptr lock policy at build-time · da29d2a3
      This resolves a longstanding issue where the lock policy for shared_ptr
      reference counting depends on compilation options when the header is
      included, so that different -march options can cause ABI changes. For
      example, objects compiled with -march=armv7 will use atomics to
      synchronize reference counts, and objects compiled with -march=armv5t
      will use a mutex. That means the shared_ptr control block will have a
      different layout in different objects, causing ODR violations and
      undefined behaviour. This was the root cause of PR libstdc++/42734 as
      well as PR libstdc++/67843.
      
      The solution is to decide on the lock policy at build time, when
      libstdc++ is configured. The configure script checks for the
      availability of the necessary atomic built-ins for the target and fixes
      that choice permanently. Different -march flags used to compile user
      code will not cause changes to the lock policy. This results in an ABI
      change for certain compilations, but only where there was already an ABI
      incompatibility between the libstdc++.so library and objects built with
      an incompatible -march option. In general, this means a more stable ABI
      that isn't silently altered when -march flags make addition atomic ops
      available.
      
      To force a target to use "atomic" or "mutex" the new configure option
      --with-libstdcxx-lock-policy can be used.
      
      In order to turn ODR violations into linker errors, the uses of
      shared_ptr in filesystem directory iterators have been replaced
      with __shared_ptr, and explicit instantiations are declared. This
      ensures that object files using those types cannot link to libstdc++
      libs unless they use the same lock policy.
      
      	PR libstdc++/67843
      	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Add new macro
      	that defines _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY.
      	* config.h.in: Regenerate.
      	* configure: Regenerate.
      	* configure.ac: Use GLIBCXX_ENABLE_LOCK_POLICY.
      	* doc/xml/manual/configure.xml: Document new configure option.
      	* include/bits/fs_dir.h (directory_iterator): Use __shared_ptr
      	instead of shared_ptr.
      	(recursive_directory_iterator): Likewise.
      	(__shared_ptr<_Dir>): Add explicit instantiation declaration.
      	(__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise.
      	* include/bits/shared_ptr_base.h (__allocate_shared, __make_shared):
      	Add default template argument for _Lock_policy template parameter.
      	* include/ext/concurrence.h (__default_lock_policy): Check macro
      	_GLIBCXX_HAVE_ATOMIC_LOCK_POLICY instead of checking if the current
      	target supports the builtins for compare-and-swap.
      	* src/filesystem/std-dir.cc (__shared_ptr<_Dir>): Add explicit
      	instantiation definition.
      	(__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise.
      	(directory_iterator, recursive_directory_iterator): Use __make_shared
      	instead of make_shared.
      
      From-SVN: r266533
      Jonathan Wakely committed
    • compiler: add result parameter names for inlinable functions · b07b0671
          
          An inlinable function body may need to refer to result parameters, so
          each result parameter needs a name.  We already give them all names in
          start_function (via create_result_variables).  Change the export data
          so that for an inlinable function we use those names for the function
          declaration's result parameters.
          
          Reviewed-on: https://go-review.googlesource.com/c/150070
      
      From-SVN: r266532
      Ian Lance Taylor committed
    • compiler: finalize types parsed for inline functions · 34ea9597
          
          When we inline functions, we may parse types that we have not seen
          before inlining.  Inlining runs after the finalize_methods pass, so
          those types will not be finalized, meaning that we don't have an
          accurate list of which methods they support.  Explicitly finalize them
          when we parse them.
          
          Reviewed-on: https://go-review.googlesource.com/c/150068
      
      From-SVN: r266530
      Ian Lance Taylor committed