[flang-commits] [flang] flang: Fix build with latest libc++ (PR #127362)

via flang-commits flang-commits at lists.llvm.org
Sat Feb 15 17:34:46 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Tom Stellard (tstellar)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/127362.diff


1 Files Affected:

- (modified) flang/runtime/io-api-minimal.cpp (+6-1) 


``````````diff
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);

``````````

</details>


https://github.com/llvm/llvm-project/pull/127362


More information about the flang-commits mailing list