[llvm-branch-commits] [flang] release/20.x: flang: Fix build with latest libc++ (#127362) (PR #127805)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 19 06:59:31 PST 2025


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/127805

Backport 2b340c10a611d929fee25e6222909c8915e3d6b6

Requested by: @tstellar

>From 2b70b17d30744ee6720eb2645ef8b61e043ed295 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 19 Feb 2025 06:53:30 -0800
Subject: [PATCH] flang: Fix build with latest libc++ (#127362)

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.

(cherry picked from commit 2b340c10a611d929fee25e6222909c8915e3d6b6)
---
 flang/runtime/io-api-minimal.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang/runtime/io-api-minimal.cpp b/flang/runtime/io-api-minimal.cpp
index 68768427be0c2..93ac82248aa4c 100644
--- a/flang/runtime/io-api-minimal.cpp
+++ b/flang/runtime/io-api-minimal.cpp
@@ -150,7 +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, ...) {
+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 llvm-branch-commits mailing list