bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Collin Funk <collin.funk1@gmail.com>
Cc: Jim Meyering <jim@meyering.net>
Subject: Re: syntax-check rule to silence -Winclude-next-absolute-path warning
Date: Sun, 18 Feb 2024 21:33:47 +0100	[thread overview]
Message-ID: <68001545.3F2A3RajZp@nimes> (raw)
In-Reply-To: <bb22275c-819d-4543-9f4f-9dff65116c81@gmail.com>

Collin Funk wrote:
> I attached a patch that seems to work alright. I'm not the greatest with GNU Make so it isn't very pretty. Feel free to modify it as much as you would like.
> 
> Here is some sample output from Coreutils. One or two are real so I'll submit a patch there.
> 
> [collin@debian coreutils]$ make sc_verify_absolute_include_headers
> verify_absolute_include_headers
> maint.mk: Use #include <sys/stat.h> instead of  #include "sys/stat.h" in src/od.c
> maint.mk: Use #include <error.h> instead of  #include "error.h" in src/od.c
> maint.mk: Use #include <getopt.h> instead of  #include "getopt.h" in src/shuf.c
> maint.mk: Use #include <getopt.h> instead of  #include "getopt.h" in src/stat.c
> maint.mk: Use #include <error.h> instead of  #include "error.h" in src/system.h

Very nice! I committed your patch, just at a different location in maint.mk (near
the handling of <config.h>).

Also, I added references to the Gnulib documentation:


2024-02-18  Bruno Haible  <bruno@clisp.org>

	maint.mk: Add more comments.
	* top/maint.mk: Reference the Gnulib documentation where suitable.

diff --git a/top/maint.mk b/top/maint.mk
index 9725976dae..5746b911dd 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -503,6 +503,7 @@ sc_prohibit_have_config_h:
 # Nearly all .c files must include <config.h>.  However, we also permit this
 # via inclusion of a package-specific header, if cfg.mk specified one.
 # config_h_header must be suitable for grep -E.
+# Rationale: The Gnulib documentation, node 'Include <config.h>'.
 config_h_header ?= <config\.h>
 sc_require_config_h:
 	@require='^# *include $(config_h_header)'			\
@@ -526,6 +527,7 @@ perl_config_h_first_ =							\
 
 # You must include <config.h> before including any other header file.
 # This can possibly be via a package-specific header, if given by cfg.mk.
+# Rationale: The Gnulib documentation, node 'Include <config.h>'.
 sc_require_config_h_first:
 	@if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then	\
 	  files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.c$$') &&		\
@@ -607,7 +609,8 @@ gl_absolute_include_headers_ ?= \
   wctype.h
 
 # Suggest using '#include <header.h>' instead of '#include "header.h"' for
-# headers that substitute system headers.
+# headers that override system headers.
+# Rationale: The Gnulib documentation, node 'Style of #include statements'.
 sc_verify_absolute_include_headers:
 	@if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then	\
 	  source_files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.\(c\|h\)$$');	\





  reply	other threads:[~2024-02-18 20:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17  8:36 [PATCH] math: Silence -Winclude-next-absolute-path warning Collin Funk
2024-02-17 10:51 ` Bruno Haible
2024-02-17 12:26   ` Collin Funk
2024-02-17 13:17     ` Bruno Haible
2024-02-18 12:19     ` Bruno Haible
2024-02-18 12:44       ` syntax-check rule to silence " Bruno Haible
2024-02-18 20:12         ` Collin Funk
2024-02-18 20:33           ` Bruno Haible [this message]
2024-02-19  5:02             ` Jim Meyering
2024-02-19 18:11               ` Collin Funk
2024-02-19 18:32                 ` Jim Meyering
2024-02-19  8:45             ` Simon Josefsson via Gnulib discussion list
2024-02-19 20:39               ` Jim Meyering
2024-02-20 15:17               ` Bruno Haible
2024-02-20 20:23         ` Collin Funk
2024-02-20 20:49           ` Bruno Haible
2024-02-19  6:31       ` [PATCH] math: Silence " Paul Eggert
2024-02-19 11:03         ` Bruno Haible
2024-02-19 20:41           ` Paul Eggert
2024-02-19 21:24             ` Bruno Haible
2024-02-19 21:45               ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68001545.3F2A3RajZp@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=collin.funk1@gmail.com \
    --cc=jim@meyering.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).