forked from gcc-mirror/gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR libstdc++/84773 use aligned alloc functions for FreeBSD and MinGW …
…cross-compilers PR libstdc++/84773 PR libstdc++/83662 * crossconfig.m4: Check for aligned_alloc etc. on freebsd and mingw32. * configure: Regenerate. * include/c_global/cstdlib [_GLIBCXX_HAVE_ALIGNED_ALLOC] (aligned_alloc): Add using-declaration. * testsuite/18_support/aligned_alloc/aligned_alloc.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258468 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
redi
committed
Mar 12, 2018
1 parent
7d966c3
commit 147fd74
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (C) 2018 Free Software Foundation, Inc. | ||
// | ||
// This file is part of the GNU ISO C++ Library. This library is free | ||
// software; you can redistribute it and/or modify it under the | ||
// terms of the GNU General Public License as published by the | ||
// Free Software Foundation; either version 3, or (at your option) | ||
// any later version. | ||
|
||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License along | ||
// with this library; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
// { dg-options "-std=gnu++17" } | ||
// { dg-do run { target c++17 } } | ||
|
||
#include <cstdlib> | ||
#include <cstdint> | ||
#include <testsuite_hooks.h> | ||
|
||
void | ||
test01() | ||
{ | ||
#ifdef _GLIBCXX_HAVE_ALIGNED_ALLOC | ||
void* p = std::aligned_alloc(256, 1); | ||
if (p) | ||
{ | ||
VERIFY( (reinterpret_cast<std::uintptr_t>(p) % 256) == 0 ); | ||
std::free(p); | ||
} | ||
#endif | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
test01(); | ||
} |