about summary refs log tree commit diff
path: root/pkgs/applications/editors/emacs/macport_noescape_noop.h
diff options
context:
space:
mode:
authorAndrew Pan <a@tny.town>2023-08-29 12:52:53 -0500
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-08-31 14:20:27 +0000
commitf607a7851619a6efda5f7c57f0345018a3ea403c (patch)
tree584ae8ae4f456af93170ecd5af68e3d19256e5ff /pkgs/applications/editors/emacs/macport_noescape_noop.h
parente161990d40c97c649a5e7df9d3347c0ea3896bde (diff)
emacs-macport: build on LLVM 14
- Build on `apple_sdk_11_0` to support `aarch64-darwin`
- Add frameworks required for building on newer SDKs
  - `Accelerate`, `UniformTypeIdentifiers`
- Include header to work around `CF_NOESCAPE` issue circa LLVM 7.0
Diffstat (limited to 'pkgs/applications/editors/emacs/macport_noescape_noop.h')
-rw-r--r--pkgs/applications/editors/emacs/macport_noescape_noop.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/applications/editors/emacs/macport_noescape_noop.h b/pkgs/applications/editors/emacs/macport_noescape_noop.h
new file mode 100644
index 0000000000000..64c65bd90f880
--- /dev/null
+++ b/pkgs/applications/editors/emacs/macport_noescape_noop.h
@@ -0,0 +1,31 @@
+#ifndef NOESCAPE_NOOP_H_
+#define NOESCAPE_NOOP_H_
+
+// First, do some work to get definitions for *_WIDTH. Normally, Emacs would
+// have these defined by headers in-tree, but clang's headers clash with those.
+// Due to how include paths work, we have to include clang headers if we want to
+// mess with CoreFoundation definitions.
+#pragma push_macro("__STDC_VERSION__")
+// Make the preprocessor think that we're on C2x. The macros we want are gated
+// on it.
+#undef __STDC_VERSION__
+#define __STDC_VERSION__ 202000L
+// Include limits.h first, as stdint.h includes it.
+#include <limits.h>
+
+// XX: clang's stdint.h is shy and won't give us its defs unless it thinks it's
+// in freestanding mode.
+#undef __STDC_HOSTED__
+#include <stdint.h>
+#define __STDC_HOSTED__ 1
+
+#pragma pop_macro("__STDC_VERSION__")
+
+// Now, pull in the header that defines CF_NOESCAPE.
+#include <CoreFoundation/CFBase.h>
+
+// Redefine CF_NOESCAPE as empty.
+#undef CF_NOESCAPE
+#define CF_NOESCAPE
+
+#endif // NOESCAPE_NOOP_H_