>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
Angus> Michael Schmitt wrote: >>> Log message: Strip out redundant #includes >> Angus, how did you determine all theses redundant #includes? Is >> there tools available that detects them automatically? Angus> http://article.gmane.org/gmane.editors.lyx.devel:27547 What I do not necessarily like about this approach is that it does not remove #includes from _headers_ which is the most reasonable thing to do. Having extra includes in a .C file is only a problem when the features in the header are not used (for example removing lyxrc.h from formula.C is good). However, you remove <vector> from math_autocorrect.C (I know this file is not used, but this is irrelevant for this discussion) which actually uses std::vector objects. It still compiles, but this is just by chance... Actually, the reason why it works is that filetool.h includes <vector> just for the benefit of defining the function DirList, which in turn is only used in converters.C. So the real problem here is that every user of filetools.h will also have to read <vector>, which is very expensive. My point is that removing a header because it is already included somewhere by chance is not a real win, since reading it again will take virtually no time. But if <vector> is not used anymore in filetools.h one day, then we will have a lot of .C files which do not compile anymore... So maybe a less aggressive approach in your scripts could be to remove a header, check that it still compiles _and_ that the header does not show in the dependencies anymore. This will allow to remove really useless headers. As an example of why one should not be too aggressive, the following patch reintroduces <utility>, which is needed here (in general, these <utility> includes are there for a reason). It also makes a header change which is more useful, that is changing vspace.h to lyxlength.h, since this is what was really needed. It would be nice to be able to automate finding such things, but I do not know how to do it. JMarc
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v retrieving revision 1.362 diff -u -p -r1.362 ChangeLog --- ChangeLog 5 Sep 2003 09:25:42 -0000 1.362 +++ ChangeLog 5 Sep 2003 11:58:30 -0000 @@ -1,3 +1,12 @@ +2003-09-05 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * math_kerninset.h: + * math_gridinset.h: include "lyxlength.h", not "vspace.h" + + * math_cursor.C: "lyxrc.h", not <lyxrc.h> + + * math_extern.C: include <algorithm> + 2003-09-05 Angus Leeming <[EMAIL PROTECTED]> * *.C: strip out redundant #includes. (168 in total.) Index: math_cursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v retrieving revision 1.352 diff -u -p -r1.352 math_cursor.C --- math_cursor.C 5 Sep 2003 02:53:05 -0000 1.352 +++ math_cursor.C 5 Sep 2003 11:58:30 -0000 @@ -11,8 +11,7 @@ #include <config.h> -#include <lyxrc.h> - +#include "lyxrc.h" #include "support/LAssert.h" #include "support/limited_stack.h" #include "debug.h" Index: math_extern.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_extern.C,v retrieving revision 1.54 diff -u -p -r1.54 math_extern.C --- math_extern.C 5 Sep 2003 02:53:05 -0000 1.54 +++ math_extern.C 5 Sep 2003 11:58:30 -0000 @@ -34,6 +34,7 @@ #include "support/filetools.h" #include "support/lstrings.h" +#include <algorithm> using namespace lyx::support; Index: math_gridinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.h,v retrieving revision 1.68 diff -u -p -r1.68 math_gridinset.h --- math_gridinset.h 19 Aug 2003 13:00:55 -0000 1.68 +++ math_gridinset.h 5 Sep 2003 11:58:30 -0000 @@ -13,7 +13,7 @@ #define MATH_GRID_H #include "math_nestinset.h" -#include "vspace.h" +#include "lyxlength.h" #include "LString.h" Index: math_kerninset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_kerninset.h,v retrieving revision 1.14 diff -u -p -r1.14 math_kerninset.h --- math_kerninset.h 19 Aug 2003 13:00:55 -0000 1.14 +++ math_kerninset.h 5 Sep 2003 11:58:30 -0000 @@ -13,7 +13,7 @@ #define MATH_CHEATINSET_H #include "math_inset.h" -#include "vspace.h" +#include "lyxlength.h" #include "LString.h" #include "math_nestinset.h"