unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Make guile-func-name-check handle inhibition directives.
@ 2010-06-25 12:23 Thien-Thi Nguyen
  2010-06-28 13:50 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Thien-Thi Nguyen @ 2010-06-25 12:23 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

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

__________________________________

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0006-maint-Make-guile-func-name-check-handle-inhibition-d.patch --]
[-- Type: text/x-diff, Size: 2069 bytes --]

From 0c94e1b8d5b80d6f5d811da77e68ede51fd98f47 Mon Sep 17 00:00:00 2001
From: Thien-Thi Nguyen <ttn@gnuvola.org>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-28 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 12:23 [PATCH] Make guile-func-name-check handle inhibition directives Thien-Thi Nguyen
2010-06-28 13:50 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).