This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 20/04/17 11:12 +0100, Jonathan Wakely wrote:
On 20/04/17 12:07 +0200, Jakub Jelinek wrote:On Thu, Apr 20, 2017 at 11:03:38AM +0100, Jonathan Wakely wrote:Yet another case where warning suppression in system headers hurts the library's ability to give diagnostics. We can't warn about using incomplete types in std::unique_ptr because the -Wdelete-incomplete warning gets suppressed, and the interaction of #pragma GCC diagnostic with -Wsystem-headers is ... interesting. We need a way to enable warnings for specific blocks of code, to say "do not suppress warnings here, even though it's in a system header".Can #pragma GCC warning "-Wno-system-headers" do that?I don't think so. It didn't work last time I tried to use that to fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876 I don't remember the details, but I think there was some weirdness like the "pop" didn't restore the old value, or some other class of warning disappeaed.
I might be misremembering. I thought I'd found a problem with that approach, but I can't find any evidence of what the problem was. I have an old draft email from October 2013 with the text below. Maybe I just never committed it due to moving jobs at the time. === I'm inclined to commit this patch to locally enable -Wsystem-headers around default_delete and the _Sp_counter_ptr manager used by shared_ptr. This would ensure we don't suppress "deleting object of abstract type without virtual destructor will cause undefined behaviour" errors when giving ownership of such a pointer to shared_ptr or unique_ptr. The downside is that users have to use -Wno-delete-non-virtual-dtor to suppress the warning again if they really don't want it, but I think that's good. This is a real error in user code, the only reason we don't already warn is that the error happens in a template defined in a system header. We could similar thing in other places too, e.g. disable -Wpointer-arith around __atomic_base which relies on this extension for __atomic_base<cv void*> http://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html ===
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |