Bring in a collection of gcc and libstdc++ fixes and updates from head,
most of which are already in stable/10 and stable/9 for some time.

Requested by:	danfe
Tested by:	danfe and make universe

MFC r228328:
  Make it possible to use the debug versions of std::map and std::multimap
  with clang, by removing two unneeded using declarations.  Otherwise, you
  would get errors similar to:

  /usr/include/c++/4.2/debug/map.h:77:20: error: dependent using declaration resolved to type without 'typename'
	using _Base::value_compare;
		     ^

  N.B.: Take care when you actually use the debug versions of any
  libstdc++ header.  They are more likely to contain problems, because
  they are exercised far less often, and since the standard library
  complexity guarantees don't always apply anymore, compile times can
  drastically increase.

MFC r228474 (by ed):
  Add support for __COUNTER__.

  __COUNTER__ allows one to obtain incrementing (read: unique) numbers
  from the C preprocesor. This is useful when implementing things like a
  robust implementation of CTASSERT(), which currently fails when using
  it more than once on a single line of code. Probably not likely to cause
  any breakage, but still.

  __COUNTER__ was also added to GCC 4.3, but since that implementation is
  GPLv3 licensed, I took the liberty of implementing it without looking at
  any upstream sources. Therefore, this version is licensed under the same
  license as the rest of the code; GPLv2.

MFC r231336 (by kientzle):
  Implement -print-file-name=include (which is undocumented
  but used by some Linux boot loaders).  This option prints
  out the directory holding the include files needed by
  a freestanding program.  The default implementation of
  this doesn't work on FreeBSD because of the different
  include file layout.  But it's easy to implement:
  just return /usr/include (or the cross-compiling equivalent).

  Reviewed by:	kan

MFC r233193:
  Add explicit braces to avoid dangling else in stl_tree.h.  This silences
  the following warning produced by clang trunk:

    In file included from /usr/src/sbin/devd/devd.cc:91:
    In file included from /usr/obj/usr/src/tmp/usr/include/c++/4.2/map:64:
    /usr/obj/usr/src/tmp/usr/include/c++/4.2/bits/stl_tree.h:987:2: error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]
	    else
	    ^

MFC r241957:
  Fix several clang warnings in libstdc++, which were exposed by the
  recent atf import.  These changes are purely cosmetic, no functional
  change.

MFC r244776 (by pfg):
  gcc: avoid generating negative values to DW_AT_byte_size.

  There is a bug in gcc (GCC/35998) where dwarf reports
  sizes of unsigned -1 (0xffffffff).

  On NetBSD this generated a faulty CTF entry which then
  caused a segfault in ctfmerge. The issue was worked
  around in NetBSD's Dtrace but since the issue originated
  in gcc, it seems reasonable to fix it here.

  Upstream gcc has been slow to react to this issue and
  the author that submitted the patch is not interested
  in licensing the change to us, so I did an independent
  workaround for the issue.

MFC r251212 (by pfg):
  GCC: bring back experimental support for amdfam10/barcelona CPUs.

  Initial support for the AMD amdfam10 chipsets has been available in the
  gcc43 branch under GPLv2. AMD and some linux distributions (OpenSUSE) did
  a backport of the amdfam10 support and made it available.

  This is a revised subset of the support initially brought in in r236962
  and later reverted. The collateral efects seem to have disappeared but
  it is still recommended to set the CPUTYPE with caution.

  Reviewed by:	jkim (ages ago)

MFC r258017 (by pfg):
  cxxfilt: small changes from Apple's developer tools

  From Apple's Developer Tools 4.0 [1]:

  demangle.patch
  2007-05-05  Geoffrey Keating
	  (d_name): Detect local-source-name.
	  (d_prefix): Likewise.
	  (d_unqualified_name): Implement local-source-name.

  libiberty-printf.patch

  [1] http://opensource.apple.com/source/cxxfilt/cxxfilt-9/patches/

