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

Re: [libvirt] [PATCH 1/4] syntax-check: Don't include duplicate header



On 04/17/2013 04:25 AM, Osier Yang wrote:
> gnulib is excluded.
> ---
>  cfg.mk | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)

Looks like this patch is supposed to come before the patch named
 [1/3] syntax-check: Don't include public headers in internal source

> 
> diff --git a/cfg.mk b/cfg.mk
> index e60c4e3..dd67816 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -722,6 +722,30 @@ sc_prohibit_exit_in_tests:
>  	halt='use return, not exit(), in tests'				\
>  	  $(_sc_search_regexp)
>  
> +# Don't include duplicate header in the source (either *.c or *.h)
> +sc_prohibit_duplicate_header:
> +	@fail=0; for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do	\
> +	  awk '/# *include.*\.h/ {					\
> +	    match($$0, /[<"][^>"]*[">]/);				\
> +	    arr[substr($$0, RSTART + 1, RLENGTH - 2)]++;		\
> +	  }								\
> +	  END {								\
> +	    for (key in arr) {						\
> +	      if (arr[key] > 1)	{					\
> +		fail=1;							\
> +		printf("%d %s are included\n", arr[key], key);		\
> +	      }								\
> +	    }								\
> +	    if (fail == 1) {						\
> +	      printf("duplicate header(s) in " FILENAME "\n");		\
> +	      exit 1;							\
> +	    }								\
> +	  }' $$i || fail=1;						\
> +	done;								\
> +	if test $$fail -eq 1; then					\
> +	  { echo "$(ME)": avoid duplicate headers >&2; exit 1; }	\
> +	fi;
> +

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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