aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jim-exec.c8
-rw-r--r--jim.c7
-rw-r--r--linenoise.c4
3 files changed, 17 insertions, 2 deletions
diff --git a/jim-exec.c b/jim-exec.c
index 475cc5b..84dcd3b 100644
--- a/jim-exec.c
+++ b/jim-exec.c
@@ -35,6 +35,12 @@
extern char **environ;
+#if defined(__GNUC__) && !defined(__clang__)
+#define IGNORE_RC(EXPR) ((EXPR) < 0 ? -1 : 0)
+#else
+#define IGNORE_RC(EXPR) EXPR
+#endif
+
/* These two could be moved into the Tcl core */
static void Jim_SetResultErrno(Jim_Interp *interp, const char *msg)
{
@@ -899,7 +905,7 @@ badargs:
execvp(execName, &arg_array[firstArg]);
/* we really can ignore the error here! */
- write(2, execerr, execerrlen) < 0 ? -1 : 0;
+ IGNORE_RC(write(2, execerr, execerrlen));
_exit(127);
}
diff --git a/jim.c b/jim.c
index 58fcb84..b3eed2f 100644
--- a/jim.c
+++ b/jim.c
@@ -7047,13 +7047,18 @@ static int JimExprOpIntBin(Jim_Interp *interp, struct JimExprState *e)
unsigned long uA = (unsigned long)wA;
const unsigned int S = sizeof(unsigned long) * 8;
- wC = (unsigned long)((uA << wB) | (uA >> (S - wB)));
+ /* Shift left by the word size or more is undefined. */
+ wB %= S;
+
+ wC = (unsigned long)(uA << wB) | (uA >> (S - wB));
break;
}
case JIM_EXPROP_ROTR:{
unsigned long uA = (unsigned long)wA;
const unsigned int S = sizeof(unsigned long) * 8;
+ wB %= S;
+
wC = (unsigned long)((uA >> wB) | (uA << (S - wB)));
break;
}
diff --git a/linenoise.c b/linenoise.c
index 17000fa..2d1002d 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -211,7 +211,11 @@ struct current {
};
/* gcc/glibc insists that we care about the return code of write! */
+#if defined(__GNUC__) && !defined(__clang__)
#define IGNORE_RC(EXPR) ((EXPR) < 0 ? -1 : 0)
+#else
+#define IGNORE_RC(EXPR) EXPR
+#endif
/* This is fd_printf() on some systems, but use a different
* name to avoid conflicts