Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3373

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/73/3373/1

Try one approach to compile a class as one compilation unit

In many cases the sources for some class have been split up into several
source files, typically suffixed with a number 0, 1, 2 etc. Presumably this
has been done because some compiler years ago was not capable of compiling all
the source for that class at one time, or some other no longer relevant
reason.

It would be nice to get rid of this convention, so that clever compilers have
a better chance of noticing unused private fields in a class, for instance. On
the other hand, just combining the source files in question into one source
file and removing the old source files from git leads to a discontinuity in
version control history. Maybe a good compromise would be to introduce one new
source file what would include the existing numbered source files? Or, as in
this case, include the others into one already appropriately named source
file?

Change-Id: I79e299ba397c1466a08cbc9bc31817e76a2d67f5
---
M basic/Library_sb.mk
M basic/source/runtime/runtime.cxx
M basic/source/runtime/step0.cxx
M basic/source/runtime/step1.cxx
M basic/source/runtime/step2.cxx
5 files changed, 51 insertions(+), 75 deletions(-)



diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk
index 3568056..a3acbda 100644
--- a/basic/Library_sb.mk
+++ b/basic/Library_sb.mk
@@ -100,9 +100,6 @@
        basic/source/runtime/sbdiagnose \
        basic/source/runtime/stdobj \
        basic/source/runtime/stdobj1 \
-       basic/source/runtime/step0 \
-       basic/source/runtime/step1 \
-       basic/source/runtime/step2 \
 ))
 
 endif
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 815030d..ba80ce4 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -17,25 +17,61 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/svapp.hxx>
+#include <stdlib.h>
+
+#include <algorithm>
+
+#include <boost/unordered_map.hpp>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/script/XDefaultMethod.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
+
+#include <sal/log.hxx>
+
 #include <tools/wldcrd.hxx>
+
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+
+#include <rtl/instance.hxx>
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
 #include <svl/zforlist.hxx>
+
 #include <unotools/syslocale.hxx>
-#include "runtime.hxx"
-#include "sbintern.hxx"
-#include "opcodes.hxx"
+#include <unotools/textsearch.hxx>
+
+#include <basic/sbuno.hxx>
+
+#include "basrid.hxx"
 #include "codegen.hxx"
-#include "iosys.hxx"
-#include "image.hxx"
+#include "comenumwrapper.hxx"
 #include "ddectrl.hxx"
 #include "dllmgr.hxx"
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include "sbunoobj.hxx"
 #include "errobject.hxx"
-#include "sal/log.hxx"
+#include "image.hxx"
+#include "iosys.hxx"
+#include "opcodes.hxx"
+#include "runtime.hxx"
+#include "sb.hrc"
+#include "sbintern.hxx"
+#include "sbunoobj.hxx"
 
-#include "comenumwrapper.hxx"
+using com::sun::star::uno::Reference;
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::container;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::script;
 
 SbxVariable* getDefaultProp( SbxVariable* pRef );
 
@@ -1288,4 +1324,8 @@
     return pImg->GetBase();
 }
 
+#include "step0.cxx"
+#include "step1.cxx"
+#include "step2.cxx"
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 37e2116..0be0c90 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -17,28 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <comphelper/string.hxx>
-#include <vcl/msgbox.hxx>
-
-#include "errobject.hxx"
-#include "runtime.hxx"
-#include "sbintern.hxx"
-#include "iosys.hxx"
-#include <sb.hrc>
-#include <basrid.hxx>
-#include "sbunoobj.hxx"
-#include "image.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/util/SearchOptions.hpp>
-#include <rtl/instance.hxx>
-#include <vcl/svapp.hxx>
-#include <unotools/textsearch.hxx>
-
 Reference< XInterface > createComListener( const Any& aControlAny, const OUString& aVBAType,
                                            const OUString& aPrefix, SbxObjectRef xScopeObj );
-
-#include <algorithm>
-#include <boost/unordered_map.hpp>
 
 // for a patch forward declaring these methods below makes sense
 // but, #FIXME lets really just move the methods to the top
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 7b72129..2ccfbe3 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -17,19 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-#include <stdlib.h>
-#include <comphelper/string.hxx>
-#include <rtl/math.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <basic/sbuno.hxx>
-#include "runtime.hxx"
-#include "sbintern.hxx"
-#include "iosys.hxx"
-#include "image.hxx"
-#include "sbunoobj.hxx"
-#include "errobject.hxx"
-
 bool checkUnoObjectType( SbUnoObject* refVal, const OUString& aClass );
 
 // loading a numeric constant (+ID)
@@ -574,9 +561,5 @@
     PushVar( x2 );  // first the Expr
     PushVar( p1 );  // then the Base
 }
-
-
-
-
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 1683075..e2072b6 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -17,30 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-#include "runtime.hxx"
-#include "iosys.hxx"
-#include "image.hxx"
-#include "sbintern.hxx"
-#include "sbunoobj.hxx"
-#include "opcodes.hxx"
-
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/script/XDefaultMethod.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/uno/Any.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-#include <rtl/ustrbuf.hxx>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::container;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::script;
-
-using com::sun::star::uno::Reference;
-
 SbxVariable* getVBAConstant( const OUString& rName );
 
 SbxVariable* getDefaultProp( SbxVariable* pRef );

-- 
To view, visit https://gerrit.libreoffice.org/3373
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79e299ba397c1466a08cbc9bc31817e76a2d67f5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Tor Lillqvist <tml@iki.fi>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.