From owner-svn-src-head@FreeBSD.ORG Sat Jul 13 10:10:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC92F172; Sat, 13 Jul 2013 10:10:45 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B39C31979; Sat, 13 Jul 2013 10:10:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6DAAjVp078368; Sat, 13 Jul 2013 10:10:45 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6DAAjrL078366; Sat, 13 Jul 2013 10:10:45 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201307131010.r6DAAjrL078366@svn.freebsd.org> From: David Chisnall Date: Sat, 13 Jul 2013 10:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253319 - head/lib/msun/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2013 10:10:45 -0000 Author: theraven Date: Sat Jul 13 10:10:45 2013 New Revision: 253319 URL: http://svnweb.freebsd.org/changeset/base/253319 Log: Ensure that the _Generic() macro in math.h works with qualified types. tgmath.h contains the same bugs and so should be fixed in the same way. Modified: head/lib/msun/src/math.h Modified: head/lib/msun/src/math.h ============================================================================== --- head/lib/msun/src/math.h Sat Jul 13 08:17:55 2013 (r253318) +++ head/lib/msun/src/math.h Sat Jul 13 10:10:45 2013 (r253319) @@ -83,22 +83,31 @@ extern const union __nan_un { #if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \ __has_extension(c_generic_selections) -#define __fp_type_select(x, f, d, ld) _Generic((x), \ - float: f(x), \ - double: d(x), \ - long double: ld(x)) +#define __fp_type_select(x, f, d, ld) _Generic((x), \ + float: f(x), \ + double: d(x), \ + long double: ld(x), \ + volatile float: f(x), \ + volatile double: d(x), \ + volatile long double: ld(x), \ + volatile const float: f(x), \ + volatile const double: d(x), \ + volatile const long double: ld(x), \ + const float: f(x), \ + const double: d(x), \ + const long double: ld(x)) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) -#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \ - __builtin_types_compatible_p(__typeof(x), long double), ld(x), \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(__typeof(x), double), d(x), \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0))) +#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof(x), long double), ld(x), \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof(x), double), d(x), \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0))) #else -#define __fp_type_select(x, f, d, ld) \ - ((sizeof(x) == sizeof(float)) ? f(x) \ - : (sizeof(x) == sizeof(double)) ? d(x) \ - : ld(x)) +#define __fp_type_select(x, f, d, ld) \ + ((sizeof(x) == sizeof(float)) ? f(x) \ + : (sizeof(x) == sizeof(double)) ? d(x) \ + : ld(x)) #endif #define fpclassify(x) \ @@ -189,21 +198,21 @@ int __signbitf(float) __pure2; int __signbitl(long double) __pure2; static __inline int -__inline_isnan(double __x) +__inline_isnan(__const double __x) { return (__x != __x); } static __inline int -__inline_isnanf(float __x) +__inline_isnanf(__const float __x) { return (__x != __x); } static __inline int -__inline_isnanl(long double __x) +__inline_isnanl(__const long double __x) { return (__x != __x);