On Thu, 20 Oct 2016 03:19:54 +0900 ARATA Mizuki wrote:
AM> > H28/10/20 1:25、Nerijus Baliunas <
ner...@users.sourceforge.net>のメール:
AM> >
AM> > On Wed, 19 Oct 2016 16:32:29 +0200 Vadim Zeitlin <
va...@wxwidgets.org> wrote:
AM> >
AM> >> Yes, this is normal as it doesn't compile the code. "-E" used to have a
AM> >> look at the code after preprocessing, please try searching for the class
AM> >> name in the (huge) generated output file and locate the lines corresponding
AM> >> to the macro expansion.
AM> >
AM> > It has such lines as:
AM> >
AM> > class __attribute__ ((visibility("default"))) wxObject
AM> > {
AM> > public: static wxClassInfo ms_classInfo;
AM> > # 344 "/a/M/wxWindows.31/wxWidgets/include/wx/object.h"
AM> > #pragma GCC diagnostic push
AM> > # 344 "/a/M/wxWindows.31/wxWidgets/include/wx/object.h"
AM> >
AM> > # 344 "/a/M/wxWindows.31/wxWidgets/include/wx/object.h"
AM> > #pragma GCC diagnostic ignored "-Winconsistent-missing-override"
AM> > # 344 "/a/M/wxWindows.31/wxWidgets/include/wx/object.h"
AM> > virtual wxClassInfo *GetClassInfo() const
AM> > # 344 "/a/M/wxWindows.31/wxWidgets/include/wx/object.h"
AM> > #pragma GCC diagnostic pop
AM> > # 344 "/a/M/wxWindows.31/wxWidgets/include/wx/object.h"
AM> > ;
AM> >
AM> > Shouldn't the last ";" be before #pragma GCC diagnostic pop?
AM>
AM> In fact, there should be no #pragma's at all here. These pragmas are
AM> intended for clang, not GCC.
I still wonder if it's a good idea to put a pragma in the middle of a
statement like this. Apparently this doesn't create any problems for clang
right now, but it's definitely unusual. Do you think this could ever become
a problem in the future?
AM> A change like this should work:
AM>
AM> diff --git a/include/wx/defs.h b/include/wx/defs.h
AM> index 1a35a67..423134b 100644
AM> --- a/include/wx/defs.h
AM> +++ b/include/wx/defs.h
AM> @@ -641,7 +641,7 @@ typedef short int WXTYPE;
AM> virtual wxClassInfo *GetClassInfo() const
AM> wxCLANG_WARNING_RESTORE(inconsistent-missing-override)
AM> */
AM> -#if defined(__has_warning)
AM> +#if defined(__clang__) && defined(__has_warning)
AM> # define wxCLANG_HAS_WARNING(x) __has_warning(x) /* allow macro expansion for the warning name */
AM> # define wxCLANG_IF_VALID_WARNING(x,y) \
AM> wxCONCAT(wxCLANG_IF_VALID_WARNING_,wxCLANG_HAS_WARNING(wxSTRINGIZE(wxCONCAT(-W,x))))(y)
We could do this, but I don't really like it because if another compiler
starts providing __has_warning (e.g. icc perhaps or whatever else) we
probably want to use the same pragmas for it, there doesn't seem any reason
to limit this to the real clang only.
AM> Apparently, the definition of the macro wxCLANG_WARNING_SUPPRESS
AM> doesn't work well if __has_warning is defined by user code (in this
AM> case, <unicode/platform.h>).
Wait, do you mean that this project defines __has_warning in its own code?
If so, I think they deserve what they get. This is a reserved identifier
and, unlike the ones we use "_WX_whatever", defining this one clearly is a
problem. If I understood you correctly, they should really just stop doing
this.
Regards,
VZ