Your message dated Sun, 29 Dec 2002 14:27:35 +0100 with message-id <[EMAIL PROTECTED]> and subject line Bug#138201: cpp: macro expansion inside macro calling has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database) -------------------------------------- Received: (at maintonly) by bugs.debian.org; 13 Mar 2002 21:21:29 +0000 >From [EMAIL PROTECTED] Wed Mar 13 15:21:29 2002 Return-path: <[EMAIL PROTECTED]> Received: from (adsl-nrp8-C8B73A51.sao.terra.com.br) [200.183.58.81] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 16lGBP-0003oz-00; Wed, 13 Mar 2002 15:21:19 -0600 Received: from mantis.autsens.localnet ([192.168.131.7] ident=mail) by adsl-nrp8-C8B73A51.sao.terra.com.br with esmtp (Exim 3.12 #1 (Debian)) id 16lGBI-0003hR-00 for <[EMAIL PROTECTED]>; Wed, 13 Mar 2002 21:21:08 +0000 Received: from betoes by mantis.autsens.localnet with local (Exim 3.34 #1 (Debian)) id 16lGBD-0003zM-00; Wed, 13 Mar 2002 18:21:03 -0300 Date: Wed, 13 Mar 2002 18:21:01 -0300 From: [EMAIL PROTECTED] To: Debian Bug Tracking System <[EMAIL PROTECTED]> Subject: cpp: macro expansion inside macro calling Message-ID: <[EMAIL PROTECTED]> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.27i X-Reportbug-Version: 1.43 Sender: Jose Roberto B de A Monteiro <[EMAIL PROTECTED]> X-mail-filter-pl: done X-BadReturnPath: [EMAIL PROTECTED] rewritten as [EMAIL PROTECTED] using "From" header Delivered-To: [EMAIL PROTECTED] Package: cpp Version: 2:2.95.4-9 Severity: wishlist For example, if a define two macros: #define a_bit P4,0x08 #define setbit(port,bit) port ## OUT |= bit And, considering the following line (source code): setbit(a_bit); It will generate an error: "macro `setbit' used with just one arg" It occurs because a_bit will be expanded after setbit. Ok, it would be desirable in some situations, but in this case, it may be better if a_bit would be expanded first. Please, let me know if I am doing anything wrong, if there is a way to do something similar to that. Thanks! -- System Information Debian Release: 3.0 Architecture: i386 Kernel: Linux mantis 2.2.19 #1 Sat Oct 20 18:09:49 EST 2001 i686 Locale: LANG=pt_BR, LC_CTYPE=pt_BR Versions of packages cpp depends on: ii cpp-2.95 1:2.95.4-1 The GNU C preprocessor. --------------------------------------- Received: (at 138201-done) by bugs.debian.org; 29 Dec 2002 13:28:33 +0000 >From [EMAIL PROTECTED] Sun Dec 29 07:28:32 2002 Return-path: <[EMAIL PROTECTED]> Received: from mail.cs.tu-berlin.de [130.149.17.13] (root) by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 18SdUW-0003Ml-00; Sun, 29 Dec 2002 07:28:32 -0600 Received: from bolero.cs.tu-berlin.de ([EMAIL PROTECTED] [130.149.19.1]) by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id OAA04541; Sun, 29 Dec 2002 14:27:35 +0100 (MET) Received: (from [EMAIL PROTECTED]) by bolero.cs.tu-berlin.de (8.11.6+Sun/8.9.3) id gBTDRZp22043; Sun, 29 Dec 2002 14:27:35 +0100 (MET) From: Matthias Klose <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <[EMAIL PROTECTED]> Date: Sun, 29 Dec 2002 14:27:35 +0100 To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: Bug#138201: cpp: macro expansion inside macro calling In-Reply-To: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid Delivered-To: [EMAIL PROTECTED] X-Spam-Status: No, hits=-8.2 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01 version=2.41 X-Spam-Level: [EMAIL PROTECTED] writes: > Package: cpp > Version: 2:2.95.4-9 > Severity: wishlist > > For example, if a define two macros: > > #define a_bit P4,0x08 > #define setbit(port,bit) port ## OUT |= bit > > And, considering the following line (source code): > > setbit(a_bit); > > It will generate an error: "macro `setbit' used with just one arg" > > It occurs because a_bit will be expanded after setbit. Ok, it would be > desirable in some situations, but in this case, it may be better if > a_bit would be expanded first. > > Please, let me know if I am doing anything wrong, if there is a way to > do something similar to that. Thanks! macro arguments are expanded first. Should define setbit2 as current setbit, and #define setbit(x) setbit2(x) will work. Thanks to Neil Booth pointing this out. The "workaround" suggested is the correct solution: From: Kalle Olavi Niemitalo <[EMAIL PROTECTED]> #define a_bit P4,0x08 #define setbit(port,bit) port ## OUT |= bit #define setbit1(args) setbit(args) setbit1(a_bit)