From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10045 invoked by alias); 26 Apr 2008 18:37:48 -0000 Received: (qmail 10036 invoked by uid 22791); 26 Apr 2008 18:37:48 -0000 X-Spam-Check-By: sourceware.org Received: from sebabeach.org (HELO seba.sebabeach.org) (64.165.110.50) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 26 Apr 2008 18:37:27 +0000 Received: from seba.sebabeach.org (seba.sebabeach.org [127.0.0.1]) by seba.sebabeach.org (8.14.2/8.14.2) with ESMTP id m3QIYYc9005490 for ; Sat, 26 Apr 2008 11:34:34 -0700 Received: (from dje@localhost) by seba.sebabeach.org (8.14.2/8.14.2/Submit) id m3QIYYVh005487; Sat, 26 Apr 2008 11:34:34 -0700 Date: Thu, 01 May 2008 14:14:00 -0000 Message-Id: <200804261834.m3QIYYVh005487@seba.sebabeach.org> From: Doug Evans To: cgen@sourceware.org Subject: [patch] Fix pmacro handling of default values when passed an empty arg list. X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00011.txt.bz2 Re: * From: Joern Rennecke * 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 * 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) )