[libc-commits] [PATCH] D134676: [libc][windows] fix small build issues.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Sep 26 16:47:27 PDT 2022

lntue added inline comments.

Comment at: libc/src/__support/FPUtil/x86_64/FEnvImpl.h:51
 struct ExceptionFlags {
   static constexpr uint16_t INVALID = 0x1;
   // Some libcs define __FE_DENORM corresponding to the denormal input
This one also?

Comment at: libc/src/__support/FPUtil/x86_64/FEnvImpl.h:57
   static constexpr uint16_t DIV_BY_ZERO = 0x4;
-  static constexpr uint16_t OVERFLOW = 0x8;
-  static constexpr uint16_t UNDERFLOW = 0x10;
michaelrj wrote:
> sivachandra wrote:
> > lntue wrote:
> > > Can you also change other exception flags to the same format too?
> > Where is the macro named `OVERFLOW` coming from?
> here's the error:
> ```
> In file included from C:/src/llvm-project/libc\src/__support/FPUtil/FEnvImpl.h:21:
> C:/src/llvm-project/libc\src/__support/FPUtil/x86_64/FEnvImpl.h(271,44): error: expected unqualified-id
>     raise_helper(internal::ExceptionFlags::OVERFLOW);
>                                            ^
> C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(965,25): note: expanded from macro 'OVERFLOW'
>     #define OVERFLOW    _OVERFLOW
>                         ^
> C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(68,21): note: expanded from macro '_OVERFLOW'
> #define _OVERFLOW   3   // overflow range error
> ```
> If I had to guess it's coming in through `#include <fenv.h>`
Look like that definition is guarded by `_CRT_INTERNAL_NONSTDC_NAMES` (https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/ucrt/corecrt_math.h#L962) internally to Windows C runtimes?  Either `#undef` this or adding some Windows specific build flag might be another solution?

  rG LLVM Github Monorepo



More information about the libc-commits mailing list