Source-Changes-HG archive

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

[src/netbsd-1-6]: src/lib/libc/sys Pull up revision 1.9 (requested by thorpej...



details:   https://anonhg.NetBSD.org/src/rev/a946be9c9a1c
branches:  netbsd-1-6
changeset: 529321:a946be9c9a1c
user:      he <he%NetBSD.org@localhost>
date:      Mon Nov 11 21:47:58 2002 +0000

description:
Pull up revision 1.9 (requested by thorpej in ticket #803):
  Fix some problems using makelintstub as a cross-tool:
   o Require that the path to the C preprocessor be passed
     in the CPP environment variable, and use it rather than
     hard-coding "cpp".  Provide the target's preprocessor
     when invoking makelintstub.
   o Fix some quoting issues found with Solaris 8's XPG4 sh
     and sed.
   o Do not use "echo -n".  The resulting whitespace is not
     supposed to be syntactically significant anyway.

diffstat:

 lib/libc/sys/makelintstub |  31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diffs (95 lines):

diff -r 72938e8a1fed -r a946be9c9a1c lib/libc/sys/makelintstub
--- a/lib/libc/sys/makelintstub Sun Nov 10 16:30:44 2002 +0000
+++ b/lib/libc/sys/makelintstub Mon Nov 11 21:47:58 2002 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh -
-# $NetBSD: makelintstub,v 1.8 2001/11/13 18:39:10 tv Exp $
+# $NetBSD: makelintstub,v 1.8.2.1 2002/11/11 21:47:58 he Exp $
 #
 # Copyright (c) 1996, 1997 Christopher G. Demetriou
 # All rights reserved.
@@ -37,6 +37,8 @@
 {
 
        echo "usage: $0 [-n|-p] [-o filename] object ..."
+       echo "       The CPP environment variable must be set"
+       echo "       to the path to the C preprocessor."
        exit 1
 }
 
@@ -82,7 +84,7 @@
        arglist="`
        sed -e 'ta
                :a
-               s,^/\* syscall: "'"$syscallname"'" ,,
+               s,^/\* syscall: \"'"$syscallname"'\" ,,
                tb
                d
                :b
@@ -108,35 +110,38 @@
        # do ANSI C function header
        echo    "#ifdef __STDC__"
 
-       echo -n "$funcname("
+       echo "$funcname("
        first=yes; i=1
        for arg; do
                if [ $first = yes ]; then
                        first=no
                else
-                       echo -n ", "
+                       echo ", "
                fi
                case "$arg" in
-               "...") echo -n "...";;
-               *) echo -n "$arg arg$i"; i=$(($i + 1));;
+               "...") echo "...";;
+               *) echo "$arg arg$i"; i=$(($i + 1));;
                esac
        done
+       if [ $first = yes ]; then
+               echo "void"
+       fi
        echo    ")"
 
        # do K&R C function header
        echo    "#else"
 
-       echo -n "$funcname("
+       echo "$funcname("
        first=yes; i=1
        for arg; do
                if [ $first = yes ]; then
                        first=no
                else
-                       echo -n ", "
+                       echo ", "
                fi
                case "$arg" in
-               "...") echo -n "va_alist";;
-               *) echo -n "arg$i"; i=$(($i + 1));;
+               "...") echo "va_alist";;
+               *) echo "arg$i"; i=$(($i + 1));;
                esac
        done
        echo    ")"
@@ -174,6 +179,10 @@
 syscallhdr=/usr/include/sys/syscall.h
 syscalldump=/tmp/makelintstub.$$
 
+if test "x${CPP}" = "x"; then
+       usage
+fi
+
 if test $? -ne 0; then
        usage
 fi
@@ -200,7 +209,7 @@
 trap "rm -f $syscalldump" 0 1 2 15
 
 header
-printf '#include "'"$syscallhdr"'"' | cpp -C >$syscalldump
+printf '#include "'"$syscallhdr"'"' | ${CPP} -C >$syscalldump
 for syscall; do
        fnname=${syscall%.S}
        if [ $pflag = YES ]; then



Home | Main Index | Thread Index | Old Index