[Top][All Lists]

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

Re: [lmi] Removing comment induces compiler error

From: Vadim Zeitlin
Subject: Re: [lmi] Removing comment induces compiler error
Date: Mon, 6 Mar 2017 01:45:40 +0100

On Mon, 6 Mar 2017 00:24:06 +0000 Greg Chicares <address@hidden> wrote:

GC> I apply the following patch, and everything compiles. But if I
GC> delete any one of the three changed lines, compilation fails.
GC> How can deleting a commented-out line cause that? AFAICS it's
GC> impossible: the preprocessor removes the commented-out lines
GC> unconditionally, so the compiler can never see them.

 I admit I was surprised by this too, but the good thing with the computers
is that you can always debug them and it didn't take long to find out what
was going on here: the compiler indeed can never see the commented out
line, but other tools can, notably grep, which is used by workhorse.make to
build the list of wx_dependent_objects which are compiled without
-Wcast-qual which is used for the other ones. So, the explanation of the
riddle is that the code in these files uses wxWidgets indirectly and so
must not be compiled with -Wcast-qual.

 There are several possible solutions, but I think the most robust one
could be to disable this warning with a compiler pragma in pchfile_wx.hpp
and get rid of wx_dependent_objects in the makefiles entirely. This would
keep things at the code, rather than the makefile, level which is IMO
preferable and would rely on a convention we already use ("all files using
wx must include pchfile_wx.hpp") instead of using heuristics.

 If you agree with this solution, please let me know if you'd like me to
make (and test) the simple implementing it.


reply via email to

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