[PATCH] D136575: [Headers] remove define of _GNU_SOURCE when including Darwin's unwind.h

Matt Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 23 23:02:33 PDT 2022


mhjacobson created this revision.
mhjacobson added a reviewer: chandlerc.
Herald added a project: All.
mhjacobson requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Darwin's unwind.h has never surrounded declarations with _GNU_SOURCE guards.
The _GNU_SOURCE stuff removed here was introduced by a09e62a042, which expanded
the #include_next branch to non-Darwin platforms, including those that use
https://github.com/libunwind/libunwind (which *does* use _GNU_SOURCE guards).
That change was partially reverted by 032d422d2e, which left the _GNU_SOURCE
stuff as an "open question".

Therefore: close the question; remove the _GNU_SOURCE define.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136575

Files:
  clang/lib/Headers/unwind.h


Index: clang/lib/Headers/unwind.h
===================================================================
--- clang/lib/Headers/unwind.h
+++ clang/lib/Headers/unwind.h
@@ -14,12 +14,8 @@
 
 #if defined(__APPLE__) && __has_include_next(<unwind.h>)
 /* Darwin (from 11.x on) provide an unwind.h. If that's available,
- * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
- * so define that around the include.*/
-# ifndef _GNU_SOURCE
-#  define _SHOULD_UNDEFINE_GNU_SOURCE
-#  define _GNU_SOURCE
-# endif
+ * use it. */
+
 // libunwind's unwind.h reflects the current visibility.  However, Mozilla
 // builds with -fvisibility=hidden and relies on gcc's unwind.h to reset the
 // visibility to default and export its contents.  gcc also allows users to
@@ -33,10 +29,6 @@
 #  include_next <unwind.h>
 #  pragma GCC visibility pop
 # endif
-# ifdef _SHOULD_UNDEFINE_GNU_SOURCE
-#  undef _GNU_SOURCE
-#  undef _SHOULD_UNDEFINE_GNU_SOURCE
-# endif
 #else
 
 #include <stdint.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136575.469878.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221024/91a63f90/attachment.bin>


More information about the cfe-commits mailing list