[libc-commits] [libc] [libc][fenv] Add missing FE_* definitions for some environment. (PR #91519)
    Zibi Sarbinowski via libc-commits 
    libc-commits at lists.llvm.org
       
    Thu Oct 31 06:05:55 PDT 2024
    
    
  
================
@@ -17,10 +17,51 @@
 
 #include <fenv.h>
 
+// In some environment, FE_ALL_EXCEPT is set to 0 and the remaining exceptions
+// FE_* are missing.
+#if (FE_ALL_EXCEPT == 0)
----------------
zibi2 wrote:
This is not a valid preprocessor constant expression. On z/OS this  caused hard error as the following:
cat t.C && clang++ -c t.C
```
#define FE_ALL_EXCEPT   ((unsigned int) 0x000000F8)
#if (FE_ALL_EXCEPT == 0)
#ifndef FE_DIVBYZERO
#define FE_DIVBYZERO 0
#endif // FE_DIVBYZERO
#endif
t.C:3:6: error: token is not a valid binary operator in a preprocessor subexpression
    3 | #if (FE_ALL_EXCEPT == 0)
      |      ^~~~~~~~~~~~~
t.C:1:36: note: expanded from macro 'FE_ALL_EXCEPT'
    1 | #define FE_ALL_EXCEPT   ((unsigned int) 0x000000F8)
      |                           ~~~~~~~~ ^
1 error generated.
```
We are currently using `#ifndef FE_ALL_EXCEPT` as hack.
Will you be able to provide a proper fix?
https://github.com/llvm/llvm-project/pull/91519
    
    
More information about the libc-commits
mailing list