bug-gnulib
[Top][All Lists]
Advanced

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

Re: string.h uses restrict


From: Ralf Wildenhues
Subject: Re: string.h uses restrict
Date: Sat, 4 Apr 2009 09:57:54 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Reuben,

a couple of nits:

* Reuben Thomas wrote on Fri, Apr 03, 2009 at 03:57:46PM CEST:
> --- a/top/maint.mk
> +++ b/top/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; };       
> \

If I read this correctly, then you need a semi-colon after `each use',
otherwise the `test "x$$re" != x' will never actually be evaluated, but
the result of the previous `:' be used always.

(classic trap of untested safety belts ;-)

> +  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

> +# 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/\./\\./'`;                                        
> \

's/\./\\./g'  ?  Yes, remote, I know, but can't hurt nonetheless.

> +  if $(C_SOURCES) | grep '\.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

Cheers,
Ralf




reply via email to

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