guile-devel
[Top][All Lists]
Advanced

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

[PATCH] Make guile-func-name-check handle inhibition directives.


From: Thien-Thi Nguyen
Subject: [PATCH] Make guile-func-name-check handle inhibition directives.
Date: Fri, 25 Jun 2010 14:23:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

This changes the strident warnings for pairs.c into a simple
reminder (not really a warning) that the Programmer Knows Best!
(Ignore that snickering sound you hear from the computer...)

thi

__________________________________
>From 0c94e1b8d5b80d6f5d811da77e68ede51fd98f47 Mon Sep 17 00:00:00 2001
From: Thien-Thi Nguyen <address@hidden>
Date: Fri, 25 Jun 2010 12:13:04 +0200
Subject: [PATCH 6/8] [maint] Make guile-func-name-check handle inhibition 
directives.

* libguile/guile-func-name-check: Add handling for
directives in the scanned file to inhibit processing.
* libguile/pairs.c: Inhibit guile-func-name-check for c[ad]+r block.
---
 libguile/guile-func-name-check |   15 ++++++++++++++-
 libguile/pairs.c               |    3 +++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/libguile/guile-func-name-check b/libguile/guile-func-name-check
index 5a20275..83a08a3 100644
--- a/libguile/guile-func-name-check
+++ b/libguile/guile-func-name-check
@@ -24,6 +24,18 @@
 BEGIN {
     filename = ARGV[1];
     in_a_func = 0;
+    inhibit = 0;
+}
+
+# By default, processing is uninhibited.  In the scanned file, the comment:
+#   /* guile-func-name-check: TEXT */
+# inhibits processing if TEXT is anything but "ok", and displays TEXT to 
stderr.
+# This is used in pairs.c, for example.
+/^.. guile-func-name-check: / {
+    inhibit = ($3 != "ok");
+    sub (/^.../, "");
+    sub (/...$/, "");
+    print filename ":" NR ": " $0 > "/dev/stderr"
 }
 
 # Extract the function name from "SCM_DEFINE (foo, ...".
@@ -32,7 +44,8 @@ BEGIN {
     func_name = $0;
     sub (/^[^\(\n]*\([ \t]*/, "", func_name);
     sub (/[ \t]*,.*/, "", func_name);
-    in_a_func = 1;
+    if (! inhibit)
+        in_a_func = 1;
 }
 
 # Check that for "SCM_DEFINE (foo, ...)", we see:
diff --git a/libguile/pairs.c b/libguile/pairs.c
index da0d7b9..9a41f06 100644
--- a/libguile/pairs.c
+++ b/libguile/pairs.c
@@ -143,6 +143,9 @@ SCM_DEFINE (scm_set_cdr_x, "set-cdr!", 2, 0, 0,
   while (pattern_var);                                                  \
   return tree
 
+/* The following comment is a directive for guile-func-name-check, q.v.  */
+
+/* guile-func-name-check: no thanks! (disabled for c[ad]+r (rest of file))  */
 
 SCM_DEFINE (scm_cdr, "cdr", 1, 0, 0, (SCM x), "")
 {
-- 
1.6.3.2


reply via email to

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