lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Puzzled by this clang '-Winvalid-noreturn' warning


From: Greg Chicares
Subject: [lmi] Puzzled by this clang '-Winvalid-noreturn' warning
Date: Sat, 25 Jun 2022 10:44:29 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

This declaration:
  void __cxa_throw(void* thrown_exception, struct std::type_info * tinfo, void 
(*dest)(void*));
specified here:
  https://libcxxabi.llvm.org/spec.html
has no evident 'noreturn' attribute. However:

/opt/lmi/src/lmi[0]$make $coefficiency unit_tests unit_test_targets=sandbox_test
clang++ -MMD -MP -MT unwind.o -MF unwind.d  -c -I /opt/lmi/src/lmi -I 
/opt/lmi/src/lmi/tools/pete-2.1.1 -isystem 
/opt/lmi/local/gcc_x86_64-pc-linux-gnu/lib/wx/include/gtk3-unicode-3.1 -isystem 
/opt/lmi/local/include/wx-3.1 -isystem /opt/lmi/third_party/include -isystem 
/opt/lmi/local/include -isystem /opt/lmi/local/include/libxml2 
-DLMI_WX_NEW_USE_SO   -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ 
-D_FILE_OFFSET_BITS=64     -fPIC -ffp-model=strict -fno-ms-compatibility 
-fno-ms-extensions  -std=c++20   /opt/lmi/src/lmi/unwind.cpp -ounwind.o
/opt/lmi/src/lmi/unwind.cpp:200:1: warning: function declared 'noreturn' should 
not return [-Winvalid-noreturn]
}
^
1 warning generated.

I can suppress the warning with the patch below, but is there a better way?

--8<----8<----8<----8<----8<----8<----8<----8<----8<--
diff --git a/unwind.cpp b/unwind.cpp
index e68f54c8..d4e43e3b 100644
--- a/unwind.cpp
+++ b/unwind.cpp
@@ -197,6 +197,9 @@ void __cxa_throw(void* thrown_exception, std::type_info* 
tinfo, void (*dest)(voi
         print_backtrace();
         }
     original_cxa_throw(thrown_exception, tinfo, dest);
+#if defined LMI_CLANG
+    throw "Unreachable--silences a compiler diagnostic.";
+#endif // defined LMI_CLANG
 }
 
 #   if defined LMI_GCC
--8<----8<----8<----8<----8<----8<----8<----8<----8<--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]