public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* preprocessor/2790: Preprocessor has problems using ## to construct valid C code.
@ 2001-05-09  5:36 tim.vanholder
  0 siblings, 0 replies; only message in thread
From: tim.vanholder @ 2001-05-09  5:36 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-09  5:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-09  5:36 preprocessor/2790: Preprocessor has problems using ## to construct valid C code tim.vanholder

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).