bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH] math: Silence -Winclude-next-absolute-path warning.
@ 2024-02-17  8:36 Collin Funk
  2024-02-17 10:51 ` Bruno Haible
  0 siblings, 1 reply; 21+ messages in thread
From: Collin Funk @ 2024-02-17  8:36 UTC (permalink / raw)
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

Hello. When compiling gettext from master I get the following warning:

./math.h:46:2: warning: #include_next in file found relative to primary source file or found by absolute path; will search from start of include path [-Winclude-next-absolute-path]
   46 | #include_next <math.h>

I've attached a patch that seems to fix this. I based it off the following two commits:

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=f4fccf8efdd09d5e38f49f6ae1962797ce3e8e9c
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2a5409cf2ac62ed273589c72bb8ae0031f06a219

Let me know if I missed anything. Thanks!

Collin

[-- Attachment #2: 0001-math-Silence-Winclude-next-absolute-path-warning.patch --]
[-- Type: text/x-patch, Size: 1222 bytes --]

From 269dfab932a01cfbbb5382b8955f06d065eea149 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Sat, 17 Feb 2024 00:19:17 -0800
Subject: [PATCH] math: Silence -Winclude-next-absolute-path warning.

See commit f4fccf8efdd09d5e38f49f6ae1962797ce3e8e9c for more
information.
* lib/math.c: Write #include <math.h> instead of #include "math.h".

Copyright-paperwork-exempt: Yes
---
 ChangeLog  | 7 +++++++
 lib/math.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6a990dd0e8..8caa488c56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-02-17  Collin Funk  <collin.funk1@gmail.com>
+
+	math: Silence -Winclude-next-absolute-path warning.
+	See commit f4fccf8efdd09d5e38f49f6ae1962797ce3e8e9c for more
+	information.
+	* lib/math.c: Write #include <math.h> instead of #include "math.h".
+
 2024-02-15  Bruno Haible  <bruno@clisp.org>
 
 	nstrftime: Optimize module dependencies.
diff --git a/lib/math.c b/lib/math.c
index 08f4103c3d..78da4d4aca 100644
--- a/lib/math.c
+++ b/lib/math.c
@@ -18,5 +18,5 @@
 #include <config.h>
 
 #define _GL_MATH_INLINE _GL_EXTERN_INLINE
-#include "math.h"
+#include <math.h>
 typedef int dummy;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Bruno Haible @ 2024-02-17 10:51 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Collin Funk

Collin Funk wrote:
> Hello. When compiling gettext from master I get the following warning:
> 
> ./math.h:46:2: warning: #include_next in file found relative to primary source file or found by absolute path; will search from start of include path [-Winclude-next-absolute-path]
>    46 | #include_next <math.h>
> 
> I've attached a patch that seems to fix this. I based it off the following two commits:
> 
> https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=f4fccf8efdd09d5e38f49f6ae1962797ce3e8e9c
> https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2a5409cf2ac62ed273589c72bb8ae0031f06a219

Thanks, applied!

I also applied this patch, to complete
<https://lists.gnu.org/archive/html/bug-gnulib/2023-12/msg00072.html>:


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

	error: More clang -Winclude-next-absolute-path silencing.
	* modules/error-h (Include): Suggest <error.h>, not "error.h".
	* m4/error_h.m4: Write #include <error.h>.

diff --git a/m4/error_h.m4 b/m4/error_h.m4
index f8016ce3f8..006770c4d3 100644
--- a/m4/error_h.m4
+++ b/m4/error_h.m4
@@ -5,7 +5,7 @@
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Bruno Haible.
-dnl Provide a working "error.h".
+dnl Provide a working <error.h>.
 
 AC_DEFUN_ONCE([gl_ERROR_H],
 [
diff --git a/modules/error-h b/modules/error-h
index eeb5801732..2f43279d1b 100644
--- a/modules/error-h
+++ b/modules/error-h
@@ -35,7 +35,7 @@ error.h: error.in.h $(top_builddir)/config.status $(CXXDEFS_H)
 MOSTLYCLEANFILES += error.h error.h-t
 
 Include:
-"error.h"
+<error.h>
 
 License:
 LGPLv2+





^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  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
  0 siblings, 2 replies; 21+ messages in thread
From: Collin Funk @ 2024-02-17 12:26 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib

On 2/17/24 2:51 AM, Bruno Haible wrote:
> I also applied this patch, to complete
> <https://lists.gnu.org/archive/html/bug-gnulib/2023-12/msg00072.html>:

Thanks, gettext warns a lot about that header. I'll submit a patch over there later today.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  2024-02-17 12:26   ` Collin Funk
@ 2024-02-17 13:17     ` Bruno Haible
  2024-02-18 12:19     ` Bruno Haible
  1 sibling, 0 replies; 21+ messages in thread
From: Bruno Haible @ 2024-02-17 13:17 UTC (permalink / raw)
  To: bug-gnulib, Collin Funk

Collin Funk wrote:
> gettext warns a lot about that header. I'll submit a patch over there later today.

gettext imports a lot of code from gnulib. Before submitting a patch, check
whether the file is present in the gettext git repository [1] (as opposed to
the gettext release tarball). If the file exists only in the tarball, chances
are high that it is imported from gnulib.

Bruno

[1] https://savannah.gnu.org/git/?group=gettext






