From d720f3f196c2858396f33aa8714c75a5cb204688 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Sat, 11 Apr 2009 11:13:05 +0200 Subject: Update gnulib files. --- gl/Makefile.am | 2 +- gl/m4/inet_ntop.m4 | 15 ++++++++++-- maint.mk | 70 ++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/gl/Makefile.am b/gl/Makefile.am index 69d8b33f4c..d3f8a53ab2 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -82,7 +82,7 @@ BUILT_SOURCES += $(ARPA_INET_H) # We need the following in order to create when the system # doesn't have one. -arpa/inet.h: +arpa/inet.h: arpa_inet.in.h @MKDIR_P@ arpa rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 42bfc5e417..2bbdca1088 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 @@ -1,4 +1,4 @@ -# inet_ntop.m4 serial 8 +# inet_ntop.m4 serial 9 dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,18 @@ AC_DEFUN([gl_INET_NTOP], gl_REPLACE_ARPA_INET_H - AC_REPLACE_FUNCS([inet_ntop]) + dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to + dnl find inet_ntop. + dnl + dnl It is the responsibility of gl_INET_NTOP's caller to arrange for + dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8, + dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo + dnl isn't built on Solaris 8. + gl_save_LIBS=$LIBS + AC_SEARCH_LIBS([inet_ntop], [nsl], [], + [AC_REPLACE_FUNCS([inet_ntop])]) + LIBS=$gl_save_LIBS + gl_PREREQ_INET_NTOP ]) diff --git a/maint.mk b/maint.mk index 3177d577a5..3390e7bb42 100644 --- a/maint.mk +++ b/maint.mk @@ -38,34 +38,42 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)' # Doing it here saves us from having to set LC_ALL elsewhere in this file. export LC_ALL = C +# There are many rules below that prohibit constructs in this package. +# If the offending construct can be matched with a grep-E-style regexp, +# use this macro. The shell variables "re" and "msg" must be defined. +define _prohibit_regexp + dummy=; : so we do not need a semicolon before each use; \ + test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \ + test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\ + grep $(_ignore_case) -nE "$$re" $(C_SOURCES) && \ + { echo '$(ME): '"$$msg" 1>&2; exit 1; } || : +endef + # Casting arguments to free is never necessary. sc_cast_of_argument_to_free: - @grep -nE '\&2; \ - exit 1; } || : + @re='\' $(C_SOURCES) && \ - { echo '$(ME): don'\''t cast x*alloc return value' 1>&2; \ - exit 1; } || : + @re='\*\) *x(m|c|re)alloc\>' \ + msg='don'\''t cast x*alloc return value' \ + $(_prohibit_regexp) sc_cast_of_alloca_return_value: - @grep -nE '\*\) *alloca\>' $(C_SOURCES) && \ - { echo '$(ME): don'\''t cast alloca return value' 1>&2; \ - exit 1; } || : + @re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \ + $(_prohibit_regexp) sc_space_tab: - @grep -n '[ ] ' $(C_SOURCES) && \ - { echo '$(ME): found SPACE-TAB sequence; remove the SPACE' \ - 1>&2; exit 1; } || : + @re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \ + $(_prohibit_regexp) -# Don't use the old ato* functions in `real' code. +# 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: - @grep -nE '\' $(C_SOURCES) && \ - { echo '$(ME): do not use ato''f, ato''i, ato''l, ato''ll, or ato''q' \ - 1>&2; exit 1; } || : + @re='\<([fs]?scanf|ato([filq]|ll)) *\(' \ + msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \ + $(_prohibit_regexp) # Using EXIT_SUCCESS as the first argument to error is misleading, # since when that parameter is 0, error does not exit. Use `0' instead. @@ -80,21 +88,31 @@ sc_no_if_have_config_h: { echo '$(ME): found use of #if HAVE_CONFIG_H; use #ifdef' \ 1>&2; exit 1; } || : +# To use this "command" macro, you must first define two shell variables: +# h: the header, enclosed in <> or "" +# re: a regular expression that matches IFF something provided by $h is used. +define _header_without_use + h_esc=`echo "$$h"|sed 's/\./\\./g'`; \ + if $(C_SOURCES) | grep -l '\.c$$' > /dev/null; then \ + files=$$(grep -l '^# *include '"$$h_esc" \ + $$($(C_SOURCES) | grep '\.c$$')) && \ + grep -LE "$$re" $$files | grep . && \ + { echo "$(ME): the above files include $$h but don't use it" \ + 1>&2; exit 1; } || :; \ + else :; \ + fi +endef + # Prohibit the inclusion of assert.h without an actual use of assert. sc_prohibit_assert_without_use: - @files=$$(grep -l '# *include [<"]assert\.h[>"]' $(C_SOURCES) \ - | grep '\.[cy]$$') && \ - grep -L '\ but don't use it" \ - 1>&2; exit 1; } || : + @h='' re='\' $(C_SOURCES) && \ - { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \ - 1>&2; exit 1; } || : + @re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \ + msg='do not use HAVE''_FCNTL_H or O'_NDELAY \ + $(_prohibit_regexp) -# Each nonempty line must start with a year number, or a TAB. +# Each nonempty ChangeLog line must start with a year number, or a TAB. sc_changelog: @grep -n '^[^12 ]' $$(find . -name ChangeLog) && \ { echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \ -- cgit v1.2.1