lmi
[Top][All Lists]
Advanced

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

Re: [lmi] PCH


From: Vadim Zeitlin
Subject: Re: [lmi] PCH
Date: Mon, 6 Jun 2016 00:23:47 +0200

On Sun, 5 Jun 2016 22:04:32 +0000 Greg Chicares <address@hidden> wrote:

GC> Then the __BORLANDC__ conditional block is ignored by every compiler we
GC> can foresee using, and the "pragma hdrstop" directive in that block is
GC> therefore ignored, too--so the whole block can be removed, and replaced
GC> by a single one-line include-directive, right?

 Yes. MSVC does have #pragma hdrstop but it's not required at all and I
can't think of it becoming required.

GC> >  Many variations are, of course, possible, but to be able to use PCH with
GC> > MSVC there must be an #include before anything else. So either all files
GC> > should start with
GC> > 
GC> >   #include "pch_if_used.hpp"
GC> > 
GC> > or
GC> > 
GC> >   #include "wx_pch_if_used.hpp"
GC> > 
GC> > (depending on whether the file is part of GUI code or not) or the file 
name
GC> > must be a macro as it is now. Do you have any preference for one or the
GC> > other of these solutions?
GC> 
GC> (1) #include LMI_PCH_HEADER
GC> 
GC> What macro definition makes that work with gcc?

 Nothing really special, i.e. here is what I have in Makefile.am:

        AM_CXXFLAGS = -DLMI_PCH_HEADER="<pchfile.hpp>"

and, for the GUI code:

        libskeleton_la_CXXFLAGS = ... -DLMI_PCH_HEADER="<pchfile_wx.hpp>"

GC> I guess we'd need a default definition that refers to an actual
GC> header--a new header that deliberately contains nothing but comments
GC> and is never updated except for copyright.

 Yes, there haven't been many updates to pchfile*.hpp. The last one in
pchfile.hpp was the renaming of streamable.hpp to xml_serializable.hpp back
in 2010 and pchfile_wx.hpp doesn't seem to have been updated at all since
its creation in 2009.

GC> And that default definition would have to be provided by makefiles,
GC> because no other header can be included before LMI_PCH_HEADER,

 Yes.

GC> (2) #include "non-wx-pch-file.hpp" XOR #include "wx-pch-file.hpp"

 This does seem simpler to me too, I admit that I'm not sure why had we
decided to go with LMI_PCH_HEADER. The trouble is that I have a nagging
feeling there was a good reason for this, but I can't remember (nor find in
the archives) what it was.

GC> I'll plan to make this change globally, if it meets your needs:
GC> 
GC> +#include "pchfile.hpp"
GC>   --XOR--
GC> +#include "pchfile_wx.hpp"
GC> -#if defined __BORLANDC__
GC> -#   include "pchfile.hpp"
GC> -#   pragma hdrstop
GC> -#endif // defined __BORLANDC__

 This would be perfect for me, thanks a lot! If you'd like to see the
versions of these files I currently use, please see

        https://github.com/vadz/lmi/blob/tt/pchfile.hpp
        https://github.com/vadz/lmi/blob/tt/pchfile_wx.hpp

 Thanks in advance!
VZ


reply via email to

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