^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  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-19  6:31       ` [PATCH] math: Silence " Paul Eggert
  1 sibling, 2 replies; 21+ messages in thread
From: Bruno Haible @ 2024-02-18 12:19 UTC (permalink / raw)
  To: bug-gnulib, Collin Funk

Collin Funk wrote:
> > I also applied this patch, to complete
> > <https://lists.gnu.org/archive/html/bug-gnulib/2023-12/msg00072.html>:
> 
> Thanks, gettext warns a lot about that header. I'll submit a patch over there later today.

Oh, I now see what you mean. Thanks for the patch. Before apply a patch to
gettext, though, we need to update the Gnulib documentation accordingly.
Done through this patch:


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

	doc: Mention requirement regarding #include syntax.
	* doc/gnulib-tool.texi (-I options, Include <config.h>,
	Style of #include statements): New subsections.

diff --git a/doc/gnulib-tool.texi b/doc/gnulib-tool.texi
index 55a2b32a9a..5626ce9d53 100644
--- a/doc/gnulib-tool.texi
+++ b/doc/gnulib-tool.texi
@@ -434,6 +434,12 @@
 @node Source changes
 @section Changing your sources for use with Gnulib
 
+When you use Gnulib, you need to make some small changes to your source code
+base.
+
+@node -I options
+@subsection -I options
+
 Gnulib contains some header file overrides.  This means that when building
 on systems with deficient header files in @file{/usr/include/}, it may create
 files named @file{string.h}, @file{stdlib.h}, @file{stdint.h} or similar in
@@ -442,6 +448,9 @@
 substitutes are visible and take precedence over the files in
 @file{/usr/include/}.
 
+@node Include <config.h>
+@subsection Include <config.h>
+
 These Gnulib substitute header files rely on @file{<config.h>} being
 already included.  Furthermore @file{<config.h>} must be the first include
 in every compilation unit.  This means that to @emph{all your source files}
@@ -454,6 +463,91 @@
 used to set system dependent flags (such as @code{_GNU_SOURCE} on GNU systems),
 and these flags have no effect after any system header file has been included.
 
+@node Style of #include statements
+@subsection Style of #include statements
+
+When including including specific header files, you need to use the
+@samp{#include <...>} syntax, not the @samp{#include "..."} syntax.
+This is true for the following POSIX or ISO C standardized header files:
+@itemize @asis
+@item @code{arpa/inet.h}
+@item @code{assert.h}
+@item @code{ctype.h}
+@item @code{dirent.h}
+@item @code{errno.h}
+@item @code{fcntl.h}
+@item @code{fenv.h}
+@item @code{float.h}
+@item @code{fnmatch.h}
+@item @code{glob.h}
+@item @code{iconv.h}
+@item @code{inttypes.h}
+@item @code{langinfo.h}
+@item @code{limits.h}
+@item @code{locale.h}
+@item @code{math.h}
+@item @code{monetary.h}
+@item @code{netdb.h}
+@item @code{net/if.h}
+@item @code{netinet/in.h}
+@item @code{poll.h}
+@item @code{pthread.h}
+@item @code{sched.h}
+@item @code{search.h}
+@item @code{signal.h}
+@item @code{spawn.h}
+@item @code{stdalign.h}
+@item @code{stdarg.h}
+@item @code{stddef.h}
+@item @code{stdint.h}
+@item @code{stdio.h}
+@item @code{stdlib.h}
+@item @code{string.h}
+@item @code{strings.h}
+@item @code{sys/msg.h}
+@item @code{sys/resource.h}
+@item @code{sys/select.h}
+@item @code{sys/sem.h}
+@item @code{sys/shm.h}
+@item @code{sys/socket.h}
+@item @code{sys/stat.h}
+@item @code{sys/time.h}
+@item @code{sys/times.h}
+@item @code{sys/types.h}
+@item @code{sys/uio.h}
+@item @code{sys/utsname.h}
+@item @code{sys/wait.h}
+@item @code{termios.h}
+@item @code{threads.h}
+@item @code{time.h}
+@item @code{uchar.h}
+@item @code{unistd.h}
+@item @code{utime.h}
+@item @code{wchar.h}
+@item @code{wctype.h}
+@end itemize
+@noindent
+as well as for the following header files that exist in the GNU C library
+but are not standardized:
+@itemize @asis
+@item @code{alloca.h}
+@item @code{error.h}
+@item @code{getopt.h}
+@item @code{malloc.h}
+@item @code{omp.h}
+@item @code{pty.h}
+@item @code{selinux/selinux.h}
+@item @code{sys/file.h}
+@item @code{sys/ioctl.h}
+@item @code{sys/random.h}
+@item @code{sysexits.h}
+@item @code{utmp.h}
+@end itemize
+@noindent
+The reason for this requirement is that for these header files, the Gnulib
+override uses @code{#include_next} to include the system-provided header
+of the same name, and @code{#include_next} may not work right with the
+@samp{#include "..."} syntax.
 
 @node Link-time requirements
 @section Changing your link commands for use with Gnulib





^ permalink raw reply related	[flat|nested] 21+ messages in thread

* syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-18 12:19     ` Bruno Haible
@ 2024-02-18 12:44       ` Bruno Haible
  2024-02-18 20:12         ` Collin Funk
  2024-02-20 20:23         ` Collin Funk
  2024-02-19  6:31       ` [PATCH] math: Silence " Paul Eggert
  1 sibling, 2 replies; 21+ messages in thread
From: Bruno Haible @ 2024-02-18 12:44 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Collin Funk, Jim Meyering

Does anyone want to contribute a syntax-check rule (in maint.mk) for this?

The full list of header files for which #include "..." is to be avoided is:

