[flang-commits] [flang] flang: Fix build with latest libc++ (PR #127362)
Tom Stellard via flang-commits
flang-commits at lists.llvm.org
Tue Feb 18 08:30:04 PST 2025
https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/127362
>From e8e1e76b1f40ff17dfedfcb2d32f86c4282b0533 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 15 Feb 2025 14:46:20 +0000
Subject: [PATCH 1/4] flang: Fix build with latest libc++
I think this first stopped working with
954836634abb446f18719b14120c386a929a42d1. This patch fixes the
following error:
/home/runner/work/llvm-project/llvm-project/flang/runtime/io-api-minimal.cpp:153:11: error: '__libcpp_verbose_abort' is missing exception specification 'noexcept'
153 | void std::__libcpp_verbose_abort(char const *format, ...) {
| ^
| noexcept
/mnt/build/bin/../include/c++/v1/__verbose_abort:30:28: note: previous declaration is here
30 | __printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT;
| ^
1 error generated.
---
flang/runtime/io-api-minimal.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/flang/runtime/io-api-minimal.cpp b/flang/runtime/io-api-minimal.cpp
index 68768427be0c2..e53089e02d93d 100644
--- a/flang/runtime/io-api-minimal.cpp
+++ b/flang/runtime/io-api-minimal.cpp
@@ -150,7 +150,12 @@ bool IODEF(OutputLogical)(Cookie cookie, bool truth) {
// Provide own definition for `std::__libcpp_verbose_abort` to avoid dependency
// on the version provided by libc++.
-void std::__libcpp_verbose_abort(char const *format, ...) {
+#if !defined(_LIBCPP_VERBOSE_ABORT_NOEXCEPT)
+ #define _LIBCPP_VERBOSE_ABORT_NOEXCEPT
+#endif
+
+
+void std::__libcpp_verbose_abort(char const *format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT {
va_list list;
va_start(list, format);
std::vfprintf(stderr, format, list);
>From 9b0da99ddc105f0f70c5628425e54aaff9e754b6 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 15 Feb 2025 17:45:02 -0800
Subject: [PATCH 2/4] Fix formatting
---
flang/runtime/io-api-minimal.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/flang/runtime/io-api-minimal.cpp b/flang/runtime/io-api-minimal.cpp
index e53089e02d93d..a661261535f40 100644
--- a/flang/runtime/io-api-minimal.cpp
+++ b/flang/runtime/io-api-minimal.cpp
@@ -151,11 +151,11 @@ bool IODEF(OutputLogical)(Cookie cookie, bool truth) {
// on the version provided by libc++.
#if !defined(_LIBCPP_VERBOSE_ABORT_NOEXCEPT)
- #define _LIBCPP_VERBOSE_ABORT_NOEXCEPT
+#define _LIBCPP_VERBOSE_ABORT_NOEXCEPT
#endif
-
-void std::__libcpp_verbose_abort(char const *format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT {
+void std::__libcpp_verbose_abort(
+ char const *format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT {
va_list list;
va_start(list, format);
std::vfprintf(stderr, format, list);
>From 71da3093a977f7b66740e6de3e7851c8cae09c67 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 17 Feb 2025 22:54:05 +0000
Subject: [PATCH 3/4] Better fix
---
flang/runtime/io-api-minimal.cpp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/flang/runtime/io-api-minimal.cpp b/flang/runtime/io-api-minimal.cpp
index a661261535f40..a016cd32645b8 100644
--- a/flang/runtime/io-api-minimal.cpp
+++ b/flang/runtime/io-api-minimal.cpp
@@ -150,12 +150,8 @@ bool IODEF(OutputLogical)(Cookie cookie, bool truth) {
// Provide own definition for `std::__libcpp_verbose_abort` to avoid dependency
// on the version provided by libc++.
-#if !defined(_LIBCPP_VERBOSE_ABORT_NOEXCEPT)
-#define _LIBCPP_VERBOSE_ABORT_NOEXCEPT
-#endif
-
-void std::__libcpp_verbose_abort(
- char const *format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT {
+void std::__libcpp_verbose_abort(char const *format, ...)
+ noexcept(noexcept(std::__libcpp_verbose_abort(""))) {
va_list list;
va_start(list, format);
std::vfprintf(stderr, format, list);
>From e73586560091423e0e7e48dec216495661c1eb23 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 17 Feb 2025 23:12:38 +0000
Subject: [PATCH 4/4] Fix formatting
---
flang/runtime/io-api-minimal.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flang/runtime/io-api-minimal.cpp b/flang/runtime/io-api-minimal.cpp
index a016cd32645b8..93ac82248aa4c 100644
--- a/flang/runtime/io-api-minimal.cpp
+++ b/flang/runtime/io-api-minimal.cpp
@@ -150,8 +150,8 @@ bool IODEF(OutputLogical)(Cookie cookie, bool truth) {
// Provide own definition for `std::__libcpp_verbose_abort` to avoid dependency
// on the version provided by libc++.
-void std::__libcpp_verbose_abort(char const *format, ...)
- noexcept(noexcept(std::__libcpp_verbose_abort(""))) {
+void std::__libcpp_verbose_abort(char const *format, ...) noexcept(
+ noexcept(std::__libcpp_verbose_abort(""))) {
va_list list;
va_start(list, format);
std::vfprintf(stderr, format, list);
More information about the flang-commits
mailing list