[libc-commits] [libc] 95e8a7c - [libc][stdfix] Use __FRACT_FBIT__ for fixed point support detection instead of compiler version. (#81820)

via libc-commits libc-commits at lists.llvm.org
Thu Feb 15 05:26:34 PST 2024


Author: lntue
Date: 2024-02-15T07:26:30-06:00
New Revision: 95e8a7c863d17b929232d3e57007d342ffb3001d

URL: https://github.com/llvm/llvm-project/commit/95e8a7c863d17b929232d3e57007d342ffb3001d
DIFF: https://github.com/llvm/llvm-project/commit/95e8a7c863d17b929232d3e57007d342ffb3001d.diff

LOG: [libc][stdfix] Use __FRACT_FBIT__ for fixed point support detection instead of compiler version. (#81820)

Now that `__FRACT_FBIT__` and related macros are added in
https://github.com/llvm/llvm-project/pull/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.

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/stdfix-macros.h

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/stdfix-macros.h b/libc/include/llvm-libc-macros/stdfix-macros.h
index 9c83dbc8ef5463..11c18f83b8c57b 100644
--- a/libc/include/llvm-libc-macros/stdfix-macros.h
+++ b/libc/include/llvm-libc-macros/stdfix-macros.h
@@ -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
 


        


More information about the libc-commits mailing list