alloca.h
arpa_inet.h
assert.h
ctype.h
dirent.h
errno.h
error.h
fcntl.h
fenv.h
float.h
fnmatch.h
getopt.h
glob.h
iconv.h
inttypes.h
langinfo.h
limits.h
locale.h
malloc.h
math.h
monetary.h
netdb.h
net_if.h
netinet_in.h
omp.h
poll.h
pthread.h
pty.h
sched.h
search.h
selinux/selinux.h
signal.h
spawn.h
stdalign.h
stdarg.h
stddef.h
stdint.h
stdio.h
stdlib.h
string.h
strings.h
sysexits.h
sys/file.h
sys/ioctl.h
sys/msg.h
sys/random.h
sys/resource.h
sys/select.h
sys/sem.h
sys/shm.h
sys/socket.h
sys/stat.h
sys/time.h
sys/times.h
sys/types.h
sys/uio.h
sys/utsname.h
sys/wait.h
termios.h
threads.h
time.h
uchar.h
unistd.h
utime.h
utmp.h
wchar.h
wctype.h





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  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
  2024-02-20 20:23         ` Collin Funk
  1 sibling, 1 reply; 21+ messages in thread
From: Collin Funk @ 2024-02-18 20:12 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib; +Cc: Jim Meyering

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

On 2/18/24 4:44 AM, Bruno Haible wrote:
> Does anyone want to contribute a syntax-check rule (in maint.mk) for this?

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

[-- Attachment #2: 0001-maint.mk-Add-syntax-check-rule-to-check-for-include-.patch --]
[-- Type: text/x-patch, Size: 3418 bytes --]

From c8315b3514181c1369da067516c1ec7c2a23a203 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Sun, 18 Feb 2024 12:02:33 -0800
Subject: [PATCH] maint.mk: Add syntax-check rule to check for #include syntax.

* top/maint.mk (sc_verify_absolute_include_headers): New rule
to check for #includes that might cause
-Winclude-next-absolute-path warnings.
---
 ChangeLog    |  7 ++++
 top/maint.mk | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f09e819707..a3f316e3cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-02-18  Collin Funk  <collin.funk1@gmail.com>
+
+	maint.mk: Add syntax-check rule to check for #include syntax.
+	* top/maint.mk (sc_verify_absolute_include_headers): New rule
+	to check for #includes that might cause
+	-Winclude-next-absolute-path warnings.
+
 2024-02-18  Bruno Haible  <bruno@clisp.org>
 
 	doc: Mention requirement regarding #include syntax.
diff --git a/top/maint.mk b/top/maint.mk
index 1b4a2de4f9..84751337b0 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -914,6 +914,98 @@ sc_prohibit_always-defined_macros:
 		 exit 1; }						\
 	    || :;							\
 	fi
+
+# Generated headers that override system headers.
+# Keep sorted.
+gl_absolute_include_headers_ ?= \
+  alloca.h		\
+  arpa_inet.h		\
+  assert.h		\
+  ctype.h		\
+  dirent.h		\
+  errno.h		\
+  error.h		\
+  fcntl.h		\
+  fenv.h		\
+  float.h		\
+  fnmatch.h		\
+  getopt.h		\
+  glob.h		\
+  iconv.h		\
+  inttypes.h		\
+  langinfo.h		\
+  limits.h		\
+  locale.h		\
+  malloc.h		\
+  math.h		\
+  monetary.h		\
+  netdb.h		\
+  net/if.h		\
+  netinet/in.h		\
+  omp.h			\
+  poll.h		\
+  pthread.h		\
+  pty.h			\
+  sched.h		\
+  search.h		\
+  selinux/selinux.h	\
+  signal.h		\
+  spawn.h		\
+  stdalign.h		\
+  stdarg.h		\
+  stddef.h		\
+  stdint.h		\
+  stdio.h		\
+  stdlib.h		\
+  string.h		\
+  strings.h		\
+  sysexits.h		\
+  sys/file.h		\
+  sys/ioctl.h		\
+  sys/msg.h		\
+  sys/random.h		\
+  sys/resource.h	\
+  sys/select.h		\
+  sys/sem.h		\
+  sys/shm.h		\
+  sys/socket.h		\
+  sys/stat.h		\
+  sys/time.h		\
+  sys/times.h		\
+  sys/types.h		\
+  sys/uio.h		\
+  sys/utsname.h		\
+  sys/wait.h		\
+  termios.h		\
+  threads.h		\
+  time.h		\
+  uchar.h		\
+  unistd.h		\
+  utime.h		\
+  utmp.h		\
+  wchar.h		\
+  wctype.h
+
+# Suggest using '#include <header.h>' instead of '#include "header.h"' for
+# headers that substitute system headers.
+sc_verify_absolute_include_headers:
+	@if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then	\
+	  source_files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.\(c\|h\)$$');	\
+	  for source_file in $$source_files; do				\
+	    local_includes=$$($(GREP) -h '^ *# *include "[^"]\+"' 	\
+                              $$source_file | $(SED) 			\
+                              -e 's/^[^"]\+"//g' -e 's/"$///g');	\
+	    for local_include in $$local_includes; do			\
+	      for header in $(gl_absolute_include_headers_); do         \
+	        if test "$$header" = "$$local_include";	then		\
+	          echo "$(ME): Use #include <$$header> instead of "     \
+	               "#include \"$$header\" in $$source_file" 2>&1;	\
+	        fi;							\
+	      done;							\
+	    done;							\
+          done;								\
+	fi;
+
 # ==================================================================
 
 # Prohibit checked in backup files.
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-18 20:12         ` Collin Funk
@ 2024-02-18 20:33           ` Bruno Haible
  2024-02-19  5:02             ` Jim Meyering
  2024-02-19  8:45             ` Simon Josefsson via Gnulib discussion list
  0 siblings, 2 replies; 21+ messages in thread
From: Bruno Haible @ 2024-02-18 20:33 UTC (permalink / raw)
  To: bug-gnulib, Collin Funk; +Cc: Jim Meyering

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\)$$');	\





^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-18 20:33           ` Bruno Haible
@ 2024-02-19  5:02             ` Jim Meyering
  2024-02-19 18:11               ` Collin Funk
  2024-02-19  8:45             ` Simon Josefsson via Gnulib discussion list
  1 sibling, 1 reply; 21+ messages in thread
From: Jim Meyering @ 2024-02-19  5:02 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib, Collin Funk

[-- Attachment #1: Type: text/plain, Size: 1814 bytes --]

On Sun, Feb 18, 2024 at 12:33 PM Bruno Haible <bruno@clisp.org> wrote:
> 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.

Thank you both. I've just pushed an improvement.
The new version runs grep only once rather than many times, and seems simpler.
The output is like this, now (from gnu grep, which I've just fixed):

src/grep.c:39:#include "error.h"
src/grep.c:44:#include "getopt.h"
src/grep.c:49:#include "search.h"
src/kwsearch.c:22:#include "search.h"
src/pcresearch.c:21:#include "search.h"
src/searchutils.c:23:#include "search.h"
maint.mk: Use #include <hdr.h>, not #include "hdr.h" for the above
make: *** [maint.mk:615: sc_prefer_angle_bracket_headers] Error 1

[-- Attachment #2: gl_prefer_angle_bracket_headers.diff --]
[-- Type: application/octet-stream, Size: 3150 bytes --]

From 6da9c0af52101930eba7b5c496d35111d29a6d04 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@meta.com>
Date: Sun, 18 Feb 2024 20:23:28 -0800
Subject: [PATCH] maint.mk: improve new syntax-check rule

* top/maint.mk (sc_prefer_angle_bracket_headers): Rename from
sc_verify_absolute_include_headers.  Simplify to run a single
invocation of grep, rather than usually many.  Derive a regular
expression matching the selected headers, and warn about any
offending matches via what is usually a single grep invocation.
---
 ChangeLog    |  9 +++++++++
 top/maint.mk | 27 +++++++++------------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3a8559bfb3..1fe354f2b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-02-18  Jim Meyering  <meyering@meta.com>
+
+	maint.mk: improve new syntax-check rule
+	* top/maint.mk (sc_prefer_angle_bracket_headers): Rename from
+	sc_verify_absolute_include_headers.  Simplify to run a single
+	invocation of grep, rather than usually many.  Derive a regular
+	expression matching the selected headers, and warn about any
+	offending matches via what is usually a single grep invocation.
+
 2024-02-18  Bruno Haible  <bruno@clisp.org>

 	maint.mk: Add more comments.
diff --git a/top/maint.mk b/top/maint.mk
index 5746b911dd..2278619931 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -539,7 +539,7 @@ sc_require_config_h_first:

 # Generated headers that override system headers.
 # Keep sorted.
-gl_absolute_include_headers_ ?= \
+gl_prefer_angle_bracket_headers_ ?= \
   alloca.h		\
   arpa_inet.h		\
   assert.h		\
@@ -608,26 +608,17 @@ gl_absolute_include_headers_ ?= \
   wchar.h		\
   wctype.h

+# Remove each .h suffix and change each space to "|".
+angle_bracket_header_re = \
+  $(subst $(_sp),|,$(patsubst %.h,%,$(gl_prefer_angle_bracket_headers_)))
+
 # Suggest using '#include <header.h>' instead of '#include "header.h"' for
 # 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\)$$');	\
-	  for source_file in $$source_files; do				\
-	    local_includes=$$($(GREP) -h '^ *# *include "[^"]\+"' 	\
-                              $$source_file | $(SED) 			\
-                              -e 's/^[^"]\+"//g' -e 's/"$///g');	\
-	    for local_include in $$local_includes; do			\
-	      for header in $(gl_absolute_include_headers_); do         \
-	        if test "$$header" = "$$local_include";	then		\
-	          echo "$(ME): Use #include <$$header> instead of "     \
-	               "#include \"$$header\" in $$source_file" 2>&1;	\
-	        fi;							\
-	      done;							\
-	    done;							\
-          done;								\
-	fi;
+sc_prefer_angle_bracket_headers:
+	@prohibit='^ *# *include "($(angle_bracket_header_re))\.h"'	\
+	halt='Use #include <hdr.h>, not #include "hdr.h" for the above'	\
+	  $(_sc_search_regexp)

 sc_prohibit_HAVE_MBRTOWC:
 	@prohibit='\bHAVE_MBRTOWC\b'					\
-- 
2.41.0.376.gcba07a324d


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  2024-02-18 12:19     ` Bruno Haible
  2024-02-18 12:44       ` syntax-check rule to silence " Bruno Haible
@ 2024-02-19  6:31       ` Paul Eggert
  2024-02-19 11:03         ` Bruno Haible
  1 sibling, 1 reply; 21+ messages in thread
From: Paul Eggert @ 2024-02-19  6:31 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib

On 2024-02-18 04:19, Bruno Haible wrote:
> +When including including specific header files, you need to use the
> +@samp{#include <...>} syntax, not the @samp{#include "..."} syntax.

Why does Gnulib source code ever use the #include "..." syntax? I don't 
see why it's helpful, given that one must always use -I to name the 
source code directory anyway.

If there's a reason for using #include "..." it should be documented; if 
not, Gnulib should stop doing it as it's just a recipe for trouble.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-18 20:33           ` Bruno Haible
  2024-02-19  5:02             ` 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
  1 sibling, 2 replies; 21+ messages in thread
From: Simon Josefsson via Gnulib discussion list @ 2024-02-19  8:45 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib, Collin Funk, Jim Meyering

[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]

Bruno Haible <bruno@clisp.org> writes:

> --- 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>'.

Having a way to learn the rationale for a syntax-check is a really good
idea!  There are some checks that I struggle to understand the point of,
and one that I simply disagree with (sc_prohibit_strcmp).  Having a link
to discussion helps to determine how to deal with errors.

What do you think about:

   1) using a URL to the gnulib online manual instead?  For most users,
      that allows easier lookup, and for people who are really offline,
      the URL contains sufficient detail to find the relevant in the
      manual, and

   2) print the rationale link as part of the error message instead of a
      comment in the code

?

I think 'make syntax-check' is one of the powerful and under-appreciated
aspects of gnulib, so improving its usability can help make it more
used.

/Simon

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  2024-02-19  6:31       ` [PATCH] math: Silence " Paul Eggert
@ 2024-02-19 11:03         ` Bruno Haible
  2024-02-19 20:41           ` Paul Eggert
  0 siblings, 1 reply; 21+ messages in thread
From: Bruno Haible @ 2024-02-19 11:03 UTC (permalink / raw)
  To: bug-gnulib, Paul Eggert

Paul Eggert wrote:
> On 2024-02-18 04:19, Bruno Haible wrote:
> > +When including including specific header files, you need to use the
> > +@samp{#include <...>} syntax, not the @samp{#include "..."} syntax.
> 
> Why does Gnulib source code ever use the #include "..." syntax?

Because that's the way the rest of the world does it:
  - GNU documentation: [1][2]
  - Stackoverflow beginner's question: [3]
  - Actual use in source code (codesearch.debian.net):
    11954285 times  include "
     9623421 times  include <

> I don't 
> see why it's helpful, given that one must always use -I to name the 
> source code directory anyway.

It's helpful, in order to not deter contributors, to use coding styles
like the rest of the world does. GNU coding style is a deterrence, the
Gnulib module system is another one; but these ones are necessary (i.e.
have a good benefit). Whereas writing #include <...> everywhere has
very little benefit.

> If there's a reason for using #include "..." it should be documented; if 
> not, Gnulib should stop doing it as it's just a recipe for trouble.

I disagree:
  - New idiosyncrasies do not help to attract contributors.
  - As documented, the requirement to use #include <...> for specific header
    files exists for packages that use Gnulib. If you were to change the
    code in Gnulib, that does not change the one in bison, coreutils, gettext,
    wget2, and so on.

Bruno

[1] https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html
[2] https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
[3] https://stackoverflow.com/questions/21593/





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-19  5:02             ` Jim Meyering
@ 2024-02-19 18:11               ` Collin Funk
  2024-02-19 18:32                 ` Jim Meyering
  0 siblings, 1 reply; 21+ messages in thread
From: Collin Funk @ 2024-02-19 18:11 UTC (permalink / raw)
  To: Jim Meyering; +Cc: Bruno Haible, bug-gnulib

Jim Meyering <jim@meyering.net> writes:
> Thank you both. I've just pushed an improvement.
> The new version runs grep only once rather than many times, and seems simpler.

Thanks. This one seems much better. It also returns 1 if an invalid
quoted header is found which I forgot to do. This Makefile would
probably be good view for me. :)

I feel like this rule might cause some false positives for some projects
in a few rare cases. Files in the namespace std*.h and sys/*.h probably
shouldn't be used (not sure if they are explicitly reserved). However,
it might be possible that a project uses it's own "error.h" or
"search.h", for example, unrelated to gnulib.

Would it make sense to add an exclude regexp to cfg.mk or make a note
about reserved header names in the documentation?


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-19 18:11               ` Collin Funk
@ 2024-02-19 18:32                 ` Jim Meyering
  0 siblings, 0 replies; 21+ messages in thread
From: Jim Meyering @ 2024-02-19 18:32 UTC (permalink / raw)
  To: Collin Funk; +Cc: Bruno Haible, bug-gnulib

On Mon, Feb 19, 2024 at 10:11 AM Collin Funk <collin.funk1@gmail.com> wrote:
> Jim Meyering <jim@meyering.net> writes:
> > Thank you both. I've just pushed an improvement.
> > The new version runs grep only once rather than many times, and seems simpler.
>
> Thanks. This one seems much better. It also returns 1 if an invalid
> quoted header is found which I forgot to do. This Makefile would
> probably be good view for me. :)
>
> I feel like this rule might cause some false positives for some projects
> in a few rare cases. Files in the namespace std*.h and sys/*.h probably
> shouldn't be used (not sure if they are explicitly reserved). However,
> it might be possible that a project uses it's own "error.h" or
> "search.h", for example, unrelated to gnulib.
>
> Would it make sense to add an exclude regexp to cfg.mk or make a note
> about reserved header names in the documentation?

Sure, for a rare false-positive match in a file named bar.c, add a
line like this in cfg.mk:

  exclude_file_name_regexp--sc_prefer_angle_bracket_headers = ^bar\.c$$

If there's some systemic/frequent false positive, we should consider
adjusting maint.mk.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Jim Meyering @ 2024-02-19 20:39 UTC (permalink / raw)
  To: Simon Josefsson; +Cc: Bruno Haible, bug-gnulib, Collin Funk

On Mon, Feb 19, 2024 at 12:45 AM Simon Josefsson <simon@josefsson.org> wrote:
> Bruno Haible <bruno@clisp.org> writes:
> > --- 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>'.
>
> Having a way to learn the rationale for a syntax-check is a really good
> idea!  There are some checks that I struggle to understand the point of,
> and one that I simply disagree with (sc_prohibit_strcmp).  Having a link
> to discussion helps to determine how to deal with errors.
>
> What do you think about:
>
>    1) using a URL to the gnulib online manual instead?  For most users,
>       that allows easier lookup, and for people who are really offline,
>       the URL contains sufficient detail to find the relevant in the
>       manual, and
>
>    2) print the rationale link as part of the error message instead of a
>       comment in the code
>
> ?
>
> I think 'make syntax-check' is one of the powerful and under-appreciated
> aspects of gnulib, so improving its usability can help make it more
> used.

Hi Simon, I like both ideas.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  2024-02-19 11:03         ` Bruno Haible
@ 2024-02-19 20:41           ` Paul Eggert
  2024-02-19 21:24             ` Bruno Haible
  0 siblings, 1 reply; 21+ messages in thread
From: Paul Eggert @ 2024-02-19 20:41 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib

On 2024-02-19 03:03, Bruno Haible wrote:
> writing #include <...> everywhere has
> very little benefit.

There is a benefit: it's simpler and would avoid future problems like 
the one just fixed.

Currently we have more-complicated guideline, which is that one should 
use #include <...> for include files in category A, and that you can use 
either style for files in category B, and that these categories are 
explained somewhere in the documentation. (Also, a file may migrate from 
category B to category A in the future; this isn't explained yet....)

It'd be simpler to say "It's better to use #include <...>."

Whatever guideline we use, either the contributors need to learn the 
guideline, or we can politely adjust their code once contributed. I 
don't see why a simpler guideline would discourage contributors; quite 
the contrary.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  2024-02-19 20:41           ` Paul Eggert
@ 2024-02-19 21:24             ` Bruno Haible
  2024-02-19 21:45               ` Paul Eggert
  0 siblings, 1 reply; 21+ messages in thread
From: Bruno Haible @ 2024-02-19 21:24 UTC (permalink / raw)
  To: bug-gnulib, Paul Eggert

Paul Eggert wrote:
> > writing #include <...> everywhere has
> > very little benefit.
> 
> There is a benefit: it's simpler and would avoid future problems like 
> the one just fixed.

There is also a drawback: Remember why we took the habit of putting all
  #include <system-header.h>
before all
  #include "application-header.h" ?
That is because due to the _GNU_SOURCE, _ALL_SOURCE, etc. macros that
our omnipresent 'extensions' module defines, the system header files define
all sorts of non-standardized symbols, which occasionally lead to
conflicts with application headers. #including the application headers
after the system header guarantees that the application header can do
  #define SP mySP
or
  #define UP myUP
to get rid of the conflict.

If the programmer were to use #include <...> everywhere and — quite
likely — sort the include statements alphabetically, then half of the
time (on average) this conflict resolution will not work out.

> Whatever guideline we use, either the contributors need to learn the 
> guideline, or we can politely adjust their code once contributed.

The larger part of the problem is not with Gnulib, but with the > 100
packages that use Gnulib. We can occasionally ask / force them to make
one-liner changes on our behalf. But they would not accept if we tell
them to diverge significantly from de-facto conventions that are already
in place for 40 years.

The purpose of this de-facto convention (to use #include <...> only for
system headers) was to avoid the need to add -I options in the Makefile,
here and there. At a time when VPATH builds were not common.

> Currently we have more-complicated guideline, which is that one should 
> use #include <...> for include files in category A, and that you can use 
> either style for files in category B, and that these categories are 
> explained somewhere in the documentation.

True. But this more complicated guideline is already in the programmers'
brains, just with a set A that is a little bit smaller than the one Gnulib
needs. The Gnulib documentation is telling the programmer to adjust their
remembered rule for #include, to accommodate essentially only <error.h>.

> (Also, a file may migrate from 
> category B to category A in the future; this isn't explained yet....)

True, but it won't happen often. Probably once in 2 years, or less
frequently.

Bruno





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] math: Silence -Winclude-next-absolute-path warning.
  2024-02-19 21:24             ` Bruno Haible
@ 2024-02-19 21:45               ` Paul Eggert
  0 siblings, 0 replies; 21+ messages in thread
From: Paul Eggert @ 2024-02-19 21:45 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib

On 2024-02-19 13:24, Bruno Haible wrote:
> The larger part of the problem is not with Gnulib, but with the > 100
> packages that use Gnulib.

Oh, I wasn't proposing that we use the simpler style in all apps, just 
Gnulib.

It's not that big a deal, so let's just leave things be for now. (But if 
we run into another problem with #include "..." in Gnulib I'll mention 
this again....)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Bruno Haible @ 2024-02-20 15:17 UTC (permalink / raw)
  To: Simon Josefsson, Jim Meyering; +Cc: bug-gnulib, Collin Funk

Simon Josefsson wrote:
> There are some checks that I struggle to understand the point of,
> and one that I simply disagree with (sc_prohibit_strcmp).

Likewise for me. [1]

> Having a link
> to discussion helps to determine how to deal with errors.
> 
> What do you think about:
> 
>    1) using a URL to the gnulib online manual instead?  For most users,
>       that allows easier lookup, and for people who are really offline,
>       the URL contains sufficient detail to find the relevant in the
>       manual, and
> 
>    2) print the rationale link as part of the error message instead of a
>       comment in the code
> 
> ?

We can do this. But it needs your input. With your input, I can put each
sc's rationale into a separate doc subsection, group these subsections
through sections, then republish the doc, then find out about the URLs
and store them in maint.mk.

Please reply to this mail, with a rationale for the following. Don't
omit references to standards (ISO C 23, POSIX:2018, GNU Coding Style)
when relevant.



sc_avoid_if_before_free:

sc_cast_of_argument_to_free:

sc_cast_of_x_alloc_return_value:

sc_cast_of_alloca_return_value:

sc_space_tab:

# Don't use *scanf or the old ato* functions in "real" code.
# They provide no error checking mechanism.
# Instead, use strto* functions.
sc_prohibit_atoi_atof:

# Use STREQ rather than comparing strcmp == 0, or != 0.
sc_prohibit_strcmp:

# Really.  You don't want to use this function.
# It may fail to NUL-terminate the destination,
# and always NUL-pads out to the specified length.
sc_prohibit_strncpy:

# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
sc_prohibit_magic_number_exit:

# Check that we don't use $< in non-implicit Makefile rules.
sc_prohibit_gnu_make_extensions:

# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit.  Use '0' instead.
sc_error_exit_success:

# "FATAL:" should be fully upper-cased in error messages
# "WARNING:" should be fully upper-cased, or fully lower-cased
sc_error_message_warn_fatal:

# Error messages should not start with a capital letter
sc_error_message_uppercase:

# Error messages should not end with a period
sc_error_message_period:

sc_file_system:

# Don't use cpp tests of this symbol.  All code assumes config.h is included.
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>'.
sc_require_config_h:

# 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:

# Suggest using '#include <header.h>' instead of '#include "header.h"' for
# headers that override system headers.
# Rationale: The Gnulib documentation, node 'Style of #include statements'.
sc_prefer_angle_bracket_headers:

sc_prohibit_HAVE_MBRTOWC:

# Prohibit the inclusion of assert.h without an actual use of assert.
sc_prohibit_assert_without_use:

# Prohibit the inclusion of close-stream.h without an actual use.
sc_prohibit_close_stream_without_use:

# Prohibit the inclusion of getopt.h without an actual use.
sc_prohibit_getopt_without_use:

# Don't include quotearg.h unless you use one of its functions.
sc_prohibit_quotearg_without_use:

# Don't include quote.h unless you use one of its functions.
sc_prohibit_quote_without_use:

# Don't include this header unless you use one of its functions.
sc_prohibit_long_options_without_use:

# Don't include this header unless you use one of its functions.
sc_prohibit_inttostr_without_use:

# Don't include this header unless you use one of its functions.
sc_prohibit_ignore_value_without_use:

# Don't include this header unless you use one of its functions.
sc_prohibit_error_without_use:

# Don't include xalloc.h unless you use one of its symbols.
sc_prohibit_xalloc_without_use:

sc_prohibit_hash_without_use:

sc_prohibit_cloexec_without_use:

sc_prohibit_posixver_without_use:

sc_prohibit_same_without_use:

sc_prohibit_hash_pjw_without_use:

sc_prohibit_safe_read_without_use:

sc_prohibit_argmatch_without_use:

sc_prohibit_canonicalize_without_use:

sc_prohibit_root_dev_ino_without_use:

sc_prohibit_openat_without_use:

# Prohibit the inclusion of c-ctype.h without an actual use.
sc_prohibit_c_ctype_without_use:

# Prohibit the inclusion of signal.h without an actual use.
sc_prohibit_signal_without_use:

# Don't include stdio--.h unless you use one of its functions.
sc_prohibit_stdio--_without_use:

# Don't include stdio-safer.h unless you use one of its functions.
sc_prohibit_stdio-safer_without_use:

# Prohibit the inclusion of strings.h without a sensible use.
# Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible.
sc_prohibit_strings_without_use:

# Prohibit the inclusion of intprops.h without an actual use.
sc_prohibit_intprops_without_use:

# Prohibit the inclusion of stddef.h without an actual use.
sc_prohibit_stddef_without_use:

# Prohibit the inclusion of dirent.h without an actual use.
sc_prohibit_dirent_without_use:

# Prohibit the inclusion of verify.h without an actual use.
sc_prohibit_verify_without_use:

# Don't include xfreopen.h unless you use one of its functions.
sc_prohibit_xfreopen_without_use:

sc_obsolete_symbols:

# Each nonempty ChangeLog line must start with a year number, or a TAB.
sc_changelog:

# Ensure that each .c file containing a "main" function also
# calls bindtextdomain.
sc_bindtextdomain:

# Require that the final line of each test-lib.sh-using test be this one:
# Exit $fail
sc_require_test_exit_idiom:

sc_trailing_blank:

sc_two_space_separator_in_usage:

# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
sc_unmarked_diagnostics:

# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:

sc_prohibit_always_true_header_tests:

sc_prohibit_defined_have_decl_tests:

# Don't define macros that we already get from gnulib header files.
sc_prohibit_always-defined_macros:

# Prohibit checked in backup files.
sc_prohibit_backup_files:

# Require the latest GPL.
sc_GPL_version:

# Require the latest GFDL.
sc_GFDL_version:

# Don't use Texinfo's @acronym{}.
# https://lists.gnu.org/r/bug-gnulib/2010-03/msg00321.html
sc_texinfo_acronym:

sc_prohibit_cvs_keyword:

sc_prohibit_empty_lines_at_EOF:

# Make sure we don't use st_blocks.  Use ST_NBLOCKS or STP_NBLOCKS instead.
# This is a bit of a kludge, since it prevents use of the string
# even in comments, but for now it does the job with no false positives.
sc_prohibit_stat_st_blocks:

# Make sure we don't define any S_IS* macros in src/*.c files.
# They're already defined via gnulib's sys/stat.h replacement.
sc_prohibit_S_IS_definition:

sc_prohibit_doubled_word:

# A regular expression matching undesirable combinations of words like
# "can not"; this matches them even when the two words appear on different
# lines, but not when there is an intervening delimiter like "#" or "*".
# Similarly undesirable, "See @xref{...}", since an @xref should start
# a sentence.  Explicitly prohibit any prefix of "see" or "also".
# Also prohibit a prefix matching "\w+ +".
# @pxref gets the same see/also treatment and should be parenthesized;
# presume it must *not* start a sentence.
# POSIX spells it "timestamp" rather than "time\s+stamp", so we do, too.
sc_prohibit_undesirable_word_seq:

# Except for shell files and for loops, double semicolon is probably a mistake
sc_prohibit_double_semicolon:

# Using test's -a and -o operators is not portable.
# We prefer test over [, since the latter is spelled [[ in configure.ac.
sc_prohibit_test_minus_ao:

# Avoid a test bashism.
sc_prohibit_test_double_equal:

# Each program that uses proper_name_utf8 must link with one of the
# ICONV libraries.  Otherwise, some ICONV library must appear in LDADD.
sc_proper_name_utf8_requires_ICONV:

# Warn about "c0nst struct Foo const foo[]",
# but not about "char const *const foo" or "#define const const".
sc_redundant_const:

sc_const_long_option:

# Ensure that we don't accidentally insert an entry into an old NEWS block.
sc_immutable_NEWS:

# Ensure that we use only the standard $(VAR) notation,
# not @...@ in Makefile.am, now that we can rely on automake
# to emit a definition for each substituted variable.
# However, there is still one case in which @VAR@ use is not just
# legitimate, but actually required: when augmenting an automake-defined
# variable with a prefix.  For example, gettext uses this:
# MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
# otherwise, makeinfo would put German or French (current locale)
# navigation hints in the otherwise-English documentation.
sc_makefile_at_at_check:

sc_makefile_TAB_only_indentation:

sc_m4_quote_check:

# Verify that all source files using _() (more specifically, files that
# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
sc_po_check:

# Sometimes it is useful to change the PATH environment variable
# in Makefiles.  When doing so, it's better not to use the Unix-centric
# path separator of ':', but rather the automake-provided '$(PATH_SEPARATOR)'.
sc_makefile_path_separator_check:

sc_makefile_DISTCHECK_CONFIGURE_FLAGS:

# Make sure that the copyright date in $(v_etc_file) is up to date.
# Do the same for the $(sample-test) and the main doc/.texi file.
sc_copyright_check:

# If tests/help-version exists and seems to be new enough, assume that its
# use of init.sh and path_prepend_ is correct, and ensure that every other
# use of init.sh is identical.
# This is useful because help-version cross-checks prog --version
# with $(VERSION), which verifies that its path_prepend_ invocation
# sets PATH correctly.  This is an inexpensive way to ensure that
# the other init.sh-using tests also get it right.
sc_cross_check_PATH_usage_in_tests:

# In tests, use "compare expected actual", not the reverse.
sc_prohibit_reversed_compare_failure:

# #if HAVE_... will evaluate to false for any non numeric string.
# That would be flagged by using -Wundef, however gnulib currently
# tests many undefined macros, and so we can't enable that option.
# So at least preclude common boolean strings as macro values.
sc_Wundef_boolean:

# Even if you use pathmax.h to guarantee that PATH_MAX is defined, it might
# not be constant, or might overflow a stack.  In general, use PATH_MAX as
# a limit, not an array or alloca size.
sc_prohibit_path_max_allocation:

sc_vulnerable_makefile_CVE-2009-4029:

sc_vulnerable_makefile_CVE-2012-3386:

sc_unportable_grep_q:

# The GNU Coding standards say that README should refer to both
# INSTALL and the file that contains the copying conditions.  This
# shall be COPYING for GPL and COPYING.LESSER for LGPL.
sc_readme_link_install:

sc_readme_link_copying:



Bruno

[1] https://lists.gnu.org/archive/html/poke-devel/2024-02/msg00082.html





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-18 12:44       ` syntax-check rule to silence " Bruno Haible
  2024-02-18 20:12         ` Collin Funk
@ 2024-02-20 20:23         ` Collin Funk
  2024-02-20 20:49           ` Bruno Haible
  1 sibling, 1 reply; 21+ messages in thread
From: Collin Funk @ 2024-02-20 20:23 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib; +Cc: Jim Meyering

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

On 2/18/24 4:44 AM, Bruno Haible wrote:
> The full list of header files for which #include "..." is to be avoided is:
> 
> alloca.h
> arpa_inet.h
> assert.h

I saw that arpa_inet.h had an underscore instead of a slash in this
message but forgot to fix it when I pasted it into the Makefile... Sorry
about that. I attached the fix.

Collin

[-- Attachment #2: 0001-maint.mk-Fix-include-header-typo.patch --]
[-- Type: text/x-patch, Size: 1038 bytes --]

From 1f526466d4a2c54ea227e438c12127fc305c2a43 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@gmail.com>
Date: Tue, 20 Feb 2024 12:16:40 -0800
Subject: [PATCH] maint.mk: Fix include header typo.

top/maint.mk: Change arpa_inet.h to arpa/inet.h.
---
 ChangeLog    | 5 +++++
 top/maint.mk | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ef069e2e94..32985d0abb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-02-20  Collin Funk  <collin.funk1@gmail.com>
+
+	maint.mk: Fix include header typo.
+	* top/maint.mk: Change arpa_inet.h to arpa/inet.h.
+
 2024-02-20  Bruno Haible  <bruno@clisp.org>
 
 	*printf-posix: Avoid crash in a configure test.
diff --git a/top/maint.mk b/top/maint.mk
index 2278619931..c30e71ba6e 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -541,7 +541,7 @@ sc_require_config_h_first:
 # Keep sorted.
 gl_prefer_angle_bracket_headers_ ?= \
   alloca.h		\
-  arpa_inet.h		\
+  arpa/inet.h		\
   assert.h		\
   ctype.h		\
   dirent.h		\
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: syntax-check rule to silence -Winclude-next-absolute-path warning
  2024-02-20 20:23         ` Collin Funk
@ 2024-02-20 20:49           ` Bruno Haible
  0 siblings, 0 replies; 21+ messages in thread
From: Bruno Haible @ 2024-02-20 20:49 UTC (permalink / raw)
  To: bug-gnulib, Collin Funk; +Cc: Jim Meyering

Collin Funk wrote:
> > The full list of header files for which #include "..." is to be avoided is:
> > 
> > alloca.h
> > arpa_inet.h
> > assert.h
> 
> I saw that arpa_inet.h had an underscore instead of a slash in this
> message but forgot to fix it when I pasted it into the Makefile...

There were 3 such typos in my input; sorry about that. You had already
fixed 2 of them. Applied. Now it's fine. Thanks.

Bruno





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-02-20 20:50 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).