[Pkg-virtualbox-commits] [kbuild] 01/06: Imported Upstream version 0.1.9998svn2745+dfsg
Gianfranco Costamagna
locutusofborg-guest at moszumanska.debian.org
Fri Jan 16 09:37:14 UTC 2015
This is an automated email from the git hooks/post-receive script.
locutusofborg-guest pushed a commit to branch master
in repository kbuild.
commit 79b20eab9743e408303e5e7a63f5749e5b1767c8
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date: Fri Jan 16 10:34:58 2015 +0100
Imported Upstream version 0.1.9998svn2745+dfsg
---
Config.kmk | 36 +++++---
VSlickMacros/kdev.e | 10 ++-
kBuild/sdks/WINPSDK.kmk | 4 +-
kBuild/sdks/WINPSDK71.kmk | 4 +-
kBuild/tools/VCC100.kmk | 8 +-
kBuild/tools/VCC100AMD64.kmk | 8 +-
kBuild/tools/VCC100X86.kmk | 8 +-
src/kmk/file.c | 15 +++-
src/kmk/hash.c | 3 +-
src/kmk/incdep.c | 200 +++++++++++++++++++++++++++++++++----------
src/kmk/kmkbuiltin.h | 8 +-
src/kmk/kmkbuiltin/test.c | 6 +-
src/kmk/make.h | 2 +-
src/kmk/misc.c | 8 ++
src/kmk/remake.c | 40 ++++++---
src/kmk/variable.c | 4 +-
16 files changed, 272 insertions(+), 92 deletions(-)
diff --git a/Config.kmk b/Config.kmk
index 8da05f6..a52e083 100644
--- a/Config.kmk
+++ b/Config.kmk
@@ -1,4 +1,4 @@
-# $Id: Config.kmk 2722 2014-02-19 15:28:22Z bird $
+# $Id: Config.kmk 2739 2014-12-23 21:18:40Z bird $
## @file
# Build Configuration.
#
@@ -223,6 +223,9 @@ ifeq ($(KBUILD_TARGET),darwin)
ifndef KBUILD_MACOSX_VERSION
export KBUILD_MACOSX_VERSION := $(expr $(firstword $(subst ., ,$(shell uname -r))) - 4)
endif
+ #ifndef KBUILD_XCODE_VERSION
+ # export KBUILD_XCODE_VERSION := $(shell xcodebuild -version | kmk_sed -e '/Xcode/!d' -e 's/Xcode *//')
+ #endif
ifndef KBUILD_MACOSX_TARGET_VERSION
if $(KBUILD_TARGET_ARCH) == amd64
KBUILD_MACOSX_TARGET_VERSION = 6
@@ -230,28 +233,33 @@ ifeq ($(KBUILD_TARGET),darwin)
KBUILD_MACOSX_TARGET_VERSION = 4
endif
endif
- if $(KBUILD_MACOSX_TARGET_VERSION) == 4
- TOOL_GCC4MACHO_SUFFIX = -4.0
- TOOL_GXX4MACHO_SUFFIX = -4.0
- else if $(KBUILD_MACOSX_TARGET_VERSION) >= 5
- TOOL_GCC4MACHO_SUFFIX = -4.2
- TOOL_GXX4MACHO_SUFFIX = -4.2
- endif
- ifndef KBUILD_MACOSX_SDK
- KBUILD_MACOSX_SDK := /Developer/SDKs/MacOSX10.$(KBUILD_MACOSX_TARGET_VERSION)$(if-expr $(KBUILD_MACOSX_TARGET_VERSION)==4,u,).sdk
+ ifndef KBUILD_MACOSX_WHATEVER_MODE
+ if $(KBUILD_MACOSX_TARGET_VERSION) == 4
+ TOOL_GCC4MACHO_SUFFIX = -4.0
+ TOOL_GXX4MACHO_SUFFIX = -4.0
+ else if $(KBUILD_MACOSX_TARGET_VERSION) >= 5
+ TOOL_GCC4MACHO_SUFFIX = -4.2
+ TOOL_GXX4MACHO_SUFFIX = -4.2
+ endif
+ ifndef KBUILD_MACOSX_SDK
+ KBUILD_MACOSX_SDK := /Developer/SDKs/MacOSX10.$(KBUILD_MACOSX_TARGET_VERSION)$(if-expr $(KBUILD_MACOSX_TARGET_VERSION)==4,u,).sdk
+ ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
+ KBUILD_MACOSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform$(KBUILD_MACOSX_SDK)
+ endif
+ endif
ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
- KBUILD_MACOSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform$(KBUILD_MACOSX_SDK)
+ $(error SDK not found ($(KBUILD_MACOSX_SDK)), please adjust KBUILD_MACOSX_TARGET_VERSION or/and KBUILD_MACOSX_SDK in LocalConfig.kmk or simply use KBUILD_MACOSX_WHATEVER_MODE=1.)
endif
- endif
+ endif # !KBUILD_MACOSX_WHATEVER_MODE
TEMPLATE_BIN_TOOL = GCC4MACHO
- TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=10.$(KBUILD_MACOSX_TARGET_VERSION) -isysroot $(KBUILD_MACOSX_SDK)
+ TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=10.$(KBUILD_MACOSX_TARGET_VERSION) $(if $(KBUILD_MACOSX_WHATEVER_MODE),,-isysroot $(KBUILD_MACOSX_SDK))
ifeq ($(USER),bird)
TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wno-long-long
TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
endif
TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
TEMPLATE_BIN_CFLAGS.release = -O3
- TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=10.$(KBUILD_MACOSX_TARGET_VERSION) -Wl,-syslibroot,$(KBUILD_MACOSX_SDK)
+ TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=10.$(KBUILD_MACOSX_TARGET_VERSION) $(if $(KBUILD_MACOSX_WHATEVER_MODE),,-Wl,-syslibroot,$(KBUILD_MACOSX_SDK))
if $(KBUILD_MACOSX_TARGET_VERSION) == 4 && $(KBUILD_MACOSX_VERSION) >= 5
TEMPLATE_BIN_LDFLAGS += -classic_ld
endif
diff --git a/VSlickMacros/kdev.e b/VSlickMacros/kdev.e
index e1247a0..f77cd21 100644
--- a/VSlickMacros/kdev.e
+++ b/VSlickMacros/kdev.e
@@ -1,4 +1,4 @@
-/* $Id: kdev.e 2701 2013-11-06 19:58:56Z bird $ -*- tab-width: 4 c-indent-level: 4 -*- */
+/* $Id: kdev.e 2737 2014-12-23 21:15:58Z bird $ -*- tab-width: 4 c-indent-level: 4 -*- */
/** @file
* Visual SlickEdit Documentation Macros.
*/
@@ -1211,7 +1211,7 @@ void k_javadoc_funcbox()
k_javadoc_box_start();
iCursorLine = p_RLine;
k_javadoc_box_line(' ');
- if (file_eq(p_extension, 'asm'))
+ if (file_eq(p_extension, 'asm') || file_eq(p_extension, 'masm'))
k_javadoc_box_line('@cproto', iPadd);
k_javadoc_box_line('@returns', iPadd);
if (fFoundFn)
@@ -1252,7 +1252,7 @@ void k_javadoc_funcbox()
else
k_javadoc_box_line('@param', iPadd);
- if (file_eq(p_extension, 'asm'))
+ if (file_eq(p_extension, 'asm') || file_eq(p_extension, 'masm'))
k_javadoc_box_line('@uses', iPadd);
if (fkStyleFullHeaders)
{
@@ -3387,7 +3387,9 @@ static _str aMyLangIds[] =
"ansic",
"antlr",
"as",
+#if __VERSION__ < 19.0
"asm",
+#endif
"c",
"cs",
"csh",
@@ -3414,7 +3416,9 @@ static _str aMyLangIds[] =
"rc",
"rul",
"tcl",
+#if __VERSION__ < 19.0
"s",
+#endif
"unixasm",
"vbs",
"xhtml",
diff --git a/kBuild/sdks/WINPSDK.kmk b/kBuild/sdks/WINPSDK.kmk
index e357676..e4fa690 100644
--- a/kBuild/sdks/WINPSDK.kmk
+++ b/kBuild/sdks/WINPSDK.kmk
@@ -1,4 +1,4 @@
-# $Id: WINPSDK.kmk 2602 2012-07-12 20:21:45Z bird $
+# $Id: WINPSDK.kmk 2735 2014-12-09 15:35:45Z bird $
## @file
# kBuild SDK - The Windows Platform SDK, targeting (KBUILD_TARGET).
#
@@ -91,7 +91,7 @@ SDK_WINPSDK_LIBS.x86 ?= \
$(PATH_SDK_WINPSDK_LIB.x86)/User32.Lib \
$(PATH_SDK_WINPSDK_LIB.x86)/Gdi32.Lib \
$(PATH_SDK_WINPSDK_LIB.x86)/AdvAPI32.Lib \
- $(PATH_SDK_WINPSDK_LIB.x86)/Shell32.Lib \
+ $(PATH_SDK_WINPSDK_LIB.x86)/shell32.lib \
$(PATH_SDK_WINPSDK_LIB.x86)/ShLwApi.Lib \
$(PATH_SDK_WINPSDK_LIB.x86)/SetupAPI.Lib \
$(PATH_SDK_WINPSDK_LIB.x86)/Uuid.Lib \
diff --git a/kBuild/sdks/WINPSDK71.kmk b/kBuild/sdks/WINPSDK71.kmk
index f030435..adcabe5 100644
--- a/kBuild/sdks/WINPSDK71.kmk
+++ b/kBuild/sdks/WINPSDK71.kmk
@@ -1,4 +1,4 @@
-# $Id: WINPSDK71.kmk 2602 2012-07-12 20:21:45Z bird $
+# $Id: WINPSDK71.kmk 2735 2014-12-09 15:35:45Z bird $
## @file
# kBuild SDK - The Windows Platform SDK v7.1, targeting (KBUILD_TARGET).
#
@@ -91,7 +91,7 @@ SDK_WINPSDK71_LIBS.x86 ?= \
$(PATH_SDK_WINPSDK71_LIB.x86)/User32.Lib \
$(PATH_SDK_WINPSDK71_LIB.x86)/Gdi32.Lib \
$(PATH_SDK_WINPSDK71_LIB.x86)/AdvAPI32.Lib \
- $(PATH_SDK_WINPSDK71_LIB.x86)/Shell32.Lib \
+ $(PATH_SDK_WINPSDK71_LIB.x86)/shell32.lib \
$(PATH_SDK_WINPSDK71_LIB.x86)/ShLwApi.Lib \
$(PATH_SDK_WINPSDK71_LIB.x86)/SetupAPI.Lib \
$(PATH_SDK_WINPSDK71_LIB.x86)/Uuid.Lib \
diff --git a/kBuild/tools/VCC100.kmk b/kBuild/tools/VCC100.kmk
index 85a1b47..d17702c 100644
--- a/kBuild/tools/VCC100.kmk
+++ b/kBuild/tools/VCC100.kmk
@@ -1,4 +1,4 @@
-# $Id: VCC100.kmk 2726 2014-02-26 23:23:54Z bird $
+# $Id: VCC100.kmk 2735 2014-12-09 15:35:45Z bird $
## @file
# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting $(KBUILD_TARGET).
#
@@ -329,8 +329,10 @@ define TOOL_VCC100_LINK_PROGRAM_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
endef
@@ -370,8 +372,10 @@ define TOOL_VCC100_LINK_DLL_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
$(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
$(eval _DIRS += $(PATH_STAGE_LIB))
endef
@@ -411,7 +415,9 @@ define TOOL_VCC100_LINK_SYSMOD_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
endef
diff --git a/kBuild/tools/VCC100AMD64.kmk b/kBuild/tools/VCC100AMD64.kmk
index 5e8c8f0..b0aceec 100644
--- a/kBuild/tools/VCC100AMD64.kmk
+++ b/kBuild/tools/VCC100AMD64.kmk
@@ -1,4 +1,4 @@
-# $Id: VCC100AMD64.kmk 2726 2014-02-26 23:23:54Z bird $
+# $Id: VCC100AMD64.kmk 2735 2014-12-09 15:35:45Z bird $
## @file
# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64.
#
@@ -306,8 +306,10 @@ define TOOL_VCC100AMD64_LINK_PROGRAM_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100AMD64_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
endef
@@ -347,8 +349,10 @@ define TOOL_VCC100AMD64_LINK_DLL_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100AMD64_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
$(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
$(eval _DIRS += $(PATH_STAGE_LIB))
endef
@@ -388,7 +392,9 @@ define TOOL_VCC100AMD64_LINK_SYSMOD_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100AMD64_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
endef
diff --git a/kBuild/tools/VCC100X86.kmk b/kBuild/tools/VCC100X86.kmk
index e593c66..3d58c77 100644
--- a/kBuild/tools/VCC100X86.kmk
+++ b/kBuild/tools/VCC100X86.kmk
@@ -1,4 +1,4 @@
-# $Id: VCC100X86.kmk 2726 2014-02-26 23:23:54Z bird $
+# $Id: VCC100X86.kmk 2735 2014-12-09 15:35:45Z bird $
## @file
# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting x86.
#
@@ -307,8 +307,10 @@ define TOOL_VCC100X86_LINK_PROGRAM_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100X86_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
+endif
endef
@@ -348,8 +350,10 @@ define TOOL_VCC100X86_LINK_DLL_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100X86_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
$(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
$(eval _DIRS += $(PATH_STAGE_LIB))
endef
@@ -389,7 +393,9 @@ define TOOL_VCC100X86_LINK_SYSMOD_CMDS
$(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
$(foreach p,$(libpath), /LIBPATH:$(p)) \
@$(outbase).rsp
+ifndef TOOL_VCC100X86_NO_AUTO_MANIFEST
$(QUIET)$(TEST) -f $(out).manifest -- \
$(TOOL_VCC100X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
+endif
endef
diff --git a/src/kmk/file.c b/src/kmk/file.c
index 16b0fe5..d6c6223 100644
--- a/src/kmk/file.c
+++ b/src/kmk/file.c
@@ -372,14 +372,25 @@ rehash_file (struct file *from_file, const char *to_hname)
to_file->multi_next = from_file->multi_next;
to_file->multi_head = f = from_file->multi_head;
if (f == from_file)
- for (; f != 0; f = f->multi_next)
- f->multi_head = to_file;
+ {
+ for (; f != 0; f = f->multi_next)
+ f->multi_head = to_file;
+ to_file->multi_head = to_file;
+ }
else
{
while (f->multi_next != from_file)
f = f->multi_next;
+ assert(f->multi_next == from_file);
f->multi_next = to_file;
}
+# ifdef NDEBUG
+ from_file->multi_head = to_file->multi_head;
+ from_file->multi_next = NULL;
+# else
+ from_file->multi_head = (struct file *)0x2; /* poison */
+ from_file->multi_next = (struct file *)0x8;
+# endif
}
#endif
diff --git a/src/kmk/hash.c b/src/kmk/hash.c
index 1cd44ab..88812e6 100644
--- a/src/kmk/hash.c
+++ b/src/kmk/hash.c
@@ -21,7 +21,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#endif
-#define CALLOC(t, n) ((t *) calloc (sizeof (t), (n)))
+/*#define CALLOC(t, n) ((t *) calloc (sizeof (t), (n)))*/
+#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n)))
#define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n)))
#define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n)))
#define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n)))
diff --git a/src/kmk/incdep.c b/src/kmk/incdep.c
index ae9aae7..bcf037f 100644
--- a/src/kmk/incdep.c
+++ b/src/kmk/incdep.c
@@ -1,5 +1,5 @@
#ifdef CONFIG_WITH_INCLUDEDEP
-/* $Id: incdep.c 2591 2012-06-17 20:45:31Z bird $ */
+/* $Id: incdep.c 2745 2015-01-03 19:32:00Z bird $ */
/** @file
* incdep - Simple dependency files.
*/
@@ -255,7 +255,7 @@ incdep_xmalloc (struct incdep *cur, size_t size)
}
#if 0
-/* memset(malloc(sz),'\0',sz) wrapper. */
+/* cmalloc wrapper */
static void *
incdep_xcalloc (struct incdep *cur, size_t size)
{
@@ -299,6 +299,42 @@ incdep_alloc_dep (struct incdep *cur)
return alloccache_calloc (cache);
}
+/* duplicates the dependency list pointed to by srcdep. */
+static struct dep *
+incdep_dup_dep_list (struct incdep *cur, struct dep const *srcdep)
+{
+ struct alloccache *cache;
+ struct dep *retdep;
+ struct dep *dstdep;
+
+ if (cur->worker_tid != -1)
+ cache = &incdep_dep_caches[cur->worker_tid];
+ else
+ cache = &dep_cache;
+
+ if (srcdep)
+ {
+ retdep = dstdep = alloccache_alloc (cache);
+ for (;;)
+ {
+ dstdep->name = srcdep->name; /* string cached */
+ dstdep->includedep = srcdep->includedep;
+ srcdep = srcdep->next;
+ if (!srcdep)
+ {
+ dstdep->next = NULL;
+ break;
+ }
+ dstdep->next = alloccache_alloc (cache);
+ dstdep = dstdep->next;
+ }
+ }
+ else
+ retdep = NULL;
+ return retdep;
+}
+
+
/* allocate a record. */
static void *
incdep_alloc_rec (struct incdep *cur)
@@ -755,7 +791,7 @@ incdep_init (struct floc *f)
rc = pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
if (rc)
fatal (f, _("pthread_attr_setdetachstate failed: err=%d"), rc);
- rc = pthread_create(&incdep_threads[i], &attr,
+ rc = pthread_create (&incdep_threads[i], &attr,
incdep_worker_pthread, (void *)(size_t)i);
if (rc)
fatal (f, _("pthread_mutex_init failed: err=%d"), rc);
@@ -846,6 +882,12 @@ incdep_flush_recorded_instructions (struct incdep *cur)
struct incdep_variable_def *rec_vd;
struct incdep_recorded_file *rec_f;
+ /* Display saved error. */
+
+ if (cur->err_msg)
+ error(NILF, "%s(%d): %s", cur->name, cur->err_line_no, cur->err_msg);
+
+
/* define_variable_in_set */
rec_vis = cur->recorded_variables_in_set_head;
@@ -1316,39 +1358,19 @@ eval_include_dep_file (struct incdep *curdep, struct floc *f)
variable [:]= value */
else
{
- const char *colonp;
const char *equalp;
-
- /* Look for a colon and an equal sign, optimize for colon.
- Only one file is support and the colon / equal must be on
- the same line. */
- colonp = memchr (cur, ':', file_end - cur);
-#ifdef HAVE_DOS_PATHS
- while ( colonp
- && colonp + 1 < file_end
- && (colonp[1] == '/' || colonp[1] == '\\')
- && colonp > cur
- && isalpha ((unsigned char)colonp[-1])
- && ( colonp == cur + 1
- || strchr (" \t(", colonp[-2]) != 0))
- colonp = memchr (colonp + 1, ':', file_end - (colonp + 1));
-#endif
- endp = NULL;
- if ( !colonp
- || (endp = memchr (cur, '\n', colonp - cur)))
- {
- colonp = NULL;
- equalp = memchr (cur, '=', (endp ? endp : file_end) - cur);
- if ( !equalp
- || (!endp && memchr (cur, '\n', equalp - cur)))
- {
- incdep_warn (curdep, line_no, "no colon.");
- break;
- }
- }
- else
- equalp = memchr (cur, '=', (colonp + 2 <= file_end
- ? colonp + 2 : file_end) - cur);
+ const char *eol;
+
+ /* Look for a colon or and equal sign. In the assignment case, we
+ require it to be on the same line as the variable name to simplify
+ the code. Because of clang, we cannot make the same assumptions
+ with file dependencies. So, start with the equal. */
+
+ assert (*cur != '\n');
+ eol = memchr (cur, '\n', file_end - cur);
+ if (!eol)
+ eol = file_end;
+ equalp = memchr (cur, '=', eol - cur);
if (equalp)
{
/* An assignment of some sort. */
@@ -1485,30 +1507,96 @@ eval_include_dep_file (struct incdep *curdep, struct floc *f)
}
else
{
- /* file: dependencies */
+ /* Expecting: file: dependencies */
const char *filename;
+ const char *fnnext;
+ const char *fnend;
+ const char *colonp;
struct dep *deps = 0;
struct dep **nextdep = &deps;
struct dep *dep;
- /* extract the filename, ASSUME a single one. */
- endp = colonp;
- while (endp > cur && isblank ((unsigned char)endp[-1]))
- --endp;
- if (cur == endp)
+
+ /* Locate the next file colon. If it's not within the bounds of
+ the current line, check that all new line chars are escaped,
+ and simplify them while we're at it. */
+
+ colonp = memchr (cur, ':', file_end - cur);
+#ifdef HAVE_DOS_PATHS
+ while ( colonp
+ && colonp + 1 < file_end
+ && (colonp[1] == '/' || colonp[1] == '\\')
+ && colonp > cur
+ && isalpha ((unsigned char)colonp[-1])
+ && ( colonp == cur + 1
+ || strchr (" \t(", colonp[-2]) != 0))
+ colonp = memchr (colonp + 1, ':', file_end - (colonp + 1));
+#endif
+ if (!colonp)
+ {
+ incdep_warn (curdep, line_no, "no colon.");
+ break;
+ }
+ if ((uintptr_t)colonp >= (uintptr_t)eol)
+ {
+ const char *sol;
+
+ if (memchr (eol, '=', colonp - eol))
+ {
+ incdep_warn (curdep, line_no, "multi line assignment / dependency confusion.");
+ break;
+ }
+
+ sol = cur;
+ do
+ {
+ char *eol2 = (char *)eol - 1;
+ if ((uintptr_t)eol2 >= (uintptr_t)sol && *eol2 == '\r') /* DOS line endings. */
+ eol2--;
+ if ((uintptr_t)eol2 < (uintptr_t)sol || *eol2 != '\\')
+ incdep_warn (curdep, line_no, "no colon.");
+ else if (eol2 != sol && eol2[-1] == '\\')
+ incdep_warn (curdep, line_no, "fancy EOL escape. (includedep)");
+ else
+ {
+ eol2[0] = ' ';
+ eol2[1] = ' ';
+ if (eol2 != eol - 1)
+ eol2[2] = ' ';
+ line_no++;
+
+ sol = eol + 1;
+ eol = memchr (sol, '\n', colonp - sol);
+ continue;
+ }
+ sol = NULL;
+ break;
+ }
+ while (eol != NULL);
+ if (!sol)
+ break;
+ }
+
+ /* Extract the first filename after trimming and basic checks. */
+ fnend = colonp;
+ while ((uintptr_t)fnend > (uintptr_t)cur && isblank ((unsigned char)fnend[-1]))
+ --fnend;
+ if (cur == fnend)
{
incdep_warn (curdep, line_no, "empty filename.");
break;
}
- if ( memchr (cur, '$', endp - cur)
- || memchr (cur, ' ', endp - cur)
- || memchr (cur, '\t', endp - cur))
+ if (memchr (cur, '$', fnend - cur))
{
- incdep_warn (curdep, line_no, "multiple / fancy file name. (includedep)");
+ incdep_warn (curdep, line_no, "fancy file name. (includedep)");
break;
}
- filename = incdep_dep_strcache (curdep, cur, endp - cur);
+
+ fnnext = cur;
+ while (fnnext != fnend && !isblank ((unsigned char)*fnnext))
+ fnnext++;
+ filename = incdep_dep_strcache (curdep, cur, fnnext - cur);
/* parse any dependencies. */
cur = colonp + 1;
@@ -1556,6 +1644,26 @@ eval_include_dep_file (struct incdep *curdep, struct floc *f)
/* enter the file with its dependencies. */
incdep_record_file (curdep, filename, deps, f);
+
+ /* More files? Record them with the same dependency list. */
+ if (fnnext != fnend)
+ for (;;)
+ {
+ const char *filename_prev = filename;
+ const char *fnstart;
+ while (fnnext != fnend && isblank ((unsigned char)*fnnext))
+ fnnext++;
+ if (fnnext == fnend)
+ break;
+
+ fnstart = fnnext;
+ while (fnnext != fnend && !isblank ((unsigned char)*fnnext))
+ fnnext++;
+
+ filename = incdep_dep_strcache (curdep, fnstart, fnnext - fnstart);
+ if (filename != filename_prev) /* clang optimization. */
+ incdep_record_file (curdep, filename, incdep_dup_dep_list (curdep, deps), f);
+ }
}
}
}
diff --git a/src/kmk/kmkbuiltin.h b/src/kmk/kmkbuiltin.h
index 3d1eb44..4d3ef5f 100644
--- a/src/kmk/kmkbuiltin.h
+++ b/src/kmk/kmkbuiltin.h
@@ -1,4 +1,4 @@
-/* $Id: kmkbuiltin.h 2413 2010-09-11 17:43:04Z bird $ */
+/* $Id: kmkbuiltin.h 2736 2014-12-23 21:15:40Z bird $ */
/** @file
* kMk Builtin command handling.
*/
@@ -50,7 +50,11 @@ extern int kmk_builtin_printf(int argc, char **argv, char **envp);
extern int kmk_builtin_rm(int argc, char **argv, char **envp);
extern int kmk_builtin_rmdir(int argc, char **argv, char **envp);
extern int kmk_builtin_sleep(int argc, char **argv, char **envp);
-extern int kmk_builtin_test(int argc, char **argv, char **envp, char ***ppapszArgvSpawn);
+extern int kmk_builtin_test(int argc, char **argv, char **envp
+#ifndef kmk_builtin_test
+ , char ***ppapszArgvSpawn
+#endif
+ );
extern int kmk_builtin_kDepIDB(int argc, char **argv, char **envp);
extern int kmk_builtin_kDepObj(int argc, char **argv, char **envp);
diff --git a/src/kmk/kmkbuiltin/test.c b/src/kmk/kmkbuiltin/test.c
index 9aa1062..69dc2db 100644
--- a/src/kmk/kmkbuiltin/test.c
+++ b/src/kmk/kmkbuiltin/test.c
@@ -201,7 +201,11 @@ extern void *xmalloc(unsigned int sz)
}
#endif
-int kmk_builtin_test(int argc, char **argv, char **envp, char ***ppapszArgvSpawn)
+int kmk_builtin_test(int argc, char **argv, char **envp
+#ifndef kmk_builtin_test
+ , char ***ppapszArgvSpawn
+#endif
+ )
{
int res;
char **argv_spawn;
diff --git a/src/kmk/make.h b/src/kmk/make.h
index 9b5dc98..14c5ceb 100644
--- a/src/kmk/make.h
+++ b/src/kmk/make.h
@@ -213,7 +213,7 @@ extern unsigned long make_stats_ht_collisions;
# ifdef __APPLE__
# include <malloc/malloc.h>
-# define SIZE_OF_HEAP_BLOCK(ptr) malloc_good_size(ptr)
+# define SIZE_OF_HEAP_BLOCK(ptr) malloc_size(ptr)
# elif defined(__linux__) /* glibc */
# include <malloc.h>
diff --git a/src/kmk/misc.c b/src/kmk/misc.c
index 0e285b6..a70a222 100644
--- a/src/kmk/misc.c
+++ b/src/kmk/misc.c
@@ -449,6 +449,14 @@ xcalloc (unsigned int size)
void *result = calloc (size ? size : 1, 1);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
+
+#ifdef CONFIG_WITH_MAKE_STATS
+ make_stats_allocations++;
+ if (make_expensive_statistics)
+ make_stats_allocated += SIZE_OF_HEAP_BLOCK (result);
+ else
+ make_stats_allocated += size;
+#endif
return result;
}
diff --git a/src/kmk/remake.c b/src/kmk/remake.c
index 8855a2f..f42cfa4 100644
--- a/src/kmk/remake.c
+++ b/src/kmk/remake.c
@@ -461,17 +461,31 @@ update_file_1 (struct file *file, unsigned int depth)
struct dep amake;
int running = 0;
#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
- struct file *req_file = file;
- struct file *org_file = file;
+ struct file *org_file;
+ struct file *req_file;
struct file *f2, *f3;
- /* Always work on the primary multi target file. */
+ /* Secondary target expansion leaves renamed files around, skip any rename
+ files to simplify multi target handling. */
- if (file->multi_head != NULL && file->multi_head != file)
+ check_renamed(file);
+
+ /* Remember the request file and find the primary multi target file. Always
+ work on the primary file in a multi target recipe. */
+
+ req_file = file;
+ org_file = file;
+ if (file->multi_head != NULL)
{
- DBS (DB_VERBOSE, (_("Considering target file `%s' -> multi head `%s'.\n"),
- file->name, file->multi_head->name));
- org_file = file = file->multi_head;
+ if (file->multi_head == file)
+ DBS (DB_VERBOSE, (_("Considering target file `%s' (multi head).\n"), file->name));
+ else
+ {
+ org_file = file = file->multi_head;
+ DBS (DB_VERBOSE, (_("Considering target file `%s' -> multi head `%s'.\n"),
+ req_file->name, file->name));
+ assert (file->multi_head == file);
+ }
}
else
#endif /* CONFIG_WITH_EXPLICIT_MULTITARGET */
@@ -537,6 +551,7 @@ update_file_1 (struct file *file, unsigned int depth)
#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
this_mtime = file_mtime (file);
+ check_renamed (file);
f3 = file;
for (f2 = file->multi_next;
f2 != NULL && this_mtime != NONEXISTENT_MTIME;
@@ -560,7 +575,7 @@ update_file_1 (struct file *file, unsigned int depth)
f3 = f2;
break;
}
- check_renamed (file);
+ check_renamed (f3);
noexist = this_mtime == NONEXISTENT_MTIME;
if (noexist)
DBS (DB_BASIC, (_("File `%s' does not exist.\n"), f3->name));
@@ -1025,10 +1040,11 @@ call_must_make_target_var (struct file *file, unsigned int depth)
var->value, var->value_length,
file, NULL);
- /* stripped string should be non-zero. */
- do
- ch = *str++;
- while (isspace (ch));
+ /* Stripped string should be non-zero. */
+
+ ch = *str;
+ while (isspace (ch))
+ ch = *++str;
if (ch != '\0')
{
diff --git a/src/kmk/variable.c b/src/kmk/variable.c
index 7e9f253..247556e 100644
--- a/src/kmk/variable.c
+++ b/src/kmk/variable.c
@@ -1004,9 +1004,7 @@ lookup_variable_in_set (const char *name, unsigned int length,
const struct variable_set *set)
{
struct variable var_key;
-#ifdef KMK
struct variable *v;
-#endif
#ifndef CONFIG_WITH_STRCACHE2
var_key.name = (char *) name;
var_key.length = length;
@@ -1019,7 +1017,7 @@ lookup_variable_in_set (const char *name, unsigned int length,
/* Check for kBuild-define- local variable accesses and handle these first. */
if (length > 3 && name[0] == '[' && set == &global_variable_set)
{
- struct variable *v = lookup_kbuild_object_variable_accessor(name, length);
+ v = lookup_kbuild_object_variable_accessor(name, length);
if (v != VAR_NOT_KBUILD_ACCESSOR)
{
RESOLVE_ALIAS_VARIABLE(v);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-virtualbox/kbuild.git
More information about the Pkg-virtualbox-commits
mailing list