Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/mkdep PR/43364: Nicolas Joly: mkdep(1) wrong target ...



details:   https://anonhg.NetBSD.org/src/rev/16b6a642888f
branches:  trunk
changeset: 755180:16b6a642888f
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 26 15:04:40 2010 +0000

description:
PR/43364: Nicolas Joly: mkdep(1) wrong target names when suffix list miss .o

diffstat:

 usr.bin/mkdep/mkdep.c |  20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r a6bc27cf0408 -r 16b6a642888f usr.bin/mkdep/mkdep.c
--- a/usr.bin/mkdep/mkdep.c     Wed May 26 14:52:10 2010 +0000
+++ b/usr.bin/mkdep/mkdep.c     Wed May 26 15:04:40 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkdep.c,v 1.33 2009/04/12 14:23:30 lukem Exp $ */
+/* $NetBSD: mkdep.c,v 1.34 2010/05/26 15:04:40 christos Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #if !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\
  All rights reserved.");
-__RCSID("$NetBSD: mkdep.c,v 1.33 2009/04/12 14:23:30 lukem Exp $");
+__RCSID("$NetBSD: mkdep.c,v 1.34 2010/05/26 15:04:40 christos Exp $");
 #endif /* not lint */
 
 #include <sys/mman.h>
@@ -193,6 +193,7 @@
        int     ok_ind, ch;
        size_t  sz;
        int     fd;
+       size_t  slen;
        const char *fname;
        const char *suffixes = NULL, *s;
        suff_list_t *suff_list = NULL, *sl;
@@ -363,9 +364,20 @@
                                                    sl->len))
                                                break;
                                }
+                               /*
+                                * Not found, check for .o, since the
+                                * original file will have it.
+                                */
+                               if (sl->len == 0) {
+                                       if (memcmp(suf - 2, ".o", 2) == 0)
+                                               slen = 2;
+                                       else
+                                               slen = 0;
+                               } else
+                                       slen = sl->len;
                        }
-                       if (suff_list != NULL && sl->len != 0) {
-                               suf -= sl->len;
+                       if (suff_list != NULL && slen != 0) {
+                               suf -= slen;
                                for (sl = suff_list; sl->len != 0; sl++) {
                                        if (sl != suff_list)
                                                write(dependfile, " ", 1);



Home | Main Index | Thread Index | Old Index