HomeFreeBSD

Remove unnecessary const and volatile qualifiers from __fp_type_select()

Description

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)

Details

Provenance
dimAuthored on Jul 14 2022, 11:20 AM
Reviewer
theraven
Differential Revision
D35815: Remove unnecessary const and volatile qualifiers from __fp_type_select()
Parents
rGc1d40a2daffa: Adjust dtnfsclient_unload() definition to avoid clang 15 warning
Branches
Unknown
Tags
Unknown