stdcxx: define _GLIBCXX11_USE_C99_STDLIB

Fixes #2652
This commit is contained in:
Christian Prochaska 2018-01-22 14:40:04 +01:00 committed by Norman Feske
parent fe6f616cf1
commit d0eacdd0d6
3 changed files with 16 additions and 1 deletions

View File

@ -1361,7 +1361,7 @@ namespace std
/* Define if C99 functions or macros in <stdlib.h> should be imported in /* Define if C99 functions or macros in <stdlib.h> should be imported in
<cstdlib> in namespace std for C++11. */ <cstdlib> in namespace std for C++11. */
/* #undef _GLIBCXX11_USE_C99_STDLIB */ #define _GLIBCXX11_USE_C99_STDLIB 1
/* Define if C99 functions or macros in <wchar.h> should be imported in /* Define if C99 functions or macros in <wchar.h> should be imported in
<cwchar> in namespace std for C++11. */ <cwchar> in namespace std for C++11. */

View File

@ -34,3 +34,16 @@ build_boot_image {
append qemu_args " -nographic " append qemu_args " -nographic "
run_genode_until ".*test-stdcxx finished.*\n" 20 run_genode_until ".*test-stdcxx finished.*\n" 20
grep_output {^\[init }
compare_output_to {
[init -> test-stdcxx] ° °° °°° test-stdcxx started °°° °° °
[init -> test-stdcxx] 2015.000000 - 5.000000 - 4
[init -> test-stdcxx] 2015 - 5 - 4
[init -> test-stdcxx] 123
[init -> test-stdcxx] 456
[init -> test-stdcxx] 7.8
[init -> test-stdcxx] caught std::invalid_argument
[init -> test-stdcxx] ° °° °°° test-stdcxx finished °°° °° °
}

View File

@ -48,6 +48,8 @@ static void test_cstdlib()
{ {
static ::lldiv_t o __attribute__((used)); static ::lldiv_t o __attribute__((used));
std::cout << std::strtoul("123", 0, 10) << std::endl; std::cout << std::strtoul("123", 0, 10) << std::endl;
std::cout << std::stoi("456") << std::endl;
std::cout << std::stod("7.8") << std::endl;
} }