File 0781-erts-Do-not-annotate-nif-API-functions-on-windows.patch of Package erlang

From 4ae3182220e54373736e411e9470187ee6a211a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= <lukas@erlang.org>
Date: Mon, 4 Nov 2024 21:45:46 +0100
Subject: [PATCH 1/2] erts: Do not annotate nif API functions on windows

On windows nifs can be compiled with gcc/clang which
means that __has_attribute(malloc) is defined. This
was never intended to work so we disable it on Windows.

closes #9015
---
 erts/emulator/beam/erl_drv_nif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/erts/emulator/beam/erl_drv_nif.h b/erts/emulator/beam/erl_drv_nif.h
index 735ffa380c..34fc656706 100644
--- a/erts/emulator/beam/erl_drv_nif.h
+++ b/erts/emulator/beam/erl_drv_nif.h
@@ -182,7 +182,7 @@ typedef struct {
  * D: Has 1-to-1 Deallocator function with ptr argument. ((malloc(DTOR,PTRPOS)))
  */
 
-#ifdef __has_attribute
+#if defined(__has_attribute) && !defined(__WIN32__)
 #  if __has_attribute(warn_unused_result)
 #    undef  ERL_NAPI_ATTR_WUR
 #    define ERL_NAPI_ATTR_WUR __attribute__((warn_unused_result))
-- 
2.43.0

openSUSE Build Service is sponsored by