Refactoring patches

Yuriy Skalko yuriy.skalko at gmail.com
Mon Oct 12 19:36:36 UTC 2020


> Getting rid of unnecessary includes is a valuable goal.
> There are two things to keep in mind:
> - One should try to get rid of redundant includes from headers first, only 
> after that reducing .cpp files (otherwise the check of .h files becomes more 
> tricky).
> - some generic headers were included as a consequence of different dependencies 
> on different gcc versions or exotic architectures..
> 
> What kind of tool/script you used to find out?
> (I have something in my attic from couple years back when I was going through 
> similar loop.)
> 
> Pavel

I've used cppclean. Due to transitive includes (some are 4-5 levels
deep) it is hard to see all dependencies and make reliable cleaning. The
tool is not very helpful. I've done only the simplest cases.

Here is slightly updated patch.

Yuriy
-------------- next part --------------
From 0ef53ab44772fa6ae26ca85c06203a2a8c796394 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Mon, 12 Oct 2020 15:30:07 +0300
Subject: [PATCH] Remove unused forward declarations and header includes

---
 src/Buffer.h                           | 4 ----
 src/BufferView.h                       | 3 ---
 src/Citation.h                         | 2 --
 src/CoordCache.h                       | 2 --
 src/CutAndPaste.h                      | 1 -
 src/LayoutFile.h                       | 2 --
 src/ParIterator.h                      | 1 -
 src/Paragraph.h                        | 6 ------
 src/ParagraphMetrics.h                 | 6 ------
 src/buffer_funcs.h                     | 2 --
 src/frontends/Application.h            | 7 -------
 src/frontends/Delegates.h              | 1 -
 src/frontends/WorkArea.h               | 3 ---
 src/frontends/qt/GuiApplication.h      | 6 +++---
 src/frontends/qt/GuiCharacter.cpp      | 1 -
 src/frontends/qt/GuiCitation.cpp       | 4 ----
 src/frontends/qt/GuiCitation.h         | 2 --
 src/frontends/qt/GuiCompleter.h        | 2 --
 src/frontends/qt/GuiCounter.cpp        | 2 --
 src/frontends/qt/GuiDocument.cpp       | 1 -
 src/frontends/qt/GuiDocument.h         | 2 --
 src/frontends/qt/GuiErrorList.h        | 2 --
 src/frontends/qt/GuiExternal.cpp       | 1 -
 src/frontends/qt/GuiIndex.cpp          | 2 --
 src/frontends/qt/GuiLog.cpp            | 1 -
 src/frontends/qt/GuiLyXFiles.h         | 4 ----
 src/frontends/qt/GuiNote.cpp           | 2 --
 src/frontends/qt/GuiPainter.h          | 2 --
 src/frontends/qt/GuiPhantom.cpp        | 2 --
 src/frontends/qt/GuiPrefs.cpp          | 2 --
 src/frontends/qt/GuiPrefs.h            | 4 ----
 src/frontends/qt/GuiSelectionManager.h | 2 --
 src/frontends/qt/GuiSpellchecker.h     | 2 --
 src/frontends/qt/GuiTabular.cpp        | 2 --
 src/frontends/qt/GuiToc.cpp            | 1 -
 src/frontends/qt/GuiToc.h              | 1 -
 src/frontends/qt/GuiToolbar.h          | 5 -----
 src/frontends/qt/GuiView.cpp           | 2 --
 src/frontends/qt/GuiWorkArea.h         | 3 +--
 src/frontends/qt/GuiWorkArea_Private.h | 2 --
 src/frontends/qt/LayoutBox.h           | 3 ---
 src/frontends/qt/LyXFileDialog.h       | 2 --
 src/frontends/qt/Menus.cpp             | 1 -
 src/frontends/qt/PanelStack.h          | 3 ---
 src/frontends/qt/TocModel.h            | 1 -
 src/frontends/qt/qt_helpers.h          | 4 ----
 src/graphics/GraphicsCacheItem.h       | 1 -
 src/graphics/PreviewImage.h            | 1 -
 src/insets/ExternalTransforms.h        | 2 --
 src/insets/Inset.h                     | 3 ---
 src/insets/InsetBibitem.h              | 2 --
 src/insets/InsetBibtex.h               | 1 -
 src/insets/InsetCaptionable.h          | 2 ++
 src/insets/InsetCollapsible.h          | 2 --
 src/insets/InsetERT.h                  | 2 --
 src/insets/InsetInclude.h              | 1 -
 src/insets/InsetLabel.h                | 2 --
 src/insets/InsetLayout.cpp             | 1 -
 src/insets/InsetLine.h                 | 2 --
 src/insets/InsetPhantom.cpp            | 1 -
 src/insets/InsetTabular.h              | 1 -
 src/insets/InsetText.h                 | 3 ---
 src/mathed/InsetMath.h                 | 1 -
 src/mathed/InsetMathComment.h          | 2 --
 src/mathed/InsetMathEnv.cpp            | 1 -
 src/mathed/InsetMathExInt.cpp          | 1 -
 src/mathed/InsetMathGrid.h             | 1 -
 src/mathed/InsetMathHull.cpp           | 1 -
 src/mathed/InsetMathMacroTemplate.cpp  | 1 -
 src/mathed/InsetMathNest.cpp           | 1 -
 src/mathed/InsetMathNumber.cpp         | 1 -
 src/mathed/InsetMathTabular.cpp        | 1 -
 src/mathed/InsetMathXArrow.cpp         | 1 -
 src/mathed/MacroTable.cpp              | 1 -
 src/mathed/MacroTable.h                | 1 -
 src/mathed/MathAtom.h                  | 1 -
 src/mathed/MathRow.cpp                 | 2 --
 src/support/SystemcallPrivate.h        | 2 --
 src/support/lassert.cpp                | 5 +++--
 79 files changed, 9 insertions(+), 158 deletions(-)

diff --git a/src/Buffer.h b/src/Buffer.h
index e8f0aea875..8aa8478500 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -39,9 +39,6 @@ class FuncRequest;
 class FuncStatus;
 class Inset;
 class InsetLabel;
-class InsetRef;
-class Font;
-class Format;
 class Lexer;
 class Text;
 class LyXVC;
@@ -52,7 +49,6 @@ class MacroNameSet;
 class MacroSet;
 class OutputParams;
 class otexstream;
-class Paragraph;
 class ParConstIterator;
 class ParIterator;
 class ParagraphList;
diff --git a/src/BufferView.h b/src/BufferView.h
index 2f6e429dd0..4a020eb3b2 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -37,7 +37,6 @@ class CursorSlice;
 class Dimension;
 class DispatchResult;
 class DocIterator;
-class DocumentClass;
 class FuncRequest;
 class FuncStatus;
 class Intl;
@@ -45,10 +44,8 @@ class Inset;
 class Length;
 class MathData;
 class MathRow;
-class ParIterator;
 class ParagraphMetrics;
 class Point;
-class Row;
 class TexRow;
 class Text;
 class TextMetrics;
diff --git a/src/Citation.h b/src/Citation.h
index 8aeb56c3e5..b7af22b751 100644
--- a/src/Citation.h
+++ b/src/Citation.h
@@ -18,8 +18,6 @@
 
 namespace lyx {
 
-class Buffer;
-
 
 enum CiteEngineType {
 	ENGINE_TYPE_AUTHORYEAR = 1,
diff --git a/src/CoordCache.h b/src/CoordCache.h
index 9871819c10..38842be83c 100644
--- a/src/CoordCache.h
+++ b/src/CoordCache.h
@@ -21,9 +21,7 @@
 namespace lyx {
 
 class Inset;
-class Text;
 class MathData;
-class Paragraph;
 
 void lyxbreaker(void const * data, const char * hint, int size);
 
diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index a6ce3fc74d..54ca4e3dfd 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -25,7 +25,6 @@
 
 namespace lyx {
 
-class DocumentClass;
 class ErrorList;
 class InsetText;
 class Cursor;
diff --git a/src/LayoutFile.h b/src/LayoutFile.h
index 7fcc820bbf..fe86532266 100644
--- a/src/LayoutFile.h
+++ b/src/LayoutFile.h
@@ -24,8 +24,6 @@
 
 namespace lyx {
 
-class Layout;
-
 /// Index into LayoutFileList. Basically a 'strong typedef'.
 class LayoutFileIndex {
 public:
diff --git a/src/ParIterator.h b/src/ParIterator.h
index a763183838..a4e410b7e2 100644
--- a/src/ParIterator.h
+++ b/src/ParIterator.h
@@ -21,7 +21,6 @@ namespace lyx {
 
 class Buffer;
 class Inset;
-class Text;
 class ParagraphList;
 
 
diff --git a/src/Paragraph.h b/src/Paragraph.h
index 597a10b764..0752dfeb0a 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -32,22 +32,16 @@ class AuthorList;
 class Buffer;
 class BufferParams;
 class Change;
-class Counters;
-class Cursor;
-class CursorSlice;
 class DocIterator;
 class docstring_list;
 class DocumentClass;
 class Inset;
-class InsetBibitem;
 class LaTeXFeatures;
 class InsetList;
 class Language;
 class Layout;
 class Font;
-class MetricsInfo;
 class OutputParams;
-class PainterInfo;
 class ParagraphParameters;
 class TocBackend;
 class WordLangTuple;
diff --git a/src/ParagraphMetrics.h b/src/ParagraphMetrics.h
index 9ddc1b0211..17d68b5ba8 100644
--- a/src/ParagraphMetrics.h
+++ b/src/ParagraphMetrics.h
@@ -32,14 +32,8 @@ namespace lyx {
  */
 typedef std::vector<Row> RowList;
 
-class Buffer;
 class BufferView;
-class BufferParams;
-class Font;
-class Inset;
 class Paragraph;
-class MetricsInfo;
-class PainterInfo;
 
 /// Helper class for paragraph metrics.
 class ParagraphMetrics {
diff --git a/src/buffer_funcs.h b/src/buffer_funcs.h
index 12aa84123e..7d0bd07f84 100644
--- a/src/buffer_funcs.h
+++ b/src/buffer_funcs.h
@@ -19,8 +19,6 @@ namespace lyx {
 namespace support { class FileName; }
 
 class Buffer;
-class DocIterator;
-class ParIterator;
 
 /**
  *  Checks and loads a LyX file \param filename.
diff --git a/src/frontends/Application.h b/src/frontends/Application.h
index 49bf68ddd0..5e3b37a7f1 100644
--- a/src/frontends/Application.h
+++ b/src/frontends/Application.h
@@ -25,22 +25,15 @@
 
 namespace lyx {
 
-class BufferView;
 class Buffer;
 class DispatchResult;
 class docstring_list;
 class FuncRequest;
 class FuncStatus;
 class Inset;
-class Lexer;
-struct RGBColor;
 
 namespace frontend {
 
-class Clipboard;
-class FontLoader;
-class Selection;
-
 /// The main application class
 /**
 There should be only one instance of this class. No Qt object
diff --git a/src/frontends/Delegates.h b/src/frontends/Delegates.h
index b5844470e1..c50df6b33f 100644
--- a/src/frontends/Delegates.h
+++ b/src/frontends/Delegates.h
@@ -16,7 +16,6 @@
 
 namespace lyx {
 
-class Buffer;
 class DocIterator;
 class Inset;
 
diff --git a/src/frontends/WorkArea.h b/src/frontends/WorkArea.h
index 743c1145a5..d6912fc7fa 100644
--- a/src/frontends/WorkArea.h
+++ b/src/frontends/WorkArea.h
@@ -18,9 +18,6 @@
 
 namespace lyx {
 
-class BufferView;
-class KeySymbol;
-
 namespace frontend {
 
 /**
diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h
index 4e0983b134..a121b957a6 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -29,7 +29,6 @@ class QFont;
 
 namespace lyx {
 
-class BufferView;
 class ColorCache;
 class KeySymbol;
 
@@ -39,10 +38,11 @@ class FileName;
 
 namespace frontend {
 
+class Clipboard;
+class FontLoader;
 class GuiView;
-class GuiWorkArea;
 class Menus;
-class SocketNotifier;
+class Selection;
 class Toolbars;
 
 /// The Qt main application class
diff --git a/src/frontends/qt/GuiCharacter.cpp b/src/frontends/qt/GuiCharacter.cpp
index d1d4336fc2..cfa481c832 100644
--- a/src/frontends/qt/GuiCharacter.cpp
+++ b/src/frontends/qt/GuiCharacter.cpp
@@ -18,7 +18,6 @@
 #include "GuiApplication.h"
 #include "qt_helpers.h"
 
-#include "Font.h"
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index 951bad8612..d7e5ae0199 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -22,7 +22,6 @@
 
 #include "Buffer.h"
 #include "BufferView.h"
-#include "BiblioInfo.h"
 #include "BufferParams.h"
 #include "TextClass.h"
 #include "FuncRequest.h"
@@ -42,9 +41,6 @@
 #include <QStandardItemModel>
 #include <QVariant>
 
-#include <vector>
-#include <string>
-
 #undef KeyPress
 
 #include "support/regex.h"
diff --git a/src/frontends/qt/GuiCitation.h b/src/frontends/qt/GuiCitation.h
index db7ac31249..7e65fe64cb 100644
--- a/src/frontends/qt/GuiCitation.h
+++ b/src/frontends/qt/GuiCitation.h
@@ -31,8 +31,6 @@
 
 namespace lyx {
 
-class BiblioInfo;
-
 namespace frontend {
 
 class GuiSelectionManager;
diff --git a/src/frontends/qt/GuiCompleter.h b/src/frontends/qt/GuiCompleter.h
index 54ea5f0559..9cf5ad96d6 100644
--- a/src/frontends/qt/GuiCompleter.h
+++ b/src/frontends/qt/GuiCompleter.h
@@ -20,8 +20,6 @@
 
 namespace lyx {
 
-class Buffer;
-
 namespace frontend {
 
 class GuiWorkArea;
diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index db081a46c5..d7685bc7bb 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -25,8 +25,6 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
-#include "qt_helpers.h"
-
 #include <map>
 //#include <vector>
 
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index d776ad5e3b..42b1932ac0 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -27,7 +27,6 @@
 #include "BranchList.h"
 #include "buffer_funcs.h"
 #include "Buffer.h"
-#include "BufferParams.h"
 #include "BufferView.h"
 #include "CiteEnginesList.h"
 #include "Color.h"
diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h
index 2ef9d250f9..73cc4d6b8b 100644
--- a/src/frontends/qt/GuiDocument.h
+++ b/src/frontends/qt/GuiDocument.h
@@ -42,10 +42,8 @@
 
 namespace lyx {
 
-class BufferParams;
 class LayoutModuleList;
 class LyXModule;
-class TextClass;
 
 namespace support {
 	class TempFile;
diff --git a/src/frontends/qt/GuiErrorList.h b/src/frontends/qt/GuiErrorList.h
index 30d9e44350..bc84888253 100644
--- a/src/frontends/qt/GuiErrorList.h
+++ b/src/frontends/qt/GuiErrorList.h
@@ -16,8 +16,6 @@
 #include "ErrorList.h"
 #include "ui_ErrorListUi.h"
 
-class QListWidgetItem;
-
 namespace lyx {
 namespace frontend {
 
diff --git a/src/frontends/qt/GuiExternal.cpp b/src/frontends/qt/GuiExternal.cpp
index eb71aad4d1..3a4ab2c91e 100644
--- a/src/frontends/qt/GuiExternal.cpp
+++ b/src/frontends/qt/GuiExternal.cpp
@@ -21,7 +21,6 @@
 
 #include "insets/ExternalSupport.h"
 #include "insets/ExternalTemplate.h"
-#include "insets/InsetExternal.h"
 
 #include "graphics/epstools.h"
 #include "graphics/GraphicsCache.h"
diff --git a/src/frontends/qt/GuiIndex.cpp b/src/frontends/qt/GuiIndex.cpp
index 7800bad2d4..a59ac3953f 100644
--- a/src/frontends/qt/GuiIndex.cpp
+++ b/src/frontends/qt/GuiIndex.cpp
@@ -21,8 +21,6 @@
 #include "FuncRequest.h"
 #include "IndicesList.h"
 
-#include "insets/InsetIndex.h"
-
 #include <QPushButton>
 
 using namespace std;
diff --git a/src/frontends/qt/GuiLog.cpp b/src/frontends/qt/GuiLog.cpp
index 6851994701..16979138d8 100644
--- a/src/frontends/qt/GuiLog.cpp
+++ b/src/frontends/qt/GuiLog.cpp
@@ -21,7 +21,6 @@
 #include "frontends/Clipboard.h"
 
 #include "support/docstring.h"
-#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
diff --git a/src/frontends/qt/GuiLyXFiles.h b/src/frontends/qt/GuiLyXFiles.h
index 4d762fc20c..e22dafc2ef 100644
--- a/src/frontends/qt/GuiLyXFiles.h
+++ b/src/frontends/qt/GuiLyXFiles.h
@@ -18,12 +18,8 @@
 
 #include <vector>
 
-class QListWidgetItem;
-
 namespace lyx {
 
-class Format;
-
 namespace frontend {
 
 class GuiLyXFiles : public GuiDialog, public Ui::LyXFilesUi
diff --git a/src/frontends/qt/GuiNote.cpp b/src/frontends/qt/GuiNote.cpp
index 6c87850d40..a70a809dfa 100644
--- a/src/frontends/qt/GuiNote.cpp
+++ b/src/frontends/qt/GuiNote.cpp
@@ -15,8 +15,6 @@
 #include "FuncRequest.h"
 #include "support/gettext.h"
 
-#include "insets/InsetNote.h"
-
 using namespace std;
 
 namespace lyx {
diff --git a/src/frontends/qt/GuiPainter.h b/src/frontends/qt/GuiPainter.h
index 22d69a7fe3..2e2a7f2ec8 100644
--- a/src/frontends/qt/GuiPainter.h
+++ b/src/frontends/qt/GuiPainter.h
@@ -21,8 +21,6 @@
 #include <QPainterPath>
 #include <stack>
 
-class QString;
-
 namespace lyx {
 
 class FontInfo;
diff --git a/src/frontends/qt/GuiPhantom.cpp b/src/frontends/qt/GuiPhantom.cpp
index 973ec823c0..1aff3afd3c 100644
--- a/src/frontends/qt/GuiPhantom.cpp
+++ b/src/frontends/qt/GuiPhantom.cpp
@@ -14,8 +14,6 @@
 #include "FuncRequest.h"
 #include "support/gettext.h"
 
-#include "insets/InsetPhantom.h"
-
 using namespace std;
 
 namespace lyx {
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 093efe0e55..50760ed13a 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -19,7 +19,6 @@
 #include "GuiFontExample.h"
 #include "GuiFontLoader.h"
 #include "GuiKeySymbol.h"
-#include "GuiLyXFiles.h"
 #include "GuiView.h"
 #include "qt_helpers.h"
 #include "Validator.h"
@@ -31,7 +30,6 @@
 #include "ConverterCache.h"
 #include "FontEnums.h"
 #include "FuncRequest.h"
-#include "KeyMap.h"
 #include "KeySequence.h"
 #include "Language.h"
 #include "LyXAction.h"
diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h
index cb810c57f7..90cf142185 100644
--- a/src/frontends/qt/GuiPrefs.h
+++ b/src/frontends/qt/GuiPrefs.h
@@ -50,10 +50,6 @@
 
 namespace lyx {
 
-class Converters;
-class Formats;
-class Movers;
-
 namespace frontend {
 
 class PrefModule;
diff --git a/src/frontends/qt/GuiSelectionManager.h b/src/frontends/qt/GuiSelectionManager.h
index 7a7d71d7e7..dbf93893e9 100644
--- a/src/frontends/qt/GuiSelectionManager.h
+++ b/src/frontends/qt/GuiSelectionManager.h
@@ -15,9 +15,7 @@
 #include <QObject>
 
 class QAbstractItemModel;
-class QAbstractListModel;
 class QModelIndex;
-class QListView;
 class QPushButton;
 class QVariant;
 class QAbstractItemView;
diff --git a/src/frontends/qt/GuiSpellchecker.h b/src/frontends/qt/GuiSpellchecker.h
index 79c70880f0..b113e75513 100644
--- a/src/frontends/qt/GuiSpellchecker.h
+++ b/src/frontends/qt/GuiSpellchecker.h
@@ -22,8 +22,6 @@ class QListWidgetItem;
 
 namespace lyx {
 
-class docstring_list;
-
 namespace frontend {
 
 class SpellcheckerWidget : public QTabWidget
diff --git a/src/frontends/qt/GuiTabular.cpp b/src/frontends/qt/GuiTabular.cpp
index 1df93d86ab..ce28491b34 100644
--- a/src/frontends/qt/GuiTabular.cpp
+++ b/src/frontends/qt/GuiTabular.cpp
@@ -31,8 +31,6 @@
 #include "LyX.h"
 #include "LyXRC.h"
 
-#include "insets/InsetTabular.h"
-
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/lstrings.h"
diff --git a/src/frontends/qt/GuiToc.cpp b/src/frontends/qt/GuiToc.cpp
index 793ee1efd2..e9ee840fd8 100644
--- a/src/frontends/qt/GuiToc.cpp
+++ b/src/frontends/qt/GuiToc.cpp
@@ -14,7 +14,6 @@
 
 #include "GuiToc.h"
 #include "GuiView.h"
-#include "DockView.h"
 #include "TocWidget.h"
 #include "qt_helpers.h"
 
diff --git a/src/frontends/qt/GuiToc.h b/src/frontends/qt/GuiToc.h
index 7e6df1db1b..7add981050 100644
--- a/src/frontends/qt/GuiToc.h
+++ b/src/frontends/qt/GuiToc.h
@@ -20,7 +20,6 @@
 namespace lyx {
 namespace frontend {
 
-class TocModel;
 class TocWidget;
 
 class GuiToc : public DockView
diff --git a/src/frontends/qt/GuiToolbar.h b/src/frontends/qt/GuiToolbar.h
index 8f4d4d927f..53f3c9a454 100644
--- a/src/frontends/qt/GuiToolbar.h
+++ b/src/frontends/qt/GuiToolbar.h
@@ -26,17 +26,12 @@ class QSettings;
 
 namespace lyx {
 
-class DocumentClass;
-class Inset;
-
 namespace frontend {
 
 class Action;
 class GuiCommandBuffer;
-class GuiLayoutFilterModel;
 class GuiToolbar;
 class GuiView;
-class LayoutBox;
 class ToolbarInfo;
 class ToolbarItem;
 
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 2da9ce39c9..24a7eb809e 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -73,9 +73,7 @@
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
 #include "support/FileName.h"
-#include "support/filetools.h"
 #include "support/gettext.h"
-#include "support/filetools.h"
 #include "support/ForkedCalls.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
diff --git a/src/frontends/qt/GuiWorkArea.h b/src/frontends/qt/GuiWorkArea.h
index d64dfe85ce..2f155bf7c1 100644
--- a/src/frontends/qt/GuiWorkArea.h
+++ b/src/frontends/qt/GuiWorkArea.h
@@ -22,14 +22,13 @@
 #include <QTabBar>
 #include <QTabWidget>
 
-class QDragEnterEvent;
-class QDropEvent;
 class QToolButton;
 class QWidget;
 
 namespace lyx {
 
 class Buffer;
+class BufferView;
 class FuncRequest;
 
 namespace frontend {
diff --git a/src/frontends/qt/GuiWorkArea_Private.h b/src/frontends/qt/GuiWorkArea_Private.h
index 39130162ad..e716323916 100644
--- a/src/frontends/qt/GuiWorkArea_Private.h
+++ b/src/frontends/qt/GuiWorkArea_Private.h
@@ -22,8 +22,6 @@
 
 namespace lyx {
 
-class Buffer;
-
 namespace frontend {
 
 class GuiCompleter;
diff --git a/src/frontends/qt/LayoutBox.h b/src/frontends/qt/LayoutBox.h
index 3980b6f0e6..a3d174e01a 100644
--- a/src/frontends/qt/LayoutBox.h
+++ b/src/frontends/qt/LayoutBox.h
@@ -22,9 +22,6 @@
 
 namespace lyx {
 
-class DocumentClass;
-class Inset;
-
 namespace frontend {
 
 class GuiView;
diff --git a/src/frontends/qt/LyXFileDialog.h b/src/frontends/qt/LyXFileDialog.h
index 60d7fd2d6d..769dc60d8c 100644
--- a/src/frontends/qt/LyXFileDialog.h
+++ b/src/frontends/qt/LyXFileDialog.h
@@ -16,8 +16,6 @@
 
 #include <QFileDialog>
 
-class QToolButton;
-
 namespace lyx {
 
 class LyXFileDialog : public QFileDialog
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 5bf058f8b0..03fed5cda6 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -29,7 +29,6 @@
 #include "Buffer.h"
 #include "BufferList.h"
 #include "BufferParams.h"
-#include "BufferView.h"
 #include "Converter.h"
 #include "CutAndPaste.h"
 #include "Floating.h"
diff --git a/src/frontends/qt/PanelStack.h b/src/frontends/qt/PanelStack.h
index 5c470aae21..220afeec79 100644
--- a/src/frontends/qt/PanelStack.h
+++ b/src/frontends/qt/PanelStack.h
@@ -18,10 +18,7 @@
 #include <QHash>
 #include <QWidget>
 
-class QAbstractButton;
 class QHideEvent;
-class QLineEdit;
-class QPushButton;
 class QStackedWidget;
 class QTimer;
 class QTreeWidget;
diff --git a/src/frontends/qt/TocModel.h b/src/frontends/qt/TocModel.h
index ad65cdc288..b2d74a2b51 100644
--- a/src/frontends/qt/TocModel.h
+++ b/src/frontends/qt/TocModel.h
@@ -19,7 +19,6 @@
 
 namespace lyx {
 
-class Buffer;
 class BufferView;
 class DocIterator;
 class FuncRequest;
diff --git a/src/frontends/qt/qt_helpers.h b/src/frontends/qt/qt_helpers.h
index f0e535fe81..aff144b055 100644
--- a/src/frontends/qt/qt_helpers.h
+++ b/src/frontends/qt/qt_helpers.h
@@ -25,17 +25,13 @@
 
 class QComboBox;
 class QLineEdit;
-class QCheckBox;
 class QString;
 class QWidget;
-template <class T> class QList;
 
 namespace lyx {
 
 namespace support { class FileName; }
 
-class BufferParams;
-
 namespace frontend {
 
 class LengthCombo;
diff --git a/src/graphics/GraphicsCacheItem.h b/src/graphics/GraphicsCacheItem.h
index 6f7f968bc6..ba5efe6b2a 100644
--- a/src/graphics/GraphicsCacheItem.h
+++ b/src/graphics/GraphicsCacheItem.h
@@ -40,7 +40,6 @@ namespace support { class FileName; }
 namespace graphics {
 
 class Image;
-class Converter;
 
 /// A graphics::Cache item holder.
 class CacheItem {
diff --git a/src/graphics/PreviewImage.h b/src/graphics/PreviewImage.h
index 6b5ac7e66c..bea2553eeb 100644
--- a/src/graphics/PreviewImage.h
+++ b/src/graphics/PreviewImage.h
@@ -22,7 +22,6 @@ class Dimension;
 
 namespace graphics {
 
-class Cache;
 class PreviewLoader;
 class Image;
 
diff --git a/src/insets/ExternalTransforms.h b/src/insets/ExternalTransforms.h
index e880158dc1..10c3dccd12 100644
--- a/src/insets/ExternalTransforms.h
+++ b/src/insets/ExternalTransforms.h
@@ -27,8 +27,6 @@
 
 namespace lyx {
 
-class Lexer;
-
 namespace external {
 
 /*
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 5557e25fc9..d2be340195 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -31,7 +31,6 @@
 
 namespace lyx {
 
-class BiblioInfo;
 class Buffer;
 class BufferView;
 class Change;
@@ -59,11 +58,9 @@ class MathAtom;
 class MetricsInfo;
 class OutputParams;
 class PainterInfo;
-class ParConstIterator;
 class ParIterator;
 class Text;
 class TocBackend;
-class TocList;
 class XMLStream;
 class otexstream;
 
diff --git a/src/insets/InsetBibitem.h b/src/insets/InsetBibitem.h
index 6eae701f27..2a210e8c90 100644
--- a/src/insets/InsetBibitem.h
+++ b/src/insets/InsetBibitem.h
@@ -18,8 +18,6 @@
 
 namespace lyx {
 
-class BiblioInfo;
-
 /////////////////////////////////////////////////////////////////////////
 //
 // InsetBibItem
diff --git a/src/insets/InsetBibtex.h b/src/insets/InsetBibtex.h
index d82d8adab4..be7659f223 100644
--- a/src/insets/InsetBibtex.h
+++ b/src/insets/InsetBibtex.h
@@ -16,7 +16,6 @@
 
 namespace lyx {
 
-class BiblioInfo;
 class docstring_list;
 
 namespace support {
diff --git a/src/insets/InsetCaptionable.h b/src/insets/InsetCaptionable.h
index 2d5175ffd9..aa9a4cc426 100644
--- a/src/insets/InsetCaptionable.h
+++ b/src/insets/InsetCaptionable.h
@@ -20,6 +20,8 @@
 
 namespace lyx {
 
+class InsetCaption;
+
 class InsetCaptionable : public InsetCollapsible
 {
 public:
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index f07aec09f7..55044b47de 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -27,8 +27,6 @@ class InsetLayout;
 
 namespace support { class TempFile; }
 
-namespace frontend { class Painter; }
-
 /** A collapsible text inset
 
 */
diff --git a/src/insets/InsetERT.h b/src/insets/InsetERT.h
index 1e127fc095..72220d07d0 100644
--- a/src/insets/InsetERT.h
+++ b/src/insets/InsetERT.h
@@ -26,8 +26,6 @@ namespace lyx {
   versions of this inset.
 */
 
-class Language;
-
 class InsetERT : public InsetCollapsible {
 public:
 	///
diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h
index 5a9958cec8..a2542543e3 100644
--- a/src/insets/InsetInclude.h
+++ b/src/insets/InsetInclude.h
@@ -22,7 +22,6 @@
 
 namespace lyx {
 
-class BiblioInfo;
 class Buffer;
 class Dimension;
 class InsetCommandParams;
diff --git a/src/insets/InsetLabel.h b/src/insets/InsetLabel.h
index a5b9fefd82..54bfa07141 100644
--- a/src/insets/InsetLabel.h
+++ b/src/insets/InsetLabel.h
@@ -17,8 +17,6 @@
 
 namespace lyx {
 
-class Counter;
-
 class InsetLabel : public InsetCommand
 {
 public:
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index d758a1c3a4..51456c5eca 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -15,7 +15,6 @@
 #include "InsetLayout.h"
 
 #include "ColorSet.h"
-#include "Layout.h"
 #include "Lexer.h"
 #include "TextClass.h"
 
diff --git a/src/insets/InsetLine.h b/src/insets/InsetLine.h
index a6935445f2..361fbe5d6d 100644
--- a/src/insets/InsetLine.h
+++ b/src/insets/InsetLine.h
@@ -20,8 +20,6 @@
 
 namespace lyx {
 
-class LaTeXFeatures;
-
 class InsetLine : public InsetCommand
 {
 public:
diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp
index 37367add2c..24ad8e9118 100644
--- a/src/insets/InsetPhantom.cpp
+++ b/src/insets/InsetPhantom.cpp
@@ -15,7 +15,6 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
-#include "BufferParams.h"
 #include "Cursor.h"
 #include "Dimension.h"
 #include "DispatchResult.h"
diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h
index d71c25bd71..2ee107a192 100644
--- a/src/insets/InsetTabular.h
+++ b/src/insets/InsetTabular.h
@@ -44,7 +44,6 @@ class CursorSlice;
 class FuncStatus;
 class Lexer;
 class OutputParams;
-class Paragraph;
 class XMLStream;
 
 
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index 2f32bd2539..6ce6b5af07 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -23,9 +23,6 @@ class CompletionList;
 class CursorSlice;
 class Dimension;
 class ParagraphList;
-class InsetCaption;
-class InsetTabular;
-class TocBuilder;
 
 /**
  A text inset is like a TeX box to write full text
diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h
index 157fcb1a9b..3eae9295a4 100644
--- a/src/mathed/InsetMath.h
+++ b/src/mathed/InsetMath.h
@@ -64,7 +64,6 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
 
 */
 
-class Cursor;
 class OutputParams;
 class MetricsInfo;
 
diff --git a/src/mathed/InsetMathComment.h b/src/mathed/InsetMathComment.h
index e4dcf65869..0134f6cfa9 100644
--- a/src/mathed/InsetMathComment.h
+++ b/src/mathed/InsetMathComment.h
@@ -17,8 +17,6 @@
 
 namespace lyx {
 
-class latexkeys;
-
 /// Inset for end-of-line comments
 class InsetMathComment : public InsetMathNest {
 public:
diff --git a/src/mathed/InsetMathEnv.cpp b/src/mathed/InsetMathEnv.cpp
index 2eea5ac418..dd2c391681 100644
--- a/src/mathed/InsetMathEnv.cpp
+++ b/src/mathed/InsetMathEnv.cpp
@@ -14,7 +14,6 @@
 
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 
 #include "MetricsInfo.h"
 
diff --git a/src/mathed/InsetMathExInt.cpp b/src/mathed/InsetMathExInt.cpp
index 537870fd91..f0242c0bdb 100644
--- a/src/mathed/InsetMathExInt.cpp
+++ b/src/mathed/InsetMathExInt.cpp
@@ -15,7 +15,6 @@
 #include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "InsetMathSymbol.h"
 
 #include "support/debug.h"
diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h
index d78e0891a5..87f781aa7a 100644
--- a/src/mathed/InsetMathGrid.h
+++ b/src/mathed/InsetMathGrid.h
@@ -20,7 +20,6 @@
 
 namespace lyx {
 
-class BufferParams;
 class BufferView;
 
 /** Gridded math inset base class.
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index ebf8843d79..93c86c781f 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -38,7 +38,6 @@
 #include "InsetMathMacro.h"
 #include "InsetMathMacroTemplate.h"
 #include "MetricsInfo.h"
-#include "xml.h"
 #include "Paragraph.h"
 #include "ParIterator.h"
 #include "xml.h"
diff --git a/src/mathed/InsetMathMacroTemplate.cpp b/src/mathed/InsetMathMacroTemplate.cpp
index a152222cb6..294e24b073 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -22,7 +22,6 @@
 #include "MathStream.h"
 #include "MathParser.h"
 #include "MathSupport.h"
-#include "InsetMathMacroArgument.h"
 
 #include "Buffer.h"
 #include "BufferView.h"
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 9d88b1337b..ada0400f18 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -30,7 +30,6 @@
 #include "InsetMathUnknown.h"
 #include "MathAutoCorrect.h"
 #include "MathCompletionList.h"
-#include "MathData.h"
 #include "MathFactory.h"
 #include "InsetMathMacro.h"
 #include "InsetMathMacroArgument.h"
diff --git a/src/mathed/InsetMathNumber.cpp b/src/mathed/InsetMathNumber.cpp
index 5a35415786..593da68d97 100644
--- a/src/mathed/InsetMathNumber.cpp
+++ b/src/mathed/InsetMathNumber.cpp
@@ -12,7 +12,6 @@
 
 #include "InsetMathNumber.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "MathSupport.h"
 
 #include "MetricsInfo.h"
diff --git a/src/mathed/InsetMathTabular.cpp b/src/mathed/InsetMathTabular.cpp
index e4123a5655..565a71fb18 100644
--- a/src/mathed/InsetMathTabular.cpp
+++ b/src/mathed/InsetMathTabular.cpp
@@ -14,7 +14,6 @@
 
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 
 #include "MetricsInfo.h"
 
diff --git a/src/mathed/InsetMathXArrow.cpp b/src/mathed/InsetMathXArrow.cpp
index 2ea3b71b50..37445da1d8 100644
--- a/src/mathed/InsetMathXArrow.cpp
+++ b/src/mathed/InsetMathXArrow.cpp
@@ -16,7 +16,6 @@
 
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "MathSupport.h"
 
 #include "LaTeXFeatures.h"
diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp
index 2a4899a258..19d45d2069 100644
--- a/src/mathed/MacroTable.cpp
+++ b/src/mathed/MacroTable.cpp
@@ -20,7 +20,6 @@
 #include "InsetMathNest.h"
 
 #include "Buffer.h"
-#include "DocIterator.h"
 #include "InsetList.h"
 #include "Text.h"
 
diff --git a/src/mathed/MacroTable.h b/src/mathed/MacroTable.h
index acc4004109..e83be84b75 100644
--- a/src/mathed/MacroTable.h
+++ b/src/mathed/MacroTable.h
@@ -26,7 +26,6 @@ namespace lyx {
 class Buffer;
 class MathData;
 class InsetMathMacroTemplate;
-class Paragraph;
 class latexkeys;
 
 enum MacroType {
diff --git a/src/mathed/MathAtom.h b/src/mathed/MathAtom.h
index 5d20e69bbf..aa6e317f89 100644
--- a/src/mathed/MathAtom.h
+++ b/src/mathed/MathAtom.h
@@ -44,7 +44,6 @@ Andre'
 
 namespace lyx {
 
-class Inset;
 class InsetMath;
 
 class MathAtom {
diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp
index be61c8a39c..16b64c6b7f 100644
--- a/src/mathed/MathRow.cpp
+++ b/src/mathed/MathRow.cpp
@@ -12,8 +12,6 @@
 
 #include "MathRow.h"
 
-#include "InsetMath.h"
-#include "MathClass.h"
 #include "MathData.h"
 #include "MathSupport.h"
 
diff --git a/src/support/SystemcallPrivate.h b/src/support/SystemcallPrivate.h
index 6ab479f73c..19771dfc73 100644
--- a/src/support/SystemcallPrivate.h
+++ b/src/support/SystemcallPrivate.h
@@ -20,8 +20,6 @@
 namespace lyx {
 namespace support {
 
-class Systemcall;
-
 /**
  * Outputs to the console terminal the line buffered standard output and
  * error of a spawned process when there is a controlling terminal and
diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
index dcf8acd011..3e594153cb 100644
--- a/src/support/lassert.cpp
+++ b/src/support/lassert.cpp
@@ -10,7 +10,8 @@
  */
 
 #include <config.h>
-#include <lassert.h>
+
+#include "support/lassert.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
@@ -21,13 +22,13 @@
 
 #include <boost/assert.hpp>
 
-#include <QString>
 
 #ifdef LYX_CALLSTACK_PRINTING
 #include <cstdio>
 #include <cstdlib>
 #include <execinfo.h>
 #include <cxxabi.h>
+#include <QString>
 #endif
 
 
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list