Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/uts/common/dtrace Correct compilati...



details:   https://anonhg.NetBSD.org/src/rev/9f0d76e93b9f
branches:  trunk
changeset: 323268:9f0d76e93b9f
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Jun 06 15:24:57 2018 +0000

description:
Correct compilation of osnet/dist/uts/common/dtrace/dtrace.c under Clang

Add missing const keywords in dtrace_strncmp().

Initialize lim1 and lim2 to zero always. This prevents a false positive
about potentially unset but used variable.

This could be done with -W flags, but they are incompatible between
compilers.

This is a step forward functional MKLLVM=yes HAVE_LLVM=yes build.

Sponsored by <The NetBSD Foundation>

diffstat:

 external/cddl/osnet/dist/uts/common/dtrace/dtrace.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 8866bfec1439 -r 9f0d76e93b9f external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
--- a/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c       Wed Jun 06 15:15:41 2018 +0000
+++ b/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c       Wed Jun 06 15:24:57 2018 +0000
@@ -1263,7 +1263,7 @@
  * Compare two strings using safe loads.
  */
 static int
-dtrace_strncmp(char *s1, char *s2, size_t limit)
+dtrace_strncmp(const char *s1, const char *s2, size_t limit)
 {
        uint8_t c1, c2;
        volatile uint16_t *flags;
@@ -6592,7 +6592,7 @@
                        size_t sz = state->dts_options[DTRACEOPT_STRSIZE];
                        uintptr_t s1 = regs[r1];
                        uintptr_t s2 = regs[r2];
-                       size_t lim1, lim2;
+                       size_t lim1 = 0, lim2 = 0;
 
                        if (s1 != 0 &&
                            !dtrace_strcanload(s1, sz, &lim1, mstate, vstate))



Home | Main Index | Thread Index | Old Index