unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: guile-devel@gnu.org
Subject: [PATCH] Make guile-func-name-check handle inhibition directives.
Date: Fri, 25 Jun 2010 14:23:17 +0200	[thread overview]
Message-ID: <87tyore1xm.fsf@ambire.localdomain> (raw)

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


             reply	other threads:[~2010-06-25 12:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 12:23 Thien-Thi Nguyen [this message]
2010-06-28 13:50 ` [PATCH] Make guile-func-name-check handle inhibition directives Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tyore1xm.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).