Source-Changes-HG archive

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

[src/trunk]: src/bin/sh __CONCAT does token pasting, not string concatnation....



details:   https://anonhg.NetBSD.org/src/rev/5c2cb5ca0f70
branches:  trunk
changeset: 500882:5c2cb5ca0f70
user:      cgd <cgd%NetBSD.org@localhost>
date:      Wed Dec 20 00:15:10 2000 +0000

description:
__CONCAT does token pasting, not string concatnation.  if something like:
        __CONCAT("PATH=",_PATH_STDPATH);
actually works to concantate strings, it's because the preprocessor expands
it into "PATH=""whatever _PATH_STDPATH is" 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 mis-use of token pasting.

diffstat:

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

diffs (27 lines):

diff -r a76ac244a8c9 -r 5c2cb5ca0f70 bin/sh/var.c
--- a/bin/sh/var.c      Wed Dec 20 00:12:19 2000 +0000
+++ b/bin/sh/var.c      Wed Dec 20 00:15:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.25 2000/05/22 10:18:47 elric Exp $   */
+/*     $NetBSD: var.c,v 1.26 2000/12/20 00:15:10 cgd Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: var.c,v 1.25 2000/05/22 10:18:47 elric Exp $");
+__RCSID("$NetBSD: var.c,v 1.26 2000/12/20 00:15:10 cgd Exp $");
 #endif
 #endif /* not lint */
 
@@ -114,7 +114,7 @@
          NULL },
        { &vmpath,      VSTRFIXED|VTEXTFIXED|VUNSET,    "MAILPATH=",
          NULL },
-       { &vpath,       VSTRFIXED|VTEXTFIXED,           __CONCAT("PATH=",_PATH_DEFPATH),
+       { &vpath,       VSTRFIXED|VTEXTFIXED,           "PATH=" _PATH_DEFPATH,
          changepath },
        /*
         * vps1 depends on uid



Home | Main Index | Thread Index | Old Index