gbranden pushed a commit to branch master
in repository groff.

commit e93153e327aaffd9365d3f741b001d49642b2b0f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Mar 29 22:09:06 2026 -0500

    [libgroff]: Improve #include discipline (5/5).
    
    To illuminate inter-module dependencies, get header files out of the
    business of `#include`-ing other header files, in favor of putting
    preprocessor inclusions only in translation units (C/C++ source files).
    Annotate dependencies.
    
    * src/include/lf.h: Move preprocessor inclusion of "stringclass.h" from
      here...
    * src/libs/libgroff/change_lf.cpp: ...to here.
    
    * src/libs/libgroff/lf.cpp: Drop unnecessary inclusion of "lib.h".
---
 ChangeLog                       | 15 +++++++++++++++
 src/include/lf.h                |  2 --
 src/libs/libgroff/change_lf.cpp |  3 ++-
 src/libs/libgroff/lf.cpp        |  8 +++-----
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 58ce5b8f4..ce0275081 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-03-29  G. Branden Robinson <[email protected]>
+
+       [libgroff]: Improve #include discipline.
+
+       To illuminate inter-module dependencies, get header files out of
+       the business of `#include`-ing other header files, in favor of
+       putting preprocessor inclusions only in translation units (C/C++
+       source files).  Annotate dependencies.
+
+       * src/include/lf.h: Move preprocessor inclusion of
+       "stringclass.h" from here...
+       * src/libs/libgroff/change_lf.cpp: ...to here.
+       * src/libs/libgroff/lf.cpp: Drop unnecessary inclusion of
+       "lib.h".
+
 2026-03-29  G. Branden Robinson <[email protected]>
 
        [libgroff]: Improve #include discipline.
diff --git a/src/include/lf.h b/src/include/lf.h
index 6b932c377..2a931ef8d 100644
--- a/src/include/lf.h
+++ b/src/include/lf.h
@@ -17,8 +17,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/>. */
 
-#include "stringclass.h"
-
 // libgroff/change_lf.cpp
 void change_filename(const char *);
 void change_lineno(int);
diff --git a/src/libs/libgroff/change_lf.cpp b/src/libs/libgroff/change_lf.cpp
index cb76df61e..e92b010cc 100644
--- a/src/libs/libgroff/change_lf.cpp
+++ b/src/libs/libgroff/change_lf.cpp
@@ -23,7 +23,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 #include <string.h>
 
-#include "lf.h"
+#include "stringclass.h" // prerequisite of lf.h; string
+#include "lf.h" // change_filename(), change_lineno()
 #include "lib.h" // strsave()
 
 extern const char *current_filename;
diff --git a/src/libs/libgroff/lf.cpp b/src/libs/libgroff/lf.cpp
index c9a19f878..4c607fb9d 100644
--- a/src/libs/libgroff/lf.cpp
+++ b/src/libs/libgroff/lf.cpp
@@ -23,11 +23,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 
 #include <ctype.h>
 
-#include "lib.h"
-
-#include "cset.h"
-#include "stringclass.h"
-#include "lf.h"
+#include "cset.h" // csdigit()
+#include "stringclass.h" // prerequisite for lf.h; string
+#include "lf.h" // change_filename(), change_lineno()
 
 bool interpret_lf_request_arguments(const char *p)
 {

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to