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>
This commit is contained in:
kamil 2018-06-06 15:24:57 +00:00
parent f64d965806
commit 03c04814f0

View File

@ -1263,7 +1263,7 @@ dtrace_strtoll(char *input, int base, size_t limit)
* 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 @@ dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate,
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))