public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: tim.vanholder@falconsoft.be
To: gcc-gnats@gcc.gnu.org
Subject: preprocessor/2790: Preprocessor has problems using ## to construct valid C code.
Date: Wed, 09 May 2001 05:36:00 -0000	[thread overview]
Message-ID: <200105091230.OAA27695@bender.falconsoft.be> (raw)

>Number:         2790
>Category:       preprocessor
>Synopsis:       Preprocessor has problems using ## to construct valid C code.
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed May 09 05:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tim Van Holder
>Release:        3.0 20010430 (prerelease)
>Organization:
Falcon Software N.V.
>Environment:
System: Linux bender.falconsoft.be 2.2.16-3 #19 Thu Nov 30 11:39:13 CET 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --with-gcc-version-trigger=/home/tim/gnu/gcc/gcc/version.c --host=i686-pc-linux-gnu --with-version-specific-runtime-libs --prefix=/opt/gcc3
>Description:

gcc's preprocessor gives warnings for what I believe to be valid code.

>How-To-Repeat:

Try to compile the code below.

struct bar {
  int a;
  int b;
};

/* This simplifies the basic 'property get'-type functions */
#define TAKE_FUNCTION(foo)	\
int take_##foo(struct bar* me)	\
{				\
  if (me == 0)			\
    return 0;			\
  return me->##foo;		\
}

TAKE_FUNCTION(a)
TAKE_FUNCTION(b)

#undef TAKE_FUNCTION

You will get
 warning: pasting "->" and "a" does not give a valid preprocessing token
 warning: pasting "->" and "b" does not give a valid preprocessing token

The same happens if (*me).##foo is used.

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2001-05-09  5:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200105091230.OAA27695@bender.falconsoft.be \
    --to=tim.vanholder@falconsoft.be \
    --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: link
Be 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).