Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/calendar __CONCAT does token pasting, not string con...



details:   https://anonhg.NetBSD.org/src/rev/b3645b040b8e
branches:  trunk
changeset: 500885:b3645b040b8e
user:      cgd <cgd%NetBSD.org@localhost>
date:      Wed Dec 20 01:03:16 2000 +0000

description:
__CONCAT does token pasting, not string concatnation.  if something like:
        __CONCAT("foo","bar");
actually works to concantate strings, it's because the preprocessor expands
it into "foo""bar" as separate strings, and then ANSI string concatenation
is performed on that.  It's more straightforward to just use ANSI string
concatenation directly, and newer GCCs complain (rightly) about misuse
of token pasting.

diffstat:

 usr.bin/calendar/calendar.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 3f69963f9421 -r b3645b040b8e usr.bin/calendar/calendar.c
--- a/usr.bin/calendar/calendar.c       Wed Dec 20 00:31:41 2000 +0000
+++ b/usr.bin/calendar/calendar.c       Wed Dec 20 01:03:16 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: calendar.c,v 1.23 2000/11/29 15:29:51 christos Exp $   */
+/*     $NetBSD: calendar.c,v 1.24 2000/12/20 01:03:16 cgd Exp $        */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)calendar.c 8.4 (Berkeley) 1/7/95";
 #endif
-__RCSID("$NetBSD: calendar.c,v 1.23 2000/11/29 15:29:51 christos Exp $");
+__RCSID("$NetBSD: calendar.c,v 1.24 2000/12/20 01:03:16 cgd Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -344,7 +344,7 @@
                        (void)close(pdes[1]);
                }
                (void)close(pdes[0]);
-               execl(_PATH_CPP, "cpp", "-P", "-I.", __CONCAT("-I",_PATH_CALENDARS), NULL);
+               execl(_PATH_CPP, "cpp", "-P", "-I.", "-I" _PATH_CALENDARS, NULL);
                warn("execl: %s", _PATH_CPP);
                _exit(1);
        }



Home | Main Index | Thread Index | Old Index