Add support for C++17 operator new/delete for overaligned types.

- Add auto-detection of std::align_val_t presence to configure scripts. This
  indicates that the compiler supports C++17 operator new/delete overloads
  for overaligned types.

- Add auto-detection of -faligned-new compiler option that appeared in gcc 7.
  The option allows the compiler to generate calls to the new operators. It is
  needed for tests.

- Added overrides for the new operators. The overrides are enabled if the
  support for std::align_val_t has been detected. The implementation is mostly
  based on the infrastructure used by memalign, which had to be extended to
  support being used by C++ operators in addition to C functions. In particular,
  the debug version of the library has to distinguish memory allocated by
  memalign from that by operator new. The current implementation of sized
  overaligned delete operators do not make use of the supplied size argument
  except for the debug allocator because it is difficult to calculate the exact
  allocation size that was used to allocate memory with alignment. This can be
  done in the future.

- Removed forward declaration of std::nothrow_t. This was not portable as
  the standard library is not required to provide nothrow_t directly in
  namespace std (it could use e.g. an inline namespace within std). The <new>
  header needs to be included for std::align_val_t anyway.

- Fixed operator delete[] implementation in libc_override_redefine.h.

- Moved TC_ALIAS definition to the beginning of the file in tcmalloc.cc so that
  the macro is defined before its first use in nallocx.

- Added tests to verify the added operators.

[alkondratenko@gmail.com: fixed couple minor warnings, and some
whitespace change]
[alkondratenko@gmail.com: removed addition of TC_ALIAS in debug allocator]
Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
10 files changed