Skip to content

Commit

Permalink
[libc][stdfix] Use __FRACT_FBIT__ for fixed point support detection i…
Browse files Browse the repository at this point in the history
…nstead of compiler version. (#81820)

Now that `__FRACT_FBIT__` and related macros are added in
#81207, it is safer to use them
for fixed point support detection, so that codes that do not use fixed
point types will not fail to build when `-ffixed-point` is missing.
  • Loading branch information
lntue committed Feb 15, 2024
1 parent fcb5a98 commit 95e8a7c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libc/include/llvm-libc-macros/stdfix-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
#ifndef __LLVM_LIBC_MACROS_STDFIX_MACROS_H
#define __LLVM_LIBC_MACROS_STDFIX_MACROS_H

#ifdef __clang__
#if (!defined(__cplusplus) || (__clang_major__ >= 18))
#ifdef __FRACT_FBIT__
// _Fract and _Accum types are available
#define LIBC_COMPILER_HAS_FIXED_POINT
#endif // __cplusplus
#endif // __clang__
#endif // __FRACT_FBIT__

#ifdef LIBC_COMPILER_HAS_FIXED_POINT

Expand Down

0 comments on commit 95e8a7c

Please sign in to comment.