[clang] [Clang][Hexagon] Define _GNU_SOURCE when using picolibc in C++ mode (PR #201599)

Brian Cain via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 08:31:26 PDT 2026


================
@@ -116,6 +116,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+
+  if (Opts.CPlusPlus)
+    Builder.defineMacro("_GNU_SOURCE");
----------------
androm3da wrote:

> I am following what ARM did in `clang/lib/Basic/Targets/ARM.cpp`

That's not accurate: those ones are guarded by `getTriple().getOS() == llvm::Triple::UnknownOS` and the ARM EABI but this one in Hexagon.cpp is not.

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


More information about the cfe-commits mailing list