Refactoring patches

Yuriy Skalko yuriy.skalko at gmail.com
Thu Oct 15 07:14:50 UTC 2020


> Agreed. Unfortunately I suspect that we can achive this only by manually
> going through the suspects proposed by some tools instead of just
> taking their results.

Here are manual cleaning of some headers is separate patches. But I
don't think I'll be able to process all the headers.

>> And not to depend on transitive (or recursive as you called)
>> includes since they are fragile and not reliable.
> 
> I do not think this is good idea, our include section would explode
> if we really tried to fix all these
> 
> Pavel

Why? Java and Pascal have packages/units without transitive imports and
have no explosion problem.


Yuriy
-------------- next part --------------
From 71d63945fdf3d95f7616abf97f64a439fdcd44c1 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 14 Oct 2020 16:43:44 +0300
Subject: [PATCH 1/9] Remove BufferParams.h from BiblioInfo.h

---
 src/BiblioInfo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/BiblioInfo.h b/src/BiblioInfo.h
index a08204ed5f..34bbaf810c 100644
--- a/src/BiblioInfo.h
+++ b/src/BiblioInfo.h
@@ -17,7 +17,6 @@
 
 #include "support/docstring.h"
 
-#include "BufferParams.h"
 #include "Citation.h"
 
 #include <map>
@@ -28,6 +27,8 @@
 namespace lyx {
 
 class Buffer;
+class BufferParams;
+class XMLStream;
 
 /// \param latex_str a LaTeX command, "cite", "Citep*", etc
 CitationStyle citationStyleFromString(std::string const & latex_str,
-- 
2.28.0.windows.1

-------------- next part --------------
From 2cd647b39fab427d03d9983428e937bfce65d5ce Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 14 Oct 2020 23:40:05 +0300
Subject: [PATCH 2/9] Move BufferParams.h from Language.h

---
 src/Language.cpp | 1 +
 src/Language.h   | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Language.cpp b/src/Language.cpp
index 84e03b1e9e..03146c358a 100644
--- a/src/Language.cpp
+++ b/src/Language.cpp
@@ -15,6 +15,7 @@
 
 #include "Language.h"
 
+#include "BufferParams.h"
 #include "Encoding.h"
 #include "LaTeXFonts.h"
 #include "Lexer.h"
diff --git a/src/Language.h b/src/Language.h
index c810974727..ad8badffbc 100644
--- a/src/Language.h
+++ b/src/Language.h
@@ -15,8 +15,6 @@
 #ifndef LANGUAGE_H
 #define LANGUAGE_H
 
-#include "BufferParams.h"
-
 #include "support/docstring.h"
 #include "support/trivstring.h"
 
@@ -29,6 +27,7 @@ namespace lyx {
 
 namespace support { class FileName; }
 
+class BufferParams;
 class Encoding;
 class Lexer;
 
-- 
2.28.0.windows.1

-------------- next part --------------
From 51475cee880ab6a4628c3d86e5e559293ce0e3e1 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Wed, 14 Oct 2020 23:56:14 +0300
Subject: [PATCH 3/9] Clean includes in buffer_funcs.cpp

---
 src/buffer_funcs.cpp | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp
index ead443a99c..8ac7e97360 100644
--- a/src/buffer_funcs.cpp
+++ b/src/buffer_funcs.cpp
@@ -15,32 +15,10 @@
 #include "buffer_funcs.h"
 #include "Buffer.h"
 #include "BufferList.h"
-#include "BufferParams.h"
-#include "DocIterator.h"
-#include "Counters.h"
-#include "ErrorList.h"
-#include "Floating.h"
-#include "FloatList.h"
-#include "InsetList.h"
-#include "Language.h"
-#include "LaTeX.h"
-#include "Layout.h"
-#include "LyX.h"
 #include "LyXVC.h"
-#include "TextClass.h"
-#include "Paragraph.h"
-#include "ParagraphList.h"
-#include "ParagraphParameters.h"
-#include "ParIterator.h"
-#include "TexRow.h"
-#include "Text.h"
-#include "TocBackend.h"
 
 #include "frontends/alert.h"
 
-#include "insets/InsetBibitem.h"
-#include "insets/InsetInclude.h"
-
 #include "support/lassert.h"
 #include "support/convert.h"
 #include "support/debug.h"
@@ -48,7 +26,6 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/mutex.h"
-#include "support/textutils.h"
 
 using namespace std;
 using namespace lyx::support;
-- 
2.28.0.windows.1

-------------- next part --------------
From d918d809e9b73d1e4822d4eb0506c201abbe0912 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 15 Oct 2020 00:17:45 +0300
Subject: [PATCH 4/9] Clean includes in TextMetrics.cpp

---
 src/TextMetrics.cpp | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 07c2b27990..c7d9e18acb 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -20,14 +20,11 @@
 #include "TextMetrics.h"
 
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "CoordCache.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
-#include "InsetList.h"
-#include "Language.h"
 #include "Layout.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
@@ -42,7 +39,6 @@
 #include "mathed/InsetMathMacroTemplate.h"
 
 #include "frontends/FontMetrics.h"
-#include "frontends/Painter.h"
 #include "frontends/NullPainter.h"
 
 #include "support/convert.h"
-- 
2.28.0.windows.1

-------------- next part --------------
From 64593b8c0ba05892ddd6c845cc7a5c565a056252 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 15 Oct 2020 00:25:55 +0300
Subject: [PATCH 5/9] Remove CutAndPaste.h from Trans.cpp

---
 src/Trans.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/Trans.cpp b/src/Trans.cpp
index b33fa756ed..02c8f864ab 100644
--- a/src/Trans.cpp
+++ b/src/Trans.cpp
@@ -16,7 +16,6 @@
 #include "Buffer.h"
 #include "BufferView.h"
 #include "Cursor.h"
-#include "CutAndPaste.h"
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "Text.h"
-- 
2.28.0.windows.1

-------------- next part --------------
From f367c60c4461d026f41a23a172bcf8e03e43c9da Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 15 Oct 2020 00:45:04 +0300
Subject: [PATCH 6/9] Clean Cursor and CursorSlice

---
 src/Cursor.cpp      | 4 ++--
 src/CursorSlice.cpp | 2 --
 src/CursorSlice.h   | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index 41cf26ec17..0d68c86807 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -14,12 +14,12 @@
 
 #include <config.h>
 
+#include "Cursor.h"
+
 #include "Buffer.h"
 #include "BufferView.h"
 #include "CoordCache.h"
-#include "Cursor.h"
 #include "CutAndPaste.h"
-#include "DispatchResult.h"
 #include "FuncCode.h"
 #include "FuncRequest.h"
 #include "Language.h"
diff --git a/src/CursorSlice.cpp b/src/CursorSlice.cpp
index 62fd92f362..20a163449f 100644
--- a/src/CursorSlice.cpp
+++ b/src/CursorSlice.cpp
@@ -20,8 +20,6 @@
 
 #include "support/debug.h"
 
-#include "insets/Inset.h"
-
 #include "mathed/InsetMath.h"
 #include "mathed/InsetMathMacro.h"
 
diff --git a/src/CursorSlice.h b/src/CursorSlice.h
index f6d60d8ce6..9f91ade9e9 100644
--- a/src/CursorSlice.h
+++ b/src/CursorSlice.h
@@ -24,7 +24,7 @@
 
 namespace lyx {
 
-class Inset;
+class InsetMath;
 class MathData;
 class Text;
 class Paragraph;
-- 
2.28.0.windows.1

-------------- next part --------------
From db1538fbdf75edc107aa571d1cee75c5414c19ce Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 15 Oct 2020 00:51:07 +0300
Subject: [PATCH 7/9] Clean output_latex

---
 src/output_latex.cpp | 2 --
 src/output_latex.h   | 1 -
 2 files changed, 3 deletions(-)

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index f690134a3c..ea474dfa6e 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -19,8 +19,6 @@
 #include "Font.h"
 #include "InsetList.h"
 #include "Language.h"
-#include "LaTeXFeatures.h"
-#include "Layout.h"
 #include "LyXRC.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
diff --git a/src/output_latex.h b/src/output_latex.h
index a25499bd55..65a41516e1 100644
--- a/src/output_latex.h
+++ b/src/output_latex.h
@@ -24,7 +24,6 @@ namespace lyx {
 class Buffer;
 class BufferParams;
 class Encoding;
-class Layout;
 class Paragraph;
 class OutputParams;
 class Text;
-- 
2.28.0.windows.1

-------------- next part --------------
From fb6928fee52b4604144f865a592b1129cb64f702 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 15 Oct 2020 09:59:01 +0300
Subject: [PATCH 8/9] Move Cursor.h from Clipboard.h

---
 src/CutAndPaste.h                   | 4 ++++
 src/LyX.cpp                         | 1 +
 src/frontends/Clipboard.h           | 5 +++--
 src/frontends/qt/GuiApplication.cpp | 1 +
 src/frontends/qt/Menus.cpp          | 1 +
 src/insets/InsetInfo.cpp            | 1 +
 src/insets/InsetLabel.cpp           | 1 +
 src/mathed/InsetMathHull.cpp        | 1 +
 8 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index 54ca4e3dfd..fe68be5e20 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -18,6 +18,8 @@
 
 #include "support/docstring.h"
 
+#include "insets/Inset.h"
+
 #include "frontends/Clipboard.h"
 
 #include <vector>
@@ -28,6 +30,8 @@ namespace lyx {
 class ErrorList;
 class InsetText;
 class Cursor;
+class CursorData;
+class CursorSlice;
 class ParagraphList;
 
 namespace cap {
diff --git a/src/LyX.cpp b/src/LyX.cpp
index a8bfd60543..180c4d335b 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -27,6 +27,7 @@
 #include "ConverterCache.h"
 #include "Converter.h"
 #include "CutAndPaste.h"
+#include "DispatchResult.h"
 #include "EnchantChecker.h"
 #include "Encoding.h"
 #include "ErrorList.h"
diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h
index af617f5aec..ce85ab6a07 100644
--- a/src/frontends/Clipboard.h
+++ b/src/frontends/Clipboard.h
@@ -14,11 +14,12 @@
 #ifndef BASE_CLIPBOARD_H
 #define BASE_CLIPBOARD_H
 
-#include "Cursor.h"
-
 #include "support/strfwd.h"
 
 namespace lyx {
+
+class Cursor;
+
 namespace frontend {
 
 /**
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 9981f7f70b..4d88135f75 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -37,6 +37,7 @@
 #include "CmdDef.h"
 #include "Color.h"
 #include "Converter.h"
+#include "Cursor.h"
 #include "CutAndPaste.h"
 #include "ErrorList.h"
 #include "Font.h"
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 03fed5cda6..b433773ad5 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -30,6 +30,7 @@
 #include "BufferList.h"
 #include "BufferParams.h"
 #include "Converter.h"
+#include "Cursor.h"
 #include "CutAndPaste.h"
 #include "Floating.h"
 #include "FloatList.h"
diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index b96d7c9d89..3a61dfdccd 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -15,6 +15,7 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
+#include "Cursor.h"
 #include "CutAndPaste.h"
 #include "Font.h"
 #include "FuncRequest.h"
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index ffa267478e..eeced08451 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -18,6 +18,7 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
+#include "Cursor.h"
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 93c86c781f..4125bf6ee5 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -26,6 +26,7 @@
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "ColorSet.h"
+#include "Cursor.h"
 #include "CutAndPaste.h"
 #include "Encoding.h"
 #include "Exporter.h"
-- 
2.28.0.windows.1

-------------- next part --------------
From 7c6f779e2b80a7490e5d420e931443e4de9506b9 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 15 Oct 2020 10:04:32 +0300
Subject: [PATCH 9/9] Move Dimension.h from InsetIPA.h

---
 src/insets/InsetIPA.cpp | 1 +
 src/insets/InsetIPA.h   | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp
index 02dad4d455..1597d0d423 100644
--- a/src/insets/InsetIPA.cpp
+++ b/src/insets/InsetIPA.cpp
@@ -15,6 +15,7 @@
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Cursor.h"
+#include "Dimension.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "LaTeXFeatures.h"
diff --git a/src/insets/InsetIPA.h b/src/insets/InsetIPA.h
index e788b2b156..2df77ce159 100644
--- a/src/insets/InsetIPA.h
+++ b/src/insets/InsetIPA.h
@@ -14,13 +14,12 @@
 
 #include "InsetText.h"
 
-#include "Dimension.h"
-
 #include "support/unique_ptr.h"
 
 
 namespace lyx {
 
+class Dimension;
 class RenderPreview;
 
 namespace graphics {
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list