public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@sebabeach.org>
To: cgen@sourceware.org
Subject: [patch] Fix pmacro handling of default values when passed an empty arg list.
Date: Thu, 01 May 2008 14:14:00 -0000	[thread overview]
Message-ID: <200804261834.m3QIYYVh005487@seba.sebabeach.org> (raw)

Re:

    * From: Joern Rennecke <joernr at arc dot com>
    * To: cgen at sources dot redhat dot com
    * Date: Thu, 18 Jan 2007 15:27:24 +0000
    * Subject: bug when eliding arguments with default values?

I have some problem where I thougt an optional argument would be useful
for a macro that usually doesn't take an argument.
The actual code is a bit complex, so here is a stripped down example:

guile> (define-pmacro '(foo (arg1 . 1)) '(bar arg1))
guile> (pmacro-expand '(foo))
[...]
/pmacros.scm:99:3: In procedure error in expression (error (string-append # ":" ...) expr):
./pmacros.scm:99:3: standard input:13:wrong number of arguments to pmacro (foo arg1): ()
ABORT: (misc-error)

Maybe something like this,

2008-04-26  Doug Evans  <dje@sebabeach.org>

	* pmacros.scm (-pmacro-process-args): Fix handling of default values
	when passed an empty arg list.

Index: pmacros.scm
===================================================================
RCS file: /cvs/src/src/cgen/pmacros.scm,v
retrieving revision 1.5
diff -u -p -r1.5 pmacros.scm
--- pmacros.scm	13 Jun 2005 22:28:30 -0000	1.5
+++ pmacros.scm	26 Apr 2008 18:23:07 -0000
@@ -148,7 +148,8 @@
 ; DEFAULT-VALUES.
 
 (define (-pmacro-process-args arg-spec default-values args)
-  (if (and (pair? args) (keyword? (car args)))
+  (if (or (and (pair? args) (keyword? (car args)))
+	  (null? args))
       (-pmacro-process-keyworded-args arg-spec default-values args)
       args)
 )

                 reply	other threads:[~2008-04-26 18:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=200804261834.m3QIYYVh005487@seba.sebabeach.org \
    --to=dje@sebabeach.org \
    --cc=cgen@sourceware.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).