Wed Jun 6 17:19:49 2018 UTC ()
Correct compilation of osnet/dev/profile/profile.c under Clang

Constify char* types when initialized with liternals.

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.8 -r1.9 src/external/cddl/osnet/dev/profile/profile.c

cvs diff -r1.8 -r1.9 src/external/cddl/osnet/dev/profile/profile.c (expand / switch to unified diff)

--- src/external/cddl/osnet/dev/profile/profile.c 2018/05/28 21:05:03 1.8
+++ src/external/cddl/osnet/dev/profile/profile.c 2018/06/06 17:19:49 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: profile.c,v 1.8 2018/05/28 21:05:03 chs Exp $ */ 1/* $NetBSD: profile.c,v 1.9 2018/06/06 17:19:49 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 *
@@ -424,36 +424,36 @@ profile_create(hrtime_t interval, char * @@ -424,36 +424,36 @@ profile_create(hrtime_t interval, char *
424 NULL, NULL, name, 424 NULL, NULL, name,
425 profile_aframes, prof); 425 profile_aframes, prof);
426} 426}
427 427
428/*ARGSUSED*/ 428/*ARGSUSED*/
429static void 429static void
430profile_provide(void *arg, dtrace_probedesc_t *desc) 430profile_provide(void *arg, dtrace_probedesc_t *desc)
431{ 431{
432 int i, j, rate, kind; 432 int i, j, rate, kind;
433 hrtime_t val = 0, mult = 1, len = 0; 433 hrtime_t val = 0, mult = 1, len = 0;
434 char *name, *suffix = NULL; 434 char *name, *suffix = NULL;
435 435
436 const struct { 436 const struct {
437 char *prefix; 437 const char *prefix;
438 int kind; 438 int kind;
439 } types[] = { 439 } types[] = {
440 { PROF_PREFIX_PROFILE, PROF_PROFILE }, 440 { PROF_PREFIX_PROFILE, PROF_PROFILE },
441 { PROF_PREFIX_TICK, PROF_TICK }, 441 { PROF_PREFIX_TICK, PROF_TICK },
442 { 0, 0 } 442 { 0, 0 }
443 }; 443 };
444 444
445 const struct { 445 const struct {
446 char *name; 446 const char *name;
447 hrtime_t mult; 447 hrtime_t mult;
448 } suffixes[] = { 448 } suffixes[] = {
449 { "ns", NANOSEC / NANOSEC }, 449 { "ns", NANOSEC / NANOSEC },
450 { "nsec", NANOSEC / NANOSEC }, 450 { "nsec", NANOSEC / NANOSEC },
451 { "us", NANOSEC / MICROSEC }, 451 { "us", NANOSEC / MICROSEC },
452 { "usec", NANOSEC / MICROSEC }, 452 { "usec", NANOSEC / MICROSEC },
453 { "ms", NANOSEC / MILLISEC }, 453 { "ms", NANOSEC / MILLISEC },
454 { "msec", NANOSEC / MILLISEC }, 454 { "msec", NANOSEC / MILLISEC },
455 { "s", NANOSEC / SEC }, 455 { "s", NANOSEC / SEC },
456 { "sec", NANOSEC / SEC }, 456 { "sec", NANOSEC / SEC },
457 { "m", NANOSEC * (hrtime_t)60 }, 457 { "m", NANOSEC * (hrtime_t)60 },
458 { "min", NANOSEC * (hrtime_t)60 }, 458 { "min", NANOSEC * (hrtime_t)60 },
459 { "h", NANOSEC * (hrtime_t)(60 * 60) }, 459 { "h", NANOSEC * (hrtime_t)(60 * 60) },