Wed Jun 6 17:47:10 2018 UTC ()
Correct compilation of osnet/dev/systrace/systrace.c under Clang

Mark arguments to dtrace_probe_lookup() with __UNCONST().
The proper fix constifying it causes pollution of const in too many files.

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>


(kamil)
diff -r1.10 -r1.11 src/external/cddl/osnet/dev/systrace/systrace.c

cvs diff -r1.10 -r1.11 src/external/cddl/osnet/dev/systrace/systrace.c (expand / switch to unified diff)

--- src/external/cddl/osnet/dev/systrace/systrace.c 2018/05/28 21:05:04 1.10
+++ src/external/cddl/osnet/dev/systrace/systrace.c 2018/06/06 17:47:10 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: systrace.c,v 1.10 2018/05/28 21:05:04 chs Exp $ */ 1/* $NetBSD: systrace.c,v 1.11 2018/06/06 17:47:10 kamil Exp $ */
2 2
3/* 3/*
4 * CDDL HEADER START 4 * CDDL HEADER START
5 * 5 *
6 * The contents of this file are subject to the terms of the 6 * The contents of this file are subject to the terms of the
7 * Common Development and Distribution License (the "License"). 7 * Common Development and Distribution License (the "License").
8 * You may not use this file except in compliance with the License. 8 * You may not use this file except in compliance with the License.
9 * 9 *
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 * or http://www.opensolaris.org/os/licensing. 11 * or http://www.opensolaris.org/os/licensing.
12 * See the License for the specific language governing permissions 12 * See the License for the specific language governing permissions
13 * and limitations under the License. 13 * and limitations under the License.
14 * 14 *
@@ -346,27 +346,27 @@ systrace_provide(void *arg, dtrace_probe @@ -346,27 +346,27 @@ systrace_provide(void *arg, dtrace_probe
346 continue; 346 continue;
347 347
348 (void)dtrace_probe_create(systrace_id, MODNAME, 348 (void)dtrace_probe_create(systrace_id, MODNAME,
349 uglyhack.pp_syscallnames[i], "entry", 349 uglyhack.pp_syscallnames[i], "entry",
350 SYSTRACE_ARTIFICIAL_FRAMES, 350 SYSTRACE_ARTIFICIAL_FRAMES,
351 (void *)((uintptr_t)SYSTRACE_ENTRY(i))); 351 (void *)((uintptr_t)SYSTRACE_ENTRY(i)));
352 (void)dtrace_probe_create(systrace_id, MODNAME, 352 (void)dtrace_probe_create(systrace_id, MODNAME,
353 uglyhack.pp_syscallnames[i], "return", 353 uglyhack.pp_syscallnames[i], "return",
354 SYSTRACE_ARTIFICIAL_FRAMES, 354 SYSTRACE_ARTIFICIAL_FRAMES,
355 (void *)((uintptr_t)SYSTRACE_RETURN(i))); 355 (void *)((uintptr_t)SYSTRACE_RETURN(i)));
356#else 356#else
357 const char *name = ALTSYSCALLNAMES[i] ? ALTSYSCALLNAMES[i] : 357 const char *name = ALTSYSCALLNAMES[i] ? ALTSYSCALLNAMES[i] :
358 SYSCALLNAMES[i]; 358 SYSCALLNAMES[i];
359 if (dtrace_probe_lookup(systrace_id, NULL, name, "entry") != 0) 359 if (dtrace_probe_lookup(systrace_id, NULL, __UNCONST(name), __UNCONST("entry")) != 0)
360 continue; 360 continue;
361 361
362 (void) dtrace_probe_create(systrace_id, NULL, 362 (void) dtrace_probe_create(systrace_id, NULL,
363 name, "entry", SYSTRACE_ARTIFICIAL_FRAMES, 363 name, "entry", SYSTRACE_ARTIFICIAL_FRAMES,
364 (void *)(intptr_t)SYSTRACE_ENTRY(i)); 364 (void *)(intptr_t)SYSTRACE_ENTRY(i));
365 (void) dtrace_probe_create(systrace_id, NULL, 365 (void) dtrace_probe_create(systrace_id, NULL,
366 name, "return", SYSTRACE_ARTIFICIAL_FRAMES, 366 name, "return", SYSTRACE_ARTIFICIAL_FRAMES,
367 (void *)(intptr_t)SYSTRACE_RETURN(i)); 367 (void *)(intptr_t)SYSTRACE_RETURN(i));
368#endif 368#endif
369 } 369 }
370} 370}
371 371
372static void 372static void