lmi
[Top][All Lists]
Advanced

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

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


From: Vadim Zeitlin
Subject: Re: [lmi] Puzzled by this clang '-Winvalid-noreturn' warning
Date: Sat, 25 Jun 2022 14:34:57 +0200

On Sat, 25 Jun 2022 10:44:29 +0000 Greg Chicares <gchicares@sbcglobal.net> 
wrote:

GC> This declaration:
GC>   void __cxa_throw(void* thrown_exception, struct std::type_info * tinfo, 
void (*dest)(void*));
GC> specified here:
GC>   https://libcxxabi.llvm.org/spec.html
GC> has no evident 'noreturn' attribute. However:
GC> 
GC> /opt/lmi/src/lmi[0]$make $coefficiency unit_tests 
unit_test_targets=sandbox_test
GC> 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
GC> /opt/lmi/src/lmi/unwind.cpp:200:1: warning: function declared 'noreturn' 
should not return [-Winvalid-noreturn]
GC> }
GC> ^
GC> 1 warning generated.
GC> 
GC> I can suppress the warning with the patch below, but is there a better way?

 I didn't have time to test it yet (and probably won't until Monday, which
is why I'm writing this hasty reply right now), but my idea would be to use
noreturn with cxa_throw_t to let the compiler know that original_cxa_throw
doesn't return.

 Otherwise, I'm almost certain that putting __builtin_unreachable() after
the call to original_cxa_throw() should suppress the compiler warning as
well.

 Please let me know if none of these suggestions works for you and you'd
like me to test this myself,
VZ

Attachment: pgpbAIRqHVVfK.pgp
Description: PGP signature


reply via email to

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