Date: Sat, 28 Sep 2019 09:54:03 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352840 - head/sys/sys Message-ID: <201909280954.x8S9s3i6071997@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sat Sep 28 09:54:03 2019 New Revision: 352840 URL: https://svnweb.freebsd.org/changeset/base/352840 Log: Fix Q_TOSTR(3) with GCC when it's called with first parameter being const. Discussed with: cem MFC after: 2 weeks Sponsored by: Klara Inc, Netflix Differential Revision: https://reviews.freebsd.org/D21766 Modified: head/sys/sys/qmath.h Modified: head/sys/sys/qmath.h ============================================================================== --- head/sys/sys/qmath.h Sat Sep 28 09:50:01 2019 (r352839) +++ head/sys/sys/qmath.h Sat Sep 28 09:54:03 2019 (r352840) @@ -58,11 +58,16 @@ typedef uint64_t u64q_t; typedef s64q_t smaxq_t; typedef u64q_t umaxq_t; +#if defined(__GNUC__) +/* Ancient GCC hack to de-const, remove when GCC4 is removed. */ +#define Q_BT(q) __typeof(1 * q) +#else /* The underlying base type of 'q'. */ #define Q_BT(q) __typeof(q) +#endif /* Type-cast variable 'v' to the same underlying type as 'q'. */ -#define Q_TC(q, v) ((Q_BT(q))(v)) +#define Q_TC(q, v) ((__typeof(q))(v)) /* Number of total bits associated with the data type underlying 'q'. */ #define Q_NTBITS(q) ((uint32_t)(sizeof(q) << 3))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909280954.x8S9s3i6071997>