From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id 6FBDA38207EA; Mon, 7 Aug 2023 11:51:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FBDA38207EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691409107; bh=YomOYP9mVcs2VHyzYDH9ifBHYC3stwPjlGxeRfjWqMg=; h=From:To:Subject:Date:From; b=qCsLGw/QOoAeP5Hi6CCCTQycDhnMNaNdHTLUdoZi/RLHSYvEn8vxx0ihquHka7PJU K7OksDnmvU4HykI3l15G9TIGP2mjPiig63koa0S97B+HCmqOEGD6DM4Zx5M+CxeXOM eSsNK3nydJcbNstBazxzJ8JeJmlN3ufplJzmabAs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] : Decay expression passed to fallback X-Act-Checkin: newlib-cygwin X-Git-Author: John Baldwin X-Git-Refname: refs/heads/master X-Git-Oldrev: 3b4f6217c371cf70d5ec5137436cfa5892bb45e8 X-Git-Newrev: b12934540f17ba7c22923940e48bfbf02d0ae082 Message-Id: <20230807115147.6FBDA38207EA@sourceware.org> Date: Mon, 7 Aug 2023 11:51:47 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Db12934540f1= 7ba7c22923940e48bfbf02d0ae082 commit b12934540f17ba7c22923940e48bfbf02d0ae082 Author: John Baldwin Date: Thu Jan 26 16:28:22 2023 -0800 : Decay expression passed to fallback =20 version of __generic() =20 This ensures that __generic() more closely matches _Generic() when using the fallback version when _Generic() is not available (such as GCC). =20 Co-authored by: jrtc27 Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D38215 Diff: --- newlib/libc/include/sys/cdefs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdef= s.h index 720e70092..808498c50 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -328,6 +328,9 @@ * __generic(). Unlike _Generic(), this macro can only distinguish * between a single type, so it requires nested invocations to * distinguish multiple cases. + * + * Note that the comma operator is used to force expr to decay in + * order to match _Generic(). */ =20 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >=3D 201112L) || \ @@ -337,7 +340,7 @@ #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) #define __generic(expr, t, yes, no) \ __builtin_choose_expr( \ - __builtin_types_compatible_p(__typeof(expr), t), yes, no) + __builtin_types_compatible_p(__typeof((0, (expr))), t), yes, no) #endif =20 /*