diff mbox series

[v4,01/15] Tidy #includes in a few files.

Message ID 20200504123416.243214-2-gprocida@google.com
State Committed
Headers show
Series Simplify regex and suppression parsing. | expand

Commit Message

Giuliano Procida May 4, 2020, 12:34 p.m. UTC
Following review of a recent change to move regex definitions into
their own files, this commit ensures that #include directives are
separated into categories and sorted alphabetically within the
categories, subject to known ordering constraints (such as "config.h"
first, "abg-internal.h" before visibility directives etc.).

There are no behavioural changes.

	* src/abg-corpus-priv.h: Separate and sort #include
	directives.
	* src/abg-corpus.cc: Ditto.
	* src/abg-regex.cc: Ditto.
	* src/abg-suppression-priv.h: Ditto.
	* src/abg-suppression.cc: Ditto.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-corpus-priv.h      |  4 ++--
 src/abg-corpus.cc          | 12 +++++++-----
 src/abg-regex.cc           |  3 ++-
 src/abg-suppression-priv.h |  4 ++--
 src/abg-suppression.cc     |  1 +
 5 files changed, 14 insertions(+), 10 deletions(-)

Comments

Matthias Maennich May 4, 2020, 12:49 p.m. UTC | #1
On Mon, May 04, 2020 at 01:34:02PM +0100, Giuliano Procida wrote:
>Following review of a recent change to move regex definitions into
>their own files, this commit ensures that #include directives are
>separated into categories and sorted alphabetically within the
>categories, subject to known ordering constraints (such as "config.h"
>first, "abg-internal.h" before visibility directives etc.).
>
>There are no behavioural changes.
>
>	* src/abg-corpus-priv.h: Separate and sort #include
>	directives.
>	* src/abg-corpus.cc: Ditto.
>	* src/abg-regex.cc: Ditto.
>	* src/abg-suppression-priv.h: Ditto.
>	* src/abg-suppression.cc: Ditto.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>---
> src/abg-corpus-priv.h      |  4 ++--
> src/abg-corpus.cc          | 12 +++++++-----
> src/abg-regex.cc           |  3 ++-
> src/abg-suppression-priv.h |  4 ++--
> src/abg-suppression.cc     |  1 +
> 5 files changed, 14 insertions(+), 10 deletions(-)
>
>diff --git a/src/abg-corpus-priv.h b/src/abg-corpus-priv.h
>index e65f7c8f..2b42007b 100644
>--- a/src/abg-corpus-priv.h
>+++ b/src/abg-corpus-priv.h
>@@ -29,9 +29,9 @@
> #ifndef __ABG_CORPUS_PRIV_H__
> #define __ABG_CORPUS_PRIV_H__
>
>-#include "abg-sptr-utils.h"
>-#include "abg-regex.h"
> #include "abg-internal.h"
>+#include "abg-regex.h"
>+#include "abg-sptr-utils.h"
>
> namespace abigail
> {
>diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
>index 2dcc0ac7..7f763d56 100644
>--- a/src/abg-corpus.cc
>+++ b/src/abg-corpus.cc
>@@ -21,23 +21,25 @@
> /// @file
>
> #include "config.h"
>+
>+#include <algorithm>
>+#include <cassert>
> #include <cstdio>
> #include <cstring>
>-#include <cassert>
> #include <stdexcept>
>-#include <algorithm>
>
> #include "abg-cxx-compat.h"
> #include "abg-internal.h"
>+
> // <headers defining libabigail's API go under here>
> ABG_BEGIN_EXPORT_DECLARATIONS
>
>-#include "abg-sptr-utils.h"
>-#include "abg-ir.h"
> #include "abg-corpus.h"
>+#include "abg-ir.h"
> #include "abg-reader.h"
>-#include "abg-writer.h"
>+#include "abg-sptr-utils.h"
> #include "abg-tools-utils.h"
>+#include "abg-writer.h"
>
> #if WITH_ZIP_ARCHIVE
> #include "abg-libzip-utils.h"
>diff --git a/src/abg-regex.cc b/src/abg-regex.cc
>index 79a89033..cf0663a2 100644
>--- a/src/abg-regex.cc
>+++ b/src/abg-regex.cc
>@@ -24,8 +24,9 @@
> ///
>
> #include <sstream>
>-#include "abg-sptr-utils.h"
>+
> #include "abg-regex.h"
>+#include "abg-sptr-utils.h"
>
> namespace abigail
> {
>diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
>index c37ceff6..0ccfde05 100644
>--- a/src/abg-suppression-priv.h
>+++ b/src/abg-suppression-priv.h
>@@ -29,9 +29,9 @@
> #define __ABG_SUPPRESSION_PRIV_H__
>
> #include "abg-fwd.h"
>-#include "abg-suppression.h"
>-#include "abg-sptr-utils.h"
> #include "abg-regex.h"
>+#include "abg-sptr-utils.h"
>+#include "abg-suppression.h"
>
> namespace abigail
> {
>diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
>index 34eb9616..8b5712fb 100644
>--- a/src/abg-suppression.cc
>+++ b/src/abg-suppression.cc
>@@ -26,6 +26,7 @@
> /// libabigail.
>
> #include <algorithm>
>+
> #include "abg-cxx-compat.h"
> #include "abg-internal.h"
>
>-- 
>2.26.2.526.g744177e7f7-goog
>
Dodji Seketeli May 11, 2020, 1:24 p.m. UTC | #2
Giuliano Procida <gprocida@google.com> a ?crit:

> Following review of a recent change to move regex definitions into
> their own files, this commit ensures that #include directives are
> separated into categories and sorted alphabetically within the categories, 

Just as a comment, I don't have a strong opinion about alphabetically
sorting header files.  I don't intend to require that for the project.
I am not rejecting this change however.

> subject to known ordering constraints (such as
> "config.h" first, "abg-internal.h" before visibility directives etc.).

These ordering constraints are however important to respect for obvious
reasons.  So these are the ones I am interested in :-)

Thank you for doing this.

>
> There are no behavioural changes.
>
> 	* src/abg-corpus-priv.h: Separate and sort #include
> 	directives.
> 	* src/abg-corpus.cc: Ditto.
> 	* src/abg-regex.cc: Ditto.
> 	* src/abg-suppression-priv.h: Ditto.
> 	* src/abg-suppression.cc: Ditto.

Applied to master, thanks!

Cheers,
diff mbox series

Patch

diff --git a/src/abg-corpus-priv.h b/src/abg-corpus-priv.h
index e65f7c8f..2b42007b 100644
--- a/src/abg-corpus-priv.h
+++ b/src/abg-corpus-priv.h
@@ -29,9 +29,9 @@ 
 #ifndef __ABG_CORPUS_PRIV_H__
 #define __ABG_CORPUS_PRIV_H__
 
-#include "abg-sptr-utils.h"
-#include "abg-regex.h"
 #include "abg-internal.h"
+#include "abg-regex.h"
+#include "abg-sptr-utils.h"
 
 namespace abigail
 {
diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
index 2dcc0ac7..7f763d56 100644
--- a/src/abg-corpus.cc
+++ b/src/abg-corpus.cc
@@ -21,23 +21,25 @@ 
 /// @file
 
 #include "config.h"
+
+#include <algorithm>
+#include <cassert>
 #include <cstdio>
 #include <cstring>
-#include <cassert>
 #include <stdexcept>
-#include <algorithm>
 
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
+
 // <headers defining libabigail's API go under here>
 ABG_BEGIN_EXPORT_DECLARATIONS
 
-#include "abg-sptr-utils.h"
-#include "abg-ir.h"
 #include "abg-corpus.h"
+#include "abg-ir.h"
 #include "abg-reader.h"
-#include "abg-writer.h"
+#include "abg-sptr-utils.h"
 #include "abg-tools-utils.h"
+#include "abg-writer.h"
 
 #if WITH_ZIP_ARCHIVE
 #include "abg-libzip-utils.h"
diff --git a/src/abg-regex.cc b/src/abg-regex.cc
index 79a89033..cf0663a2 100644
--- a/src/abg-regex.cc
+++ b/src/abg-regex.cc
@@ -24,8 +24,9 @@ 
 ///
 
 #include <sstream>
-#include "abg-sptr-utils.h"
+
 #include "abg-regex.h"
+#include "abg-sptr-utils.h"
 
 namespace abigail
 {
diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
index c37ceff6..0ccfde05 100644
--- a/src/abg-suppression-priv.h
+++ b/src/abg-suppression-priv.h
@@ -29,9 +29,9 @@ 
 #define __ABG_SUPPRESSION_PRIV_H__
 
 #include "abg-fwd.h"
-#include "abg-suppression.h"
-#include "abg-sptr-utils.h"
 #include "abg-regex.h"
+#include "abg-sptr-utils.h"
+#include "abg-suppression.h"
 
 namespace abigail
 {
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index 34eb9616..8b5712fb 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -26,6 +26,7 @@ 
 /// libabigail.
 
 #include <algorithm>
+
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"