[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#590008: cpp-4.4: incorrect macro expansion when a macro call results in the same macro being called



Package: cpp-4.4
Version: 4.4.4-6
Severity: normal

Here's an example

    #define appendc(x) x##c
    #define aXc(X) appendc(a##X)
    #define abc appendc(abb)

    int aXc(b) = 0; // appendc(ab) -> abc -> appendc(abb) -> abbc

    int main(int argc, char *argv[])
    {
        return abbc;
    }

The call "aXc(b)" should result in abbc.
Instead the preprocessor refuses to invoke appendc() the second time, resulting in

    int appendc(abb) = 0;

This isn't a self-referential macro, so I don't see why it should misbehave as it does.
-- System Information:
Debian Release: 5.0.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages cpp-4.4 depends on:
ii  gcc-4.4-base              4.4.4-6        The GNU Compiler Collection (base 
ii  libc6                     2.11.1-3       Embedded GNU C Library: Shared lib
ii  libgmp3c2                 2:4.2.2+dfsg-3 Multiprecision arithmetic library
ii  libmpfr1ldbl              2.3.1.dfsg.1-2 multiple precision floating-point 

cpp-4.4 recommends no packages.

Versions of packages cpp-4.4 suggests:
pn  gcc-4.4-locales               <none>     (no description available)

-- no debconf information



Reply to: