public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: aaronw@net.com To: gcc-gnats@gcc.gnu.org Subject: c/10829: Macros that worked in 2.95.3 don't work in 3.3 Date: Sat, 17 May 2003 04:36:00 -0000 [thread overview] Message-ID: <20030517043356.8575.qmail@sources.redhat.com> (raw) >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 <stdio.h> 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
next reply other threads:[~2003-05-17 4:36 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-17 4:36 aaronw [this message] 2003-05-17 5:26 Zack Weinberg 2003-05-17 5:31 zack 2003-05-17 6:16 Aaron Williams 2003-05-17 6:26 Zack Weinberg
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030517043356.8575.qmail@sources.redhat.com \ --to=aaronw@net.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).