From fcb21722028937ea297b52f2ec3ffbcc8f49d163 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 22 Jul 2011 12:06:08 -0400 Subject: [PATCH] re PR c++/49813 ([C++0x] sinh vs asinh vs constexpr) PR c++/49813 * c-opts.c (set_std_cxx0x): Set flag_isoc94 and flag_isoc99. * c-pretty-print.c (pp_c_cv_qualifiers): Check c_dialect_cxx as well as flag_isoc99 for 'restrict'. (pp_c_specifier_qualifier_list): Likewise for _Complex. From-SVN: r176635 --- gcc/c-family/ChangeLog | 8 ++++++++ gcc/c-family/c-opts.c | 3 +++ gcc/c-family/c-pretty-print.c | 6 ++++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/opt/builtins2.C | 11 +++++++++++ gcc/testsuite/g++.dg/other/error27.C | 12 ++++++------ 6 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/builtins2.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 8af431e2930..167ba510c9b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2011-07-22 Jason Merrill + + PR c++/49813 + * c-opts.c (set_std_cxx0x): Set flag_isoc94 and flag_isoc99. + * c-pretty-print.c (pp_c_cv_qualifiers): Check c_dialect_cxx as well + as flag_isoc99 for 'restrict'. + (pp_c_specifier_qualifier_list): Likewise for _Complex. + 2011-07-21 Ian Lance Taylor PR middle-end/49705 diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 5cf58acd62d..3227f7b9860 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1488,6 +1488,9 @@ set_std_cxx0x (int iso) flag_no_gnu_keywords = iso; flag_no_nonansi_builtin = iso; flag_iso = iso; + /* C++0x includes the C99 standard library. */ + flag_isoc94 = 1; + flag_isoc99 = 1; cxx_dialect = cxx0x; } diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 977f79ed7df..53d39d643d0 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -205,7 +205,8 @@ pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type) { if (previous) pp_c_whitespace (pp); - pp_c_ws_string (pp, flag_isoc99 ? "restrict" : "__restrict__"); + pp_c_ws_string (pp, (flag_isoc99 && !c_dialect_cxx () + ? "restrict" : "__restrict__")); } } @@ -476,7 +477,8 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t) case VECTOR_TYPE: case COMPLEX_TYPE: if (code == COMPLEX_TYPE) - pp_c_ws_string (pp, flag_isoc99 ? "_Complex" : "__complex__"); + pp_c_ws_string (pp, (flag_isoc99 && !c_dialect_cxx () + ? "_Complex" : "__complex__")); else if (code == VECTOR_TYPE) { pp_c_ws_string (pp, "__vector"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 61a244017ce..edb8c7205a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-07-22 Jason Merrill + + PR c++/49813 + * g++.dg/opt/builtins2.C: New. + * g++.dg/other/error27.C: Don't rely on __builtin. + 2011-07-22 H.J. Lu * gcc/testsuite/gcc.target/i386/avx-vzeroupper-16.c: Only run diff --git a/gcc/testsuite/g++.dg/opt/builtins2.C b/gcc/testsuite/g++.dg/opt/builtins2.C new file mode 100644 index 00000000000..00a28dbc1bf --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/builtins2.C @@ -0,0 +1,11 @@ +// PR c++/49813 +// We should handle asinh as a built-in in C++0x mode, even when strict. +// { dg-options "-std=c++0x" } +// { dg-final { scan-assembler-not "asinh" } } + +#include + +int main() +{ + double das = asinh(1.0); +} diff --git a/gcc/testsuite/g++.dg/other/error27.C b/gcc/testsuite/g++.dg/other/error27.C index de97428571b..ef1e5906b6b 100644 --- a/gcc/testsuite/g++.dg/other/error27.C +++ b/gcc/testsuite/g++.dg/other/error27.C @@ -4,10 +4,10 @@ void foo (double x, double y) { - __builtin_isgreater(x, y)(); // { dg-error "__builtin_\[^\n\]*cannot be used as a function" } - __builtin_isless(x, y)(); // { dg-error "__builtin_\[^\n\]*cannot be used as a function" } - __builtin_isgreaterequal(x, y)(); // { dg-error "__builtin_\[^\n\]*cannot be used as a function" } - __builtin_islessequal(x, y)(); // { dg-error "__builtin_\[^\n\]*cannot be used as a function" } - __builtin_isunordered(x, y)(); // { dg-error "__builtin_\[^\n\]*cannot be used as a function" } - __builtin_islessgreater(x, y)(); // { dg-error "__builtin_\[^\n\]*cannot be used as a function" } + __builtin_isgreater(x, y)(); // { dg-error "cannot be used as a function" } + __builtin_isless(x, y)(); // { dg-error "cannot be used as a function" } + __builtin_isgreaterequal(x, y)(); // { dg-error "cannot be used as a function" } + __builtin_islessequal(x, y)(); // { dg-error "cannot be used as a function" } + __builtin_isunordered(x, y)(); // { dg-error "cannot be used as a function" } + __builtin_islessgreater(x, y)(); // { dg-error "cannot be used as a function" } } -- 2.30.2