Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint Add hooks for compiling on non-NetBSD hosts.



details:   https://anonhg.NetBSD.org/src/rev/718c4fbfda31
branches:  trunk
changeset: 521004:718c4fbfda31
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Jan 21 19:49:51 2002 +0000

description:
Add hooks for compiling on non-NetBSD hosts.

diffstat:

 usr.bin/xlint/common/emit.c    |   7 +++----
 usr.bin/xlint/common/inittyp.c |   7 +++----
 usr.bin/xlint/common/lint.h    |  15 +++++++++++++--
 usr.bin/xlint/common/mem.c     |   5 ++---
 usr.bin/xlint/lint2/chk.c      |   7 +++----
 usr.bin/xlint/lint2/emit2.c    |   6 ++----
 usr.bin/xlint/lint2/hash.c     |   7 +++----
 usr.bin/xlint/lint2/mem2.c     |  10 ++++------
 usr.bin/xlint/lint2/msg.c      |  14 ++++++--------
 usr.bin/xlint/lint2/read.c     |   9 ++++-----
 usr.bin/xlint/xlint/xlint.c    |  35 ++++++++++++++++++++---------------
 11 files changed, 63 insertions(+), 59 deletions(-)

diffs (truncated from 424 to 300 lines):

diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/common/emit.c
--- a/usr.bin/xlint/common/emit.c       Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/common/emit.c       Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emit.c,v 1.1 2002/01/18 20:39:22 thorpej Exp $ */
+/*     $NetBSD: emit.c,v 1.2 2002/01/21 19:49:51 tv Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,13 +33,12 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: emit.c,v 1.1 2002/01/18 20:39:22 thorpej Exp $");
+__RCSID("$NetBSD: emit.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
 #endif
 
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
-#include <err.h>
 
 #include "lint.h"
 
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/common/inittyp.c
--- a/usr.bin/xlint/common/inittyp.c    Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/common/inittyp.c    Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inittyp.c,v 1.1 2002/01/18 21:01:38 thorpej Exp $      */
+/*     $NetBSD: inittyp.c,v 1.2 2002/01/21 19:49:51 tv Exp $   */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,13 +33,12 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: inittyp.c,v 1.1 2002/01/18 21:01:38 thorpej Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
 #endif
 
-#include <stdlib.h>
 #include <ctype.h>
 #include <limits.h>
-#include <err.h>
+#include <stdlib.h>
 
 #include "lint.h"
 
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h       Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/common/lint.h       Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lint.h,v 1.1 2002/01/18 20:39:23 thorpej Exp $ */
+/*     $NetBSD: lint.h,v 1.2 2002/01/21 19:49:51 tv Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -31,9 +31,20 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#else
+#define HAVE_ERR_H 1
+#define HAVE_DECL_SYS_SIGNAME 1
+#endif
+
 #include <sys/types.h>
+#include <stddef.h>
 #include <stdio.h>
-#include <stddef.h>
+
+#if HAVE_ERR_H
+#include <err.h>
+#endif
 
 #include "param.h"
 
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/common/mem.c
--- a/usr.bin/xlint/common/mem.c        Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/common/mem.c        Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.1 2002/01/18 20:39:23 thorpej Exp $  */
+/*     $NetBSD: mem.c,v 1.2 2002/01/21 19:49:51 tv Exp $       */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,12 +33,11 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mem.c,v 1.1 2002/01/18 20:39:23 thorpej Exp $");
+__RCSID("$NetBSD: mem.c,v 1.2 2002/01/21 19:49:51 tv Exp $");
 #endif
 
 #include <stdlib.h>
 #include <string.h>
-#include <err.h>
 
 #include "lint.h"
 
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/lint2/chk.c
--- a/usr.bin/xlint/lint2/chk.c Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/lint2/chk.c Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.14 2002/01/18 21:01:39 thorpej Exp $ */
+/* $NetBSD: chk.c,v 1.15 2002/01/21 19:49:52 tv Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,13 +34,12 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: chk.c,v 1.14 2002/01/18 21:01:39 thorpej Exp $");
+__RCSID("$NetBSD: chk.c,v 1.15 2002/01/21 19:49:52 tv Exp $");
 #endif
 
-#include <stdlib.h>
 #include <ctype.h>
 #include <limits.h>
-#include <err.h>
+#include <stdlib.h>
 
 #include "lint2.h"
 
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/lint2/emit2.c
--- a/usr.bin/xlint/lint2/emit2.c       Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/lint2/emit2.c       Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.7 2001/07/26 15:05:10 wiz Exp $ */
+/* $NetBSD: emit2.c,v 1.8 2002/01/21 19:49:52 tv Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,11 +34,9 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: emit2.c,v 1.7 2001/07/26 15:05:10 wiz Exp $");
+__RCSID("$NetBSD: emit2.c,v 1.8 2002/01/21 19:49:52 tv Exp $");
 #endif
 
-#include <err.h>
-
 #include "lint2.h"
 
 static void    outtype(type_t *);
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/lint2/hash.c
--- a/usr.bin/xlint/lint2/hash.c        Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/lint2/hash.c        Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash.c,v 1.6 2001/05/28 12:40:38 lukem Exp $   */
+/*     $NetBSD: hash.c,v 1.7 2002/01/21 19:49:52 tv Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,18 +33,17 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hash.c,v 1.6 2001/05/28 12:40:38 lukem Exp $");
+__RCSID("$NetBSD: hash.c,v 1.7 2002/01/21 19:49:52 tv Exp $");
 #endif
 
 /*
  * XXX Really need a generalized hash table package
  */
 
+#include <limits.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include <limits.h>
-#include <err.h>
 
 #include "lint2.h"
 
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/lint2/mem2.c
--- a/usr.bin/xlint/lint2/mem2.c        Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/lint2/mem2.c        Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem2.c,v 1.5 2001/05/28 12:40:38 lukem Exp $   */
+/*     $NetBSD: mem2.c,v 1.6 2002/01/21 19:49:52 tv Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mem2.c,v 1.5 2001/05/28 12:40:38 lukem Exp $");
+__RCSID("$NetBSD: mem2.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
 #endif
 
 #include <sys/param.h>
@@ -41,7 +41,6 @@
 #include <sys/mman.h>
 #include <unistd.h>
 #include <string.h>
-#include <err.h>
 
 #include "lint2.h"
 
@@ -76,7 +75,8 @@
        void    *ptr;
        int     prot, flags;
 
-       sz = ALIGN(sz);
+       /* Align to at least 8 bytes. */
+       sz = (sz + 7) & ~7L;
        if (nxtfree + sz > mblklen) {
                /* use mmap() instead of malloc() to avoid malloc overhead. */
                prot = PROT_READ | PROT_WRITE;
@@ -84,8 +84,6 @@
                mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
                if (mbuf == (void *)-1)
                        err(1, "can't map memory");
-               if (ALIGN((u_long)mbuf) != (u_long)mbuf)
-                       errx(1, "mapped address is not aligned");
                (void)memset(mbuf, 0, mblklen);
                nxtfree = 0;
        }
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/lint2/msg.c
--- a/usr.bin/xlint/lint2/msg.c Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/lint2/msg.c Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.c,v 1.5 2001/05/28 12:40:38 lukem Exp $    */
+/*     $NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv Exp $       */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -33,17 +33,15 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: msg.c,v 1.5 2001/05/28 12:40:38 lukem Exp $");
+__RCSID("$NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
 #endif
 
-#include <string.h>
-
 #include <stdio.h>
 #include <stdarg.h>
+#include <string.h>
 
 #include "lint2.h"
 
-
 static const   char *msgs[] = {
        "%s used( %s ), but not defined",                             /* 0 */
        "%s defined( %s ), but never used",                           /* 1 */
@@ -66,7 +64,7 @@
        "%s renamed multiple times  \t%s  ::  %s",                    /* 18 */
 };
 
-static const   char *basename(const char *);
+static const   char *lbasename(const char *);
 
 void
 msg(int n, ...)
@@ -85,7 +83,7 @@
  * Return a pointer to the last component of a path.
  */
 static const char *
-basename(const char *path)
+lbasename(const char *path)
 {
        const   char *cp, *cp1, *cp2;
 
@@ -123,7 +121,7 @@
        }
        qm = !Hflag && posp->p_src != posp->p_isrc;
 
-       len = strlen(fn = basename(fnames[src]));
+       len = strlen(fn = lbasename(fnames[src]));
        len += 3 * sizeof (u_short) + 4;
 
        if (len > blen)
diff -r f83d1be82b0e -r 718c4fbfda31 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c        Mon Jan 21 19:22:53 2002 +0000
+++ b/usr.bin/xlint/lint2/read.c        Mon Jan 21 19:49:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.11 2002/01/03 18:50:54 tron Exp $ */
+/* $NetBSD: read.c,v 1.12 2002/01/21 19:49:52 tv Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,15 +34,14 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: read.c,v 1.11 2002/01/03 18:50:54 tron Exp $");
+__RCSID("$NetBSD: read.c,v 1.12 2002/01/21 19:49:52 tv Exp $");
 #endif
 
+#include <ctype.h>



Home | Main Index | Thread Index | Old Index