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