Date: Sat, 23 Jul 2022 08:58:16 GMT From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 8432a5a4fa3c - stable/13 - Remove unnecessary const and volatile qualifiers from __fp_type_select() Message-ID: <202207230858.26N8wG7W012582@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=8432a5a4fa3c4f34acf6136a9077b9ab7bbd723e commit 8432a5a4fa3c4f34acf6136a9077b9ab7bbd723e Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2022-07-14 11:20:52 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2022-07-23 08:56:44 +0000 Remove unnecessary const and volatile qualifiers from __fp_type_select() Since https://github.com/llvm/llvm-project/commit/ca75ac5f04f2, clang 15 has a new warning about _Generic selection expressions, such as used in math.h: lib/libc/gdtoa/_ldtoa.c:82:10: error: due to lvalue conversion of the controlling expression, association of type 'volatile float' will never be selected because it is qualified [-Werror,-Wunreachable-code-generic-assoc] switch (fpclassify(u.e)) { ^ lib/msun/src/math.h:109:2: note: expanded from macro 'fpclassify' __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl) ^ lib/msun/src/math.h:85:14: note: expanded from macro '__fp_type_select' volatile float: f(x), \ ^ This is because the controlling expression always undergoes lvalue conversion first, dropping any cv-qualifiers. The 'const', 'volatile', and 'volatile const' associations will therefore never be used. MFC after: 1 week Reviewed by: theraven Differential Revision: https://reviews.freebsd.org/D35815 (cherry picked from commit e50027e38d4f93887691f87b024e0abf37e98c78) --- lib/msun/src/math.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index 98601f825bbe..a0edea04dde2 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -81,16 +81,7 @@ extern const union __nan_un { #define __fp_type_select(x, f, d, ld) __extension__ _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)) + 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), \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207230858.26N8wG7W012582>