From 40f56251ef629eed2ebb6d9b2f875eac06678cab Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@neon.tech>
Date: Mon, 5 Feb 2024 20:18:59 -0600
Subject: [PATCH v2 1/4] Add pg_attribute_no_asan

Putting this attribute on a function will disable AddressSanitizer
instrumentation in a function.
---
 src/include/c.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/include/c.h b/src/include/c.h
index 2e3ea206e1..11e7df0fd7 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -272,6 +272,13 @@
 
 #endif							/* defined(__MINGW64__) && __GNUC__ == 8 &&
 								 * __GNUC_MINOR__ == 1 */
+
+#if __SANITIZE_ADDRESS__
+#define pg_attribute_no_asan __attribute__((no_sanitize("address")))
+#else
+#define pg_attribute_no_asan
+#endif
+
 /*
  * Mark a point as unreachable in a portable fashion.  This should preferably
  * be something that the compiler understands, to aid code generation.
-- 
Tristan Partin
Neon (https://neon.tech)