MFC r258429 (by pfg):
  libstdc++: merge non-abi changes from Apple's developer tools

  Take some changes from Apple's Developer Tools 4.0 [1]:

  block.patch
  emergency-buffer-reduction.patch
  test_cleanup.patch

  vector_copy_no_alloc.patch
	  problem/6473222 copy-constructing a std::vector	from an
	  empty std::vector calls malloc

  2008-10-27  Howard Hinnant
  stl_tree_system_header.patch
	  Added #pragma GCC system_header to stl_tree.h.
  copy_doc.patch
	  Corrected documentation concerning copy in stl_algobase.h.
  string_compare.patch
	  Fixed basic_string.h, basic_string.tcc, incorrect 64bit to
	  32bit narrowing.

  Reference:

  [1] http://opensource.apple.com/source/libstdcxx/libstdcxx-39/patches-4.2.1/

  Obtained from:	Apple

MFC r258501 (by pfg):
  gcc: Bring updates from Google's enhanced gcc-4.2.1.

  Google released and enhanced version of gcc-4.2.1 plus their local
  patches for Android[1].

  The patches are owned by Google and the license hasn't been changed
  from  the original GPLv2. We are only bringing a subset of the
  available patches that may be helpful in FreeBSD. Changes specific
  to android are not included.

  From the README.google file[1].

  Patches applied to google_vendor_src_branch/gcc/gcc-4.2.1:

  gcc/Makefile.in
  gcc/c-common.c
  gcc/c-common.h
  gcc/c-opts.c
  gcc/c-typeck.c
  gcc/cp/typeck.c
  gcc/doc/invoke.texi
  gcc/flags.h
  gcc/opts.c
  gcc/tree-flow.h
  gcc/tree-ssa-alias-warnings.c
  gcc/tree-ssa-alias.c

   Backport of -Wstrict-aliasing from mainline.
    Silvius Rus <rus@google.com>

  gcc/coverage.c:
    Patch coverage_checksum_string for PR 25351.
    Seongbae Park <spark@google.com>
    Not yet submitted to FSF.

  gcc/c-opts.c
  gcc/c-ppoutput.c
  gcc/c.opt
  gcc/doc/cppopts.texi
  libcpp/Makefile.in
  libcpp/directives-only.c
  libcpp/directives.c
  libcpp/files.c
  libcpp/include/cpplib.h
  libcpp/init.c
  libcpp/internal.h
  libcpp/macro.c
    Support for -fdirectives-only.
    Ollie Wild <aaw@google.com>.
    Submitted to FSF but not yet approved.

  libstdc++-v3/include/ext/hashtable.h
    http://b/742065
    http://b/629994
    Reduce min size of hashtable for hash_map, hash_set from 53 to 5

  libstdc++-v3/include/ext/hashtable.h
    http://b/629994
    Do not iterate over buckets if hashtable is empty.

  gcc/common.opt
  gcc/doc/invoke.texi
  gcc/flags.h
  gcc/gimplify.c
  gcc/opts.c
    Add Saito's patch for -finstrument-functions-exclude-* options.

  gcc/common.opt
  gcc/doc/invoke.texi
  gcc/final.c
  gcc/flags.h
  gcc/opts.c
  gcc/testsuite/gcc.dg/Wframe-larger-than.c
    Add a new flag -Wframe-larger-than- which enables a new warning
    when a frame size of a function is larger than specified.
    This patch hasn't been integrated into gcc mainline yet.

  gcc/tree-vrp.c
    Add a hack to avoid using ivopts information for pointers starting
    at constant values.

  Reference:

  [1]
  https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.2.1/

  Obtained from:	Google Inc.

MFC r258507 (by pfg):
  gcc: Missing makefile changes for r258501.

  pointyhat:	me

MFC r258530 (by pfg):
  libcpp: Keep a record of changes from upstream GCC (pre-43).

  This makes it easier to track the changes in the rare event of the code
  being distributed without access to version control.

MFC r258651 (by pfg):
  gcc: Altivec register adjustments from Apple.

  Obtained from:	gcc pre-4.3 (rev. 124763; GPLv2)

MFC r258658 (by mdf):
  Fix a segfault / internal compiler error.

  Among other causes, when gcc throws a warning before parsing any tokens,
  the cur_token pointer is at the beginning of malloc'd memory.
  Dereferencing cur_token[-1] can cause a segfault.

  Code taken from OpenBSD
  http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/gcc/libcpp/errors.c
  which was a more complete fix than the one I originally coded.

MFC r258731 (by pfg):
  gcc: Make use of TREE_OVERFLOW_P.

  While it was brought in r258179 only to fix a build issue,
  bringing the rest of the change has the advantage of fixing
  GCC/19978.

  Obtained from:	gcc 4.3 (rev. 120505; GPLv2)

MFC r258748 (by pfg):
  gcc: upstream alignment cleanups.

  This solves GCC/32617 and contributes to reduce differences with
  Apple's gcc42.

  Complete some references in the ChangeLog while here.

  Obtained from:	gcc 4.3 (rev. 126529, 126588; GPLv2)

MFC r258817 (by pfg):
  libiberty: upstream updates.

  There is a new ChangeLog.gcc43 file but most notable:

  * floatformat.c (get_field): Fix segfault with little-endian word
    order on 64-bit hosts.
    (put_field): Likewise.
    (min): Move definition.

  gcc/cp/ChangeLog
  2007-05-04  Geoffrey Keating  <geoffk@apple.com>

    PR 31775
    * mangle.c (write_mangled_name): Mangle static variable names.
    (write_unqualified_name): Use local-source-name for
    namespace-scope static variables.
  (Completes FreeBSD's r258017 )

  Obtained from:	gcc 4.3 (rev. 118552, 120097, 20698, 120702,
			   121364, 122972, 126588; GPLv2)

MFC r258826 (by pfg):
  libcpp: Merge fixes from upstream

  GCC preprocessor/29966:
  * macro.c (lex_expansion_token): Save and restore cpp_reader's
  cur_token.
  (_cpp_create_definition): Don't restore cur_token here.
  * lex.c (_cpp_lex_token): Added assertion.

  GCC preprocessor/28709:
  * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.

  GCC c/31924
  * expr.c (interpret_float_suffix): Check for invalid suffix.

  GCC preprocessor/14331
  * lex.c (_cpp_get_fresh_line):  Don't warn if no newline at EOF.

  Fixup whitespacing

  Obtained from:	gcc per-4.3 (rev. 121340, 124356, 124358, 124730,
				    125212, 125255 ; GPLv2)

MFC r258943 (by pfg):
  gcc: On rs6000 update sp_offset depending only on size.

  This fixes a nasty bug introduced in r258651.

  Reported and tested by:	Justin Hibbits
  Obtained from:		gcc pre-4.3 (rev. 125116; GPLv2)

MFC r259005 (by pfg):
  gcc: Add -flax-vector-conversions

  Obtained from:	gcc 4.3 (rev. 120572, 120688; GPLv2)

MFC r259022 (by pfg):
  gcc: Include types in error message for build_binary_op.

  Mostly cosmetic change, again to reduce differences with Apple's gcc.

  Obtained from:	gcc 4.3 (rev. 125239; GPLv2)

MFC r259092 (by pfg):
  gcc: new fvisibility-ms-compat option

  Obtained from:	gcc 4.3 (rev. 126088; GPLv2)

MFC r259111:
  Use correct casts in gcc's emmintrin.h for the first arguments of the
  following builtin functions:

  * __builtin_ia32_pslldi128() takes __v4si instead of __v8hi
  * __builtin_ia32_psllqi128() takes __v2di instead of __v8hi
  * __builtin_ia32_psradi128() takes __v4si instead of __v8hi

  This should fix the following errors when building the LINT kernel with
  gcc:

  sys/crypto/aesni/aesni_wrap.c:191: error: incompatible type for argument 1 of
  '__builtin_ia32_psradi128'
  sys/crypto/aesni/aesni_wrap.c:195: error: incompatible type for argument 1 of
  '__builtin_ia32_pslldi128'

MFC r259525 (by pfg):
  gcc: fix ICE in rs600 when using -fno-trapping-math.

  Solves GCC-PR target/30485

  Obtained from:	gcc 4.3 (rev. 120902; GPLv2)

MFC r259529 (by pfg):
  gcc: small merges from upstream

  Solves GCC issues:
  PR middle-end/32602
  PR middle-end/32603

  Updates the to documentation and processing
  improvement.

  Obtained from:	gcc 4.3 (rev. 119427, 126278, 126422; GPLv2)

MFC r259555 (by pfg):
  gcc: add Apple compatible -Wnewline-eof

  GCC 4.2 and previous have always warned about
  "No newline at end of file".

  Upstream GCC removed the warning completely but
  Apple made it an optional warning. Adopt it for
  compatibility with older GCC and clang.

  While here, add comment to complement r258712.

  Obtained from:	Apple Inc. (Apple GCC 4.2 - 5531)

MFC r259558 (by pfg):
  gcc: add Apple compatible -Wnewline-eof

  Fix document: "Apple compatible" suits better the origin.

MFC r259649 (by pfg):
  gcc: more diff reductions against Apple GCC.

  Mostly cosmetical changes to aid further merges.

  Obtained from:	gcc 4.3 (rev. 120611, 124839; GPLv2)

MFC r259655 (by pfg):
  gcc: merge upstream fix and new feature.

  Fix for PR c++/29928

  Add support for Rvalue references as described here:
  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html

  Obtained from:	gcc 4.3 (rev. 124724, 125211; GPLv2)

MFC r259660 (by pfg):
  gcc: revert Rvalue references.

  They are very useful but at this time I prefer not to figure out
  some  minor conflicts with the bigger Apple's blocks support
  patch that is being worked on for current.

MFC r259841 (by pfg):
  gcc:  Add ability to generate DWARF pubtypes section if
  DEBUG_PUBTYPES_SECTION is defined.

  Obtained from:	gcc 4.3 (rev. 118826; GPLv2)

MFC r259873 (by pfg):
  gcc: small enhancements for the arm support.

  Very small updates: fixes GCC-PR target/31152

  Tested by building the cross-compiler.

  Obtained from:	gcc 4.3 (rev. r118461, 125973: GPLv2)

MFC r259944 (by pfg):
  gcc: merge small upstream change.

  Backport from mainline:
  2007-04-24  Hui-May Chang <hm.chang@apple.com>

  * reload1.c (merge_assigned_reloads) : Do not merge a RELOAD_OTHER
  instruction with a RELOAD_FOR_OPERAND_ADDRESS instruction.

  Obtained from:	gcc 4.3 (rev. r124115: GPLv2)

MFC r260014 (by pfg):
  gcc: Add support for label attributes and "unavailable" attribute.

  Apple GCC has extensions to support for both label attributes and
  an "unavailable" attribute. These are critical for objc but are
  also useful in regular C/C++.

  Apparently at least the label attributes might have found their way to
  upstream GCC but the code doesn't seem available on the GPLv2 tree so
  we are taking the code directly from Apple. To make this clearer we
  are preserving the annoying "APPLE LOCAL" tags and the ChangeLogs
  when they are available.

  Obtained from:	Apple GCC 4.2 - 5531

MFC r260099 (by pfg):
  gcc: Fix issue with "unavailable" attribute.

  While here, point where we dropped the support for objc from r260014.

MFC r260310 (by pfg):
  libcpp: misc fixes from Apple's GCC.

  Fixes some bugs detected by Apple:
  #error with unmatched quotes
  pragma mark

  Obtained from:	Apple GCC 4.2 - 5553

MFC r263775:
  Avoid "cc1: warning: is shorter than expected" when using GNU cpp in
  combination with dtrace scripts, which have "#!/usr/sbin/dtrace -Cs"
  shebang lines.  This is because dtrace positions the file pointer after
  the shebang line, before passing the file to GNU cpp.

  To fix the warning, adjust the size downwards by the current position,
  after a bit of sanity checking.

  Suggested by:	avg

MFC r269948:
  Supplement r259111 by also using correct casts in gcc's emmintrin.h for
  the first argument of the following builtin function:

  * __builtin_ia32_psrlqi128() takes __v2di instead of __v4si

  This should fix the following errors when building the graphics/webp
  port with base gcc:

  lossless_sse2.c:403: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'
  lossless_sse2.c:404: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'

  Reported by:	Jos Chrispijn <ports@webrz.net>