Did anybody hit the "declaration requires an exit-time destructor" clang warning?

1,530 views
Skip to first unread message

ardi

unread,
Apr 12, 2015, 9:41:53 AM4/12/15
to wx-u...@googlegroups.com
Hi,

Some of my (several years old -from the 2.9.3 days) applications build without any warnings with gcc. However, when compiling them with clang, I'm getting warnings like the one I'm copying below.

(Yes, I know I should post a minimum working example, and provide more details, but I'm just asking this in case this is a well-known warning, or a well-known symptom of something I'm doing wrong).

Even with this warning, the application builds and runs fine with clang (just like with gcc)


mywxtextctrl.c++:16:1: warning: declaration requires an exit-time destructor [-Wexit-time-destructors]
BEGIN_EVENT_TABLE(CMyWxTextCtrl, wxTextCtrl)

/Users/thatsme/wxWidgets/build/include/wx-2.9/wx/event.h:4130:56: note: 
      expanded from macro 'BEGIN_EVENT_TABLE'
#define BEGIN_EVENT_TABLE(a,b)                         wxBEGIN_EVENT_TABLE(a,b)
     
     
Thanks,

ardi

Vadim Zeitlin

unread,
Apr 12, 2015, 10:43:02 AM4/12/15
to wx-u...@googlegroups.com
On Sun, 12 Apr 2015 06:41:53 -0700 (PDT) ardi wrote:

a> Even with this warning, the application builds and runs fine with clang
a> (just like with gcc)
a>
a>
a> mywxtextctrl.c++:16:1: warning: declaration requires an exit-time
a> destructor [-Wexit-time-destructors]
a> BEGIN_EVENT_TABLE(CMyWxTextCtrl, wxTextCtrl)
a>
a> /Users/thatsme/wxWidgets/build/include/wx-2.9/wx/event.h:4130:56: note:
a> expanded from macro 'BEGIN_EVENT_TABLE'
a> #define BEGIN_EVENT_TABLE(a,b)
a> wxBEGIN_EVENT_TABLE(a,b)

Event table macros expand into global objects so you must ignore or
disable this warning (which is part of -Weverything with clang I believe)
if you use them.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

ardi

unread,
Apr 12, 2015, 11:15:06 AM4/12/15
to wx-u...@googlegroups.com

On Sunday, April 12, 2015 at 4:43:02 PM UTC+2, Vadim Zeitlin wrote:

> Event table macros expand into global objects so you must ignore or
> disable this warning (which is part of -Weverything with clang I believe)
> if you use them.

Yep, I find some of the pedantic-category warnings in clang quite helpful, so I began with -Weverything and then disable really unwanted warnings with -Wno-whatever.

Thanks a lot for clarifying why is this warning being issued here. I tend to believe this might be a useful warning in other situations, so I'm going to disable it just in these code lines via #pragmas, and letting it enabled elsewhere.

ardi

Reply all
Reply to author
Forward
0 new messages