[libvirt] [PATCH] sytnax-check: add a check for risky ctype macro use

Jim Meyering jim at meyering.net
Thu May 8 14:41:21 UTC 2008


A follow-up to the patch that introduced to_uchar.
This rule will ensure no new offenders sneak back in.

>From d141d07c7e21cc228fe46d90f21dd86685d7e424 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Thu, 8 May 2008 16:18:13 +0200
Subject: [PATCH] sytnax-check: add a check for risky ctype macro use

* Makefile.maint (sc_risky_ctype_macros): New rule.
---
 Makefile.maint |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Makefile.maint b/Makefile.maint
index ddf42bc..bab8e1d 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -302,6 +302,15 @@ sc_TAB_in_indentation:
 	  { echo '$(ME): found TAB(s) use for indentation; use spaces'	\
 		1>&2; exit 1; } || :

+ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
+|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
+
+sc_risky_ctype_macros:
+	@grep -E '\b($(ctype_re)) *\(' /dev/null			\
+	     $$($(VC_LIST_EXCEPT)) | grep -v to_uchar &&		\
+	  { echo '$(ME): found ctype macro use without to_uchar'	\
+		1>&2; exit 1; } || :
+
 # Match lines like the following, but where there is only one space
 # between the options and the description:
 #   -D, --all-repeated[=delimit-method]  print all duplicate lines\n
--
1.5.5.1.148.gbc1be




More information about the libvir-list mailing list