[Lldb-commits] [lldb] [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (PR #76137)

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 21 13:10:55 PST 2023


================
@@ -44,6 +44,10 @@ endif()
 
 if (WIN32)
   add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
+  if (NOT MSVC)
----------------
mstorsjo wrote:

This was never defined for clang-cl/MSVC builds before. Note that the existing define I'm removing is within this context:

```
#if !defined(_MSC_VER) && !defined(__NetBSD__)

#ifdef _WIN32
#define _BSD_SOURCE // Required so that getopt.h defines optreset
#endif
```
So we previously only defined `_BSD_SOURCE` on `defined(_WIN32) && !defined(_MSC_VER)`, i.e. `if (WIN32 AND NOT MSVC)` in cmake (even if the condition nesting is the other way around there).

https://github.com/llvm/llvm-project/pull/76137


More information about the lldb-commits mailing list