groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 53/80: [libgroff]: Improve header-file inclusion hygiene.


From: G. Branden Robinson
Subject: [groff] 53/80: [libgroff]: Improve header-file inclusion hygiene.
Date: Sat, 30 Nov 2024 04:02:24 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit a0a74c94e90df3b9d4531cf07b37275bdb37d2ca
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 27 22:28:47 2024 -0600

    [libgroff]: Improve header-file inclusion hygiene.
    
    * src/include/itable.h:
    * src/include/lib.h:
    * src/include/ptable.h:
    * src/include/stringclass.h: Drop Autoconf "<config.h>"-inclusion
      boilerplate.
    
    Per Paul Eggert, "You shouldn't need to put "#include <config.h>" at the
    start of every source file. It needs to be included first at the start
    of every compilation unit; that's good enough.  The .cpp or .c file
    should include config.h first, and .h files should therefore not need to
    include config.h."
    
    See <https://lists.gnu.org/archive/html/groff/2024-11/msg00154.html>.
---
 ChangeLog                 | 19 +++++++++++++++++++
 src/include/itable.h      |  4 ----
 src/include/lib.h         |  4 ----
 src/include/ptable.h      |  4 ----
 src/include/stringclass.h |  4 ----
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6a03e4bff..1ac955c4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [libgroff]: Improve header-file inclusion hygiene.
+
+       * src/include/itable.h:
+       * src/include/lib.h:
+       * src/include/ptable.h:
+       * src/include/stringclass.h: Drop Autoconf "<config.h>"-inclusion
+       boilerplate.
+
+       Per Paul Eggert, "You shouldn't need to put "#include
+       <config.h>" at the start of every source file. It needs to be
+       included first at the start of every compilation unit; that's
+       good enough.  The .cpp or .c file should include config.h first,
+       and .h files should therefore not need to include config.h."
+
+       See
+       <https://lists.gnu.org/archive/html/groff/2024-11/msg00154.html>.
+
 2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tfmtodit]: Align with modern groff conventions.
diff --git a/src/include/itable.h b/src/include/itable.h
index 61af83894..3e55fd008 100644
--- a/src/include/itable.h
+++ b/src/include/itable.h
@@ -16,10 +16,6 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <assert.h>
 
 // This groffism can be replaced with std::unordered_map<int, T> if/when
diff --git a/src/include/lib.h b/src/include/lib.h
index b6c98caee..c65efe1aa 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -19,10 +19,6 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #ifndef GROFF_LIB_H
 #define GROFF_LIB_H
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #if defined(__INTERIX) && !defined(_ALL_SOURCE)
 #define _ALL_SOURCE
 #endif
diff --git a/src/include/ptable.h b/src/include/ptable.h
index 24e0caa7d..cd6faa291 100644
--- a/src/include/ptable.h
+++ b/src/include/ptable.h
@@ -16,10 +16,6 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <assert.h>
 #include <stdlib.h> // free(), malloc()
 #include <string.h> // strcmp(), strcpy(), strlen()
diff --git a/src/include/stringclass.h b/src/include/stringclass.h
index ded627d2f..eefface17 100644
--- a/src/include/stringclass.h
+++ b/src/include/stringclass.h
@@ -16,10 +16,6 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <assert.h>
 #include <string.h> // memcmp(), strlen()
 #include <stdio.h> // FILE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]