https://github.com/DominikAdamski updated 
https://github.com/llvm/llvm-project/pull/168386

>From 05677f564bb075af55306e86d27c62139d05f7bf Mon Sep 17 00:00:00 2001
From: Dominik Adamski <[email protected]>
Date: Mon, 17 Nov 2025 09:10:25 -0600
Subject: [PATCH 1/3] [libc] Fix wrapper headers if std=c99 is set

Declarations of stdio functions can be skipped for wrapper
headers. Previous declarations of stdio functions caused
compilation errors when the -std=c99 option is set.
---
 clang/lib/Headers/llvm_libc_wrappers/stdio.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Headers/llvm_libc_wrappers/stdio.h 
b/clang/lib/Headers/llvm_libc_wrappers/stdio.h
index 950f91b3763e8..99b58c1b23254 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/stdio.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/stdio.h
@@ -60,7 +60,22 @@
 
 #pragma omp begin declare target
 
-#include <llvm-libc-decls/stdio.h>
+#ifndef __LIBC_ATTRS
+#define __LIBC_ATTRS
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * stderr; __LIBC_ATTRS;
+
+extern FILE * stdin; __LIBC_ATTRS;
+
+extern FILE * stdout; __LIBC_ATTRS;
+
+#ifdef __cplusplus
+}
+#endif
 
 #pragma omp end declare target
 

>From 20621583bc3041e1753426df2a6ebe85cbd82112 Mon Sep 17 00:00:00 2001
From: Dominik Adamski <[email protected]>
Date: Mon, 17 Nov 2025 09:47:38 -0600
Subject: [PATCH 2/3] fix_format

---
 clang/lib/Headers/llvm_libc_wrappers/stdio.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Headers/llvm_libc_wrappers/stdio.h 
b/clang/lib/Headers/llvm_libc_wrappers/stdio.h
index 99b58c1b23254..b1ef144652ce5 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/stdio.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/stdio.h
@@ -67,11 +67,14 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern FILE * stderr; __LIBC_ATTRS;
+extern FILE * stderr;
+__LIBC_ATTRS;
 
-extern FILE * stdin; __LIBC_ATTRS;
+extern FILE * stdin;
+__LIBC_ATTRS;
 
-extern FILE * stdout; __LIBC_ATTRS;
+extern FILE * stdout;
+__LIBC_ATTRS;
 
 #ifdef __cplusplus
 }

>From 56d4a135d7151e22701b94d52b408ef622e2c39b Mon Sep 17 00:00:00 2001
From: Dominik Adamski <[email protected]>
Date: Mon, 17 Nov 2025 09:51:29 -0600
Subject: [PATCH 3/3] fix_format

---
 clang/lib/Headers/llvm_libc_wrappers/stdio.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Headers/llvm_libc_wrappers/stdio.h 
b/clang/lib/Headers/llvm_libc_wrappers/stdio.h
index b1ef144652ce5..bb319915adfa1 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/stdio.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/stdio.h
@@ -67,13 +67,13 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern FILE * stderr;
+extern FILE *stderr;
 __LIBC_ATTRS;
 
-extern FILE * stdin;
+extern FILE *stdin;
 __LIBC_ATTRS;
 
-extern FILE * stdout;
+extern FILE *stdout;
 __LIBC_ATTRS;
 
 #ifdef __cplusplus

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to