Index: trunk/src/kDepPre/kDepPre.c
===================================================================
--- trunk/src/kDepPre/kDepPre.c	(revision 3064)
+++ trunk/src/kDepPre/kDepPre.c	(revision 3065)
@@ -294,12 +294,12 @@
                 case 'l':
                 {
-                    const char *psz = &argv[i][2];
-                    if (*psz == '=')
-                        psz++;
-                    if (!strcmp(psz, "c"))
+                    const char *pszValue = &argv[i][2];
+                    if (*pszValue == '=')
+                        pszValue++;
+                    if (!strcmp(pszValue, "c"))
                         ;
                     else
                     {
-                        fprintf(stderr, "%s: error: The '%s' language is not supported.\n", argv[0], psz);
+                        fprintf(stderr, "%s: error: The '%s' language is not supported.\n", argv[0], pszValue);
                         return 1;
                     }
Index: trunk/src/kObjCache/kObjCache.c
===================================================================
--- trunk/src/kObjCache/kObjCache.c	(revision 3064)
+++ trunk/src/kObjCache/kObjCache.c	(revision 3065)
@@ -70,4 +70,7 @@
 #  define O_BINARY 0
 # endif
+# ifndef __sun__
+#  include <sys/file.h> /* flock */
+# endif
 #endif
 #if defined(__WIN__)
@@ -1071,4 +1074,8 @@
                 }
             }
+
+            case kOCDepState_Invalid:
+                assert(0);
+                break;
         }
 
@@ -2355,8 +2362,8 @@
                 {
                     char *pszNext;
-                    unsigned i = strtoul(&g_szLine[sizeof("cc-argv-#") - 1], &pszNext, 0);
-                    if ((fBad = i >= pEntry->Old.cArgvCompile || pEntry->Old.papszArgvCompile[i] || (pszNext && *pszNext)))
+                    unsigned iArg = strtoul(&g_szLine[sizeof("cc-argv-#") - 1], &pszNext, 0);
+                    if ((fBad = iArg >= pEntry->Old.cArgvCompile || pEntry->Old.papszArgvCompile[iArg] || (pszNext && *pszNext)))
                         break;
-                    pEntry->Old.papszArgvCompile[i] = xstrdup(pszVal);
+                    pEntry->Old.papszArgvCompile[iArg] = xstrdup(pszVal);
                 }
                 else if (!strcmp(g_szLine, "cc-argv-sum"))
@@ -2491,11 +2498,11 @@
 
     fprintf(pFile, "magic=kObjCacheEntry-v0.1.1\n");
-    CHECK_LEN(fprintf(pFile, "target=%s\n", pEntry->New.pszTarget ? pEntry->New.pszTarget : pEntry->Old.pszTarget));
-    CHECK_LEN(fprintf(pFile, "key=%lu\n", (unsigned long)pEntry->uKey));
+    CHECK_LEN(fprintf(pFile, "target=%s\n",     pEntry->New.pszTarget ? pEntry->New.pszTarget : pEntry->Old.pszTarget));
+    CHECK_LEN(fprintf(pFile, "key=%lu\n",       (unsigned long)pEntry->uKey));
     CHECK_LEN(fprintf(pFile, "obj=%s\n",        pEntry->New.pszObjName ? pEntry->New.pszObjName : pEntry->Old.pszObjName));
     CHECK_LEN(fprintf(pFile, "cpp=%s\n",        pEntry->New.pszCppName ? pEntry->New.pszCppName : pEntry->Old.pszCppName));
-    CHECK_LEN(fprintf(pFile, "cpp-size=%lu\n",  pEntry->New.pszCppName ? pEntry->New.cbCpp      : pEntry->Old.cbCpp));
-    CHECK_LEN(fprintf(pFile, "cpp-ms=%lu\n",    pEntry->New.pszCppName ? pEntry->New.cMsCpp     : pEntry->Old.cMsCpp));
-    CHECK_LEN(fprintf(pFile, "cc-ms=%lu\n",     pEntry->New.pszCppName ? pEntry->New.cMsCompile : pEntry->Old.cMsCompile));
+    CHECK_LEN(fprintf(pFile, "cpp-size=%lu\n",  (unsigned long)(pEntry->New.pszCppName ? pEntry->New.cbCpp      : pEntry->Old.cbCpp)));
+    CHECK_LEN(fprintf(pFile, "cpp-ms=%lu\n",    (unsigned long)(pEntry->New.pszCppName ? pEntry->New.cMsCpp     : pEntry->Old.cMsCpp)));
+    CHECK_LEN(fprintf(pFile, "cc-ms=%lu\n",     (unsigned long)(pEntry->New.pszCppName ? pEntry->New.cMsCompile : pEntry->Old.cMsCompile)));
 
     if (!kOCSumIsEmpty(&pEntry->New.SumCompArgv))
Index: trunk/src/kash/eval.c
===================================================================
--- trunk/src/kash/eval.c	(revision 3064)
+++ trunk/src/kash/eval.c	(revision 3065)
@@ -679,5 +679,5 @@
 	int numvars;
 	struct strlist *sp;
-	int mode;
+	int mode = 0;
 	int pip[2];
 	struct cmdentry cmdentry;
@@ -693,9 +693,11 @@
 	volatile int temp_path;
 #if __GNUC__
-	/* Avoid longjmp clobbering */
+	/* Try avoid longjmp clobbering */
 	(void) &argv;
 	(void) &argc;
 	(void) &lastarg;
 	(void) &flags;
+	(void) &path;
+	(void) &mode;
 #endif
 
Index: trunk/src/kash/input.c
===================================================================
--- trunk/src/kash/input.c	(revision 3064)
+++ trunk/src/kash/input.c	(revision 3065)
@@ -281,5 +281,7 @@
 	char *p, *q;
 	int more;
+#ifndef SMALL
 	int something;
+#endif
 	char savec;
 
@@ -305,5 +307,7 @@
 
 	/* delete nul characters */
+#ifndef SMALL
 	something = 0;
+#endif
 	for (more = 1; more;) {
 		switch (*p) {
@@ -322,5 +326,7 @@
 
 		default:
+#ifndef SMALL
 			something = 1;
+#endif
 			break;
 		}
Index: trunk/src/kash/mystring.h
===================================================================
--- trunk/src/kash/mystring.h	(revision 3064)
+++ trunk/src/kash/mystring.h	(revision 3065)
@@ -45,5 +45,5 @@
 int number(struct shinstance *, const char *);
 int is_number(const char *);
-#ifdef _MSC_VER
+#if !defined(RT_OS_FREEBSD) && !defined(RT_OS_NETBSD) && !defined(RT_OS_OPENBSD) && !defined(RT_OS_OS2)
 size_t strlcpy(char *dst, const char *src, size_t siz);
 #endif
Index: trunk/src/kash/parser.c
===================================================================
--- trunk/src/kash/parser.c	(revision 3064)
+++ trunk/src/kash/parser.c	(revision 3065)
@@ -914,5 +914,5 @@
 	char line[EOFMARKLEN + 1];
 	struct nodelist *bqlist;
-	int quotef;
+	int quotef = 0;
 	int *dblquotep = NULL;
 	size_t maxnest = 32;
@@ -923,6 +923,18 @@
 	int oldstyle;
 	char const *prevsyntax;	/* syntax before arithmetic */
+
+	psh->startlinno = psh->plinno;
+	dblquote = 0;
+	varnest = 0;
+	if (syntax == DQSYNTAX) {
+		SETDBLQUOTE();
+	}
+	quotef = 0;
+	bqlist = NULL;
+	arinest = 0;
+	parenlevel = 0;
+
 #if __GNUC__
-	/* Avoid longjmp clobbering */
+	/* Try avoid longjmp clobbering */
 	(void) &maxnest;
 	(void) &dblquotep;
@@ -937,15 +949,4 @@
 	(void) &syntax;
 #endif
-
-	psh->startlinno = psh->plinno;
-	dblquote = 0;
-	varnest = 0;
-	if (syntax == DQSYNTAX) {
-		SETDBLQUOTE();
-	}
-	quotef = 0;
-	bqlist = NULL;
-	arinest = 0;
-	parenlevel = 0;
 
 	STARTSTACKSTR(psh, out);
Index: trunk/src/kmk/dir.c
===================================================================
--- trunk/src/kmk/dir.c	(revision 3064)
+++ trunk/src/kmk/dir.c	(revision 3065)
@@ -715,5 +715,5 @@
                             const char *filename)
 {
-  unsigned int hash;
+  /*unsigned int hash;*/
   struct dirfile *df;
   struct dirent *d;
@@ -749,5 +749,5 @@
 #endif
 
-  hash = 0;
+  /*hash = 0;*/
   if (filename != 0)
     {
Index: trunk/src/kmk/expreval.c
===================================================================
--- trunk/src/kmk/expreval.c	(revision 3064)
+++ trunk/src/kmk/expreval.c	(revision 3065)
@@ -1397,5 +1397,5 @@
 
     expr_pop_and_delete_var(pThis);
-    return kExprRet_Ok;
+    return rc;
 }
 
Index: trunk/src/kmk/job.c
===================================================================
--- trunk/src/kmk/job.c	(revision 3064)
+++ trunk/src/kmk/job.c	(revision 3065)
@@ -2716,5 +2716,7 @@
   char *p;
   char *ap;
+#ifndef NDEBUG
   char *end;
+#endif
   int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
   char **new_argv = 0;
@@ -2850,5 +2852,7 @@
   /* All the args can fit in a buffer as big as LINE is.   */
   ap = new_argv[0] = argstr = xmalloc (i);
+#ifndef NDEBUG
   end = ap + i;
+#endif
 
   /* I is how many complete arguments have been found.  */
@@ -3160,5 +3164,7 @@
     unsigned int line_len = strlen (line);
     unsigned int sflags_len = strlen (shellflags);
+# ifdef WINDOWS32
     char *command_ptr = NULL; /* used for batch_mode_shell mode */
+# endif
     char *new_line;
 
@@ -3241,5 +3247,7 @@
     ap += sflags_len;
     *(ap++) = ' ';
+#ifdef WINDOWS32
     command_ptr = ap;
+#endif
     for (p = line; *p != '\0'; ++p)
       {
Index: trunk/src/kmk/kbuild-object.c
===================================================================
--- trunk/src/kmk/kbuild-object.c	(revision 3064)
+++ trunk/src/kmk/kbuild-object.c	(revision 3065)
@@ -277,4 +277,5 @@
 
 
+#if 0 /* unused */
 /**
  * Helper function for caching variable name strings.
@@ -293,4 +294,5 @@
     return pszRet;
 }
+#endif
 
 static struct kbuild_object *
@@ -559,5 +561,5 @@
         assert(pObj != NULL);
         if (!is_valid_kbuild_object_variable_name(pchVarNm, cchVarNm))
-            fatal(pFileLoc, _("Invalid kBuild object variable name: '%.*s' ('%s')"),
+            fatal(pFileLoc, _("Invalid kBuild object variable name: '%.*s' ('%.*s')"),
                   (int)cchVarNm, pchVarNm, (int)cchName, pchName);
         return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchVarNm, cchVarNm),
@@ -1322,6 +1324,6 @@
 lookup_kbuild_object_variable_accessor(const char *pchName, size_t cchName)
 {
-    const char * const     pchOrgName = pchName;
-    size_t       const     cchOrgName = cchName;
+    /*const char * const     pchOrgName = pchName;*/
+    /*size_t       const     cchOrgName = cchName;*/
     const char *           pchVarNm;
     size_t                 cchVarNm;
Index: trunk/src/kmk/kbuild.c
===================================================================
--- trunk/src/kmk/kbuild.c	(revision 3064)
+++ trunk/src/kmk/kbuild.c	(revision 3065)
@@ -48,4 +48,5 @@
 
 #include "kbuild.h"
+#include "k/kDefs.h"
 
 #include <assert.h>
@@ -2001,5 +2002,8 @@
     struct variable *pOutBase   = kbuild_get_object_base(pTarget, pSource, "outbase");
     struct variable *pObjSuff   = kbuild_get_object_suffix(pTarget, pSource, pTool, pType, pBldTrg, pBldTrgArch, "objsuff");
-    struct variable *pDefs, *pIncs, *pFlags, *pDeps, *pOrderDeps, *pDirDep, *pDep, *pVar, *pOutput, *pOutputMaybe;
+    struct variable *pDeps, *pOrderDeps, *pDirDep, *pDep, *pVar, *pOutput, *pOutputMaybe;
+#if 0 /** @todo figure out why this isn't used */
+    struct variable *pDefs, *pIncs, *pFlags;
+#endif
     struct variable *pObj       = kbuild_set_object_name_and_dep_and_dirdep_and_PATH_target_source(pTarget, pSource, pOutBase, pObjSuff, "obj", &pDep, &pDirDep);
     int fInstallOldVars = 0;
@@ -2054,4 +2058,5 @@
 
 
+#if 0 /** @todo figure out why this isn't used */
     pDefs      = kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, NULL,
                                             ST("DEFS"),  ST("defs"), 1/* left-to-right */);
@@ -2060,4 +2065,5 @@
     pFlags     = kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, NULL,
                                             ST("FLAGS"), ST("flags"), 1/* left-to-right */);
+#endif
     pDeps      = kbuild_collect_source_prop(pTarget, pSource, pTool, &Sdks, pType, pBldType, pBldTrg, pBldTrgArch, pBldTrgCpu, pDefPath,
                                             ST("DEPS"),  ST("deps"), 1/* left-to-right */);
Index: trunk/src/kmk/kmkbuiltin/echo.c
===================================================================
--- trunk/src/kmk/kmkbuiltin/echo.c	(revision 3064)
+++ trunk/src/kmk/kmkbuiltin/echo.c	(revision 3065)
@@ -73,18 +73,20 @@
 {
 	char *errstr = strerror(errno);
+	ssize_t cchIgn = 0; /* this is to shut up irrelevant warnings on linux. */
 #ifdef _MSC_VER
 	int doserrno = _doserrno;
-       char szDosErr[48];
-       sprintf(szDosErr, " (doserrno=%d)", doserrno);
+	char szDosErr[48];
+	sprintf(szDosErr, " (doserrno=%d)", doserrno);
 #endif
-	write(STDERR_FILENO, prog, strlen(prog));
-	write(STDERR_FILENO, ": ", 2);
-	write(STDERR_FILENO, reason, strlen(reason));
-	write(STDERR_FILENO, ": ", 2);
-	write(STDERR_FILENO, errstr, strlen(errstr));
+	cchIgn += write(STDERR_FILENO, prog, strlen(prog));
+	cchIgn += write(STDERR_FILENO, ": ", 2);
+	cchIgn += write(STDERR_FILENO, reason, strlen(reason));
+	cchIgn += write(STDERR_FILENO, ": ", 2);
+	cchIgn += write(STDERR_FILENO, errstr, strlen(errstr));
 #ifdef _MSC_VER
-	write(STDERR_FILENO, szDosErr, strlen(szDosErr));
+	cchIgn += write(STDERR_FILENO, szDosErr, strlen(szDosErr));
 #endif
-	write(STDERR_FILENO, "\n", 1);
+	cchIgn += write(STDERR_FILENO, "\n", 1);
+	(void)cchIgn;
 }
 
Index: trunk/src/kmk/kmkbuiltin/err.c
===================================================================
--- trunk/src/kmk/kmkbuiltin/err.c	(revision 3064)
+++ trunk/src/kmk/kmkbuiltin/err.c	(revision 3065)
@@ -55,5 +55,5 @@
     char szMsg[4096];
     int cchMsg = snprintf(szMsg, sizeof(szMsg), "%s: ", g_progname);
-    if (cchMsg < sizeof(szMsg) - 1 && cchMsg > 0)
+    if (cchMsg < (int)sizeof(szMsg) - 1 && cchMsg > 0)
     {
         int cchMsg2;
@@ -62,9 +62,9 @@
         va_end(args);
 
-        if (   cchMsg < sizeof(szMsg) - 1
+        if (   cchMsg < (int)sizeof(szMsg) - 1
             && cchMsg2 >= 0)
         {
             cchMsg += cchMsg2 = snprintf(&szMsg[cchMsg], sizeof(szMsg) - cchMsg, ": %s\n", strerror(error));
-            if (   cchMsg < sizeof(szMsg) - 1
+            if (   cchMsg < (int)sizeof(szMsg) - 1
                 && cchMsg2 >= 0)
             {
@@ -96,5 +96,5 @@
     char szMsg[4096];
     int cchMsg = snprintf(szMsg, sizeof(szMsg), "%s: ", g_progname);
-    if (cchMsg < sizeof(szMsg) - 1 && cchMsg > 0)
+    if (cchMsg < (int)sizeof(szMsg) - 1 && cchMsg > 0)
     {
         int cchMsg2;
@@ -103,5 +103,5 @@
         va_end(args);
 
-        if (   cchMsg < sizeof(szMsg) - 1
+        if (   cchMsg < (int)sizeof(szMsg) - 1
             && cchMsg2 >= 0)
         {
@@ -132,5 +132,5 @@
     char szMsg[4096];
     int cchMsg = snprintf(szMsg, sizeof(szMsg), "%s: ", g_progname);
-    if (cchMsg < sizeof(szMsg) - 1 && cchMsg > 0)
+    if (cchMsg < (int)sizeof(szMsg) - 1 && cchMsg > 0)
     {
         int cchMsg2;
@@ -139,9 +139,9 @@
         va_end(args);
 
-        if (   cchMsg < sizeof(szMsg) - 1
+        if (   cchMsg < (int)sizeof(szMsg) - 1
             && cchMsg2 >= 0)
         {
             cchMsg += cchMsg2 = snprintf(&szMsg[cchMsg], sizeof(szMsg) - cchMsg, ": %s\n", strerror(error));
-            if (   cchMsg < sizeof(szMsg) - 1
+            if (   cchMsg < (int)sizeof(szMsg) - 1
                 && cchMsg2 >= 0)
             {
@@ -169,5 +169,5 @@
     char szMsg[4096];
     int cchMsg = snprintf(szMsg, sizeof(szMsg), "%s: ", g_progname);
-    if (cchMsg < sizeof(szMsg) - 1 && cchMsg > 0)
+    if (cchMsg < (int)sizeof(szMsg) - 1 && cchMsg > 0)
     {
         int cchMsg2;
@@ -176,5 +176,5 @@
         va_end(args);
 
-        if (   cchMsg < sizeof(szMsg) - 1
+        if (   cchMsg < (int)sizeof(szMsg) - 1
             && cchMsg2 >= 0)
         {
Index: trunk/src/kmk/kmkbuiltin/test.c
===================================================================
--- trunk/src/kmk/kmkbuiltin/test.c	(revision 3064)
+++ trunk/src/kmk/kmkbuiltin/test.c	(revision 3065)
@@ -278,5 +278,5 @@
 #else /* in kmk */
 			/* let job.c spawn the process, make a job.c style argv_spawn copy. */
-			char *buf, *cur, **argv_new;
+			char *cur, **argv_new;
 			size_t sz = 0;
 			int argc_new = 0;
@@ -288,5 +288,5 @@
 
 			argv_new = xmalloc((argc_new + 1) * sizeof(char *));
-			buf = cur = xmalloc(sz);
+			cur = xmalloc(sz);
 			for (i = 0; i < argc_new; i++) {
 				size_t len = strlen(argv_spawn[i]) + 1;
Index: trunk/src/kmk/misc.c
===================================================================
--- trunk/src/kmk/misc.c	(revision 3064)
+++ trunk/src/kmk/misc.c	(revision 3065)
@@ -438,5 +438,5 @@
   cchMsg += cchUser = vsnprintf (&szMsg[cchMsg], sizeof(szMsg) - cchMsg, fmt, args);
   VA_END (args);
-  if (   cchMsg + cchStop <= sizeof(szMsg)
+  if (   cchMsg + cchStop <= (int)sizeof(szMsg)
       && cchUser >= 0)
     {
Index: trunk/src/lib/maybe_con_write.c
===================================================================
--- trunk/src/lib/maybe_con_write.c	(revision 3064)
+++ trunk/src/lib/maybe_con_write.c	(revision 3065)
@@ -98,5 +98,5 @@
      */
     cbWritten = write(fd, pvBuf, (to_write_t)cbToWrite);
-    if (cbWritten == cbToWrite)
+    if (cbWritten == (ssize_t)cbToWrite)
     { /* likely */ }
     else if (cbWritten >= 0 || errno == EINTR)
