c/594: cpp errs when one macro calls another
mcartoaj@mat.ulaval.ca
mcartoaj@mat.ulaval.ca
Tue Oct 3 10:06:00 GMT 2000
>Number: 594
>Category: c
>Synopsis: cpp errs when one macro calls another
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 03 10:06:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Mihai Cartoaje
>Release: 2.8.1
>Organization:
>Environment:
Linux & Solaris
>Description:
In cpp, the code,
#define __T_TYPE float
#define __T_ADD __T_ADD_(__T_TYPE)
__T_ADD
gives,
__T_ADD_(float )
and the code,
#define __T_ADD_(name) name##_float
__T_ADD_(float )
gives,
float_add
However, the code,
#define __T_TYPE float
#define __T_ADD_(name) name##_float
#define __T_ADD __T_ADD(__T_TYPE)
__T_ADD
gives,
__T_TYPE_add
So if we write the output of a first macro explicitly,
it will work correctly, otherwise, cpp will err when one
macro calls another.
>How-To-Repeat:
gcc test.c -E
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.c"
I2RlZmluZSBfX1RfVFlQRSBmbG9hdAoKI2RlZmluZSBfX1RfQUREIF9fVF9BRERfKF9fVF9UWVBF
KQoKI2RlZmluZSBfX1RfQUREXyhuYW1lKSBuYW1lIyNfYWRkCgoKX19UX0FERAoKCg==
More information about the Gcc-bugs
mailing list