diff --git a/ChangeLog b/ChangeLog index e4f304e366..d69bf1f51e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-09-22 Gabriel F. T. Gomes + + [BZ #22146] + math/math.h: Let fpclassify use the builtin in C++ mode, even + when optimazing for size. + 2017-09-22 Joseph Myers * csu/Makefile (generated): Do not add version-info.h. diff --git a/math/math.h b/math/math.h index 6c2ad97fb8..c6c289d5d2 100644 --- a/math/math.h +++ b/math/math.h @@ -432,7 +432,13 @@ enum /* Return number of classification appropriate for X. */ # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ \ - && !defined __OPTIMIZE_SIZE__ + && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus) + /* The check for __cplusplus allows the use of the builtin, even + when optimization for size is on. This is provided for + libstdc++, only to let its configure test work when it is built + with -Os. No further use of this definition of fpclassify is + expected in C++ mode, since libstdc++ provides its own version + of fpclassify in cmath (which undefines fpclassify). */ # define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE, \ FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x) # else