From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12399 invoked by alias); 17 May 2003 04:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12380 invoked by uid 71); 17 May 2003 04:36:00 -0000 Resent-Date: 17 May 2003 04:36:00 -0000 Resent-Message-ID: <20030517043600.12379.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, aaronw@net.com Received: (qmail 8587 invoked by uid 48); 17 May 2003 04:33:56 -0000 Message-Id: <20030517043356.8575.qmail@sources.redhat.com> Date: Sat, 17 May 2003 04:36:00 -0000 From: aaronw@net.com Reply-To: aaronw@net.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/10829: Macros that worked in 2.95.3 don't work in 3.3 X-SW-Source: 2003-05/txt/msg01930.txt.bz2 List-Id: >Number: 10829 >Category: c >Synopsis: Macros that worked in 2.95.3 don't work in 3.3 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sat May 17 04:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Aaron Williams >Release: 3.3 >Organization: >Environment: Solaris 2.7, 32-bit Ultrasparc >Description: When I compile the attached file with gcc 2.95.3 everything works fine. When I try and compile with gcc 3.3 I get the following error: test.c:15:19: pasting "PAP_int" and "(" does not give a valid preprocessing token test.c:15:19: pasting "PAT_int" and "(" does not give a valid preprocessing token test.c:15:19: pasting "(" and "1" does not give a valid preprocessing token test.c:15:19: pasting "1" and ")" does not give a valid preprocessing token The contents of the test file are: #include typedef struct { int val1, val2, val3; } s_t; #define PAT_int(num) val ## num #define PAP_int #define TEST(t, num) (PAP_ ## t ## (c->PAT_ ## t ## ( ## num ## ))) int func(s_t *c) { int n; n = TEST(int,1); return n+1; } int main(int argc, char *argv[]) { s_t c; int a; c.val1 = 10; a = func(&c); printf("Result is %d\n", a); } When compiled with gcc 2.95.3 it works correctly and prints out "Result is 11". >How-To-Repeat: Attempt to compile the above code with gcc 3.3 >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-csrc; name="test.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.c" I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdCB7CiAgICBpbnQgdmFsMSwgdmFsMiwg dmFsMzsKfSBzX3Q7CgojZGVmaW5lIFBBVF9pbnQobnVtKSB2YWwgIyMgbnVtCiNkZWZpbmUgUEFQ X2ludAoKI2RlZmluZSBURVNUKHQsIG51bSkgKFBBUF8gIyMgdCAjIyAoYy0+UEFUXyAjIyB0ICMj ICggIyMgbnVtICMjICkpKQoKaW50IGZ1bmMoc190ICpjKQp7CiAgICBpbnQgbjsKICAgIG4gPSBU RVNUKGludCwxKTsKICAgIHJldHVybiBuKzE7Cn0KCmludCBtYWluKGludCBhcmdjLCBjaGFyICph cmd2W10pCnsKICAgIHNfdCBjOwogICAgaW50IGE7CgogICAgYy52YWwxID0gMTA7CiAgICBhID0g ZnVuYygmYyk7CiAgICBwcmludGYoIlJlc3VsdCBpcyAlZFxuIiwgYSk7Cn0K