Index: usr.bin/top/Makefile =================================================================== --- usr.bin/top/Makefile +++ usr.bin/top/Makefile @@ -13,12 +13,11 @@ .if ${COMPILER_TYPE} == "gcc" .if ${COMPILER_VERSION} >= 50000 CFLAGS.gcc=-Wno-error=cast-align -Wno-error=cast-qual -Wno-error=discarded-qualifiers -Wno-error=incompatible-pointer-types \ - -Wno-error=maybe-uninitialized + -Wno-error=maybe-uninitialized -Wno-format-truncation .else #base gcc NO_WERROR= .endif .endif -CFLAGS.clang=-Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-error=cast-qual -Wno-error=cast-align LIBADD= ncursesw m kvm jail Index: usr.bin/top/display.c =================================================================== --- usr.bin/top/display.c +++ usr.bin/top/display.c @@ -228,7 +228,7 @@ /* calculate starting columns where needed */ cpustate_total_length = 0; - pp = cpustate_names; + pp = __DECONST(char **, cpustate_names); ip = cpustate_columns; while (*pp != NULL) { @@ -471,7 +471,7 @@ int cpu; for (cpu = 0; cpu < num_cpus; cpu++) { - names = cpustate_names; + names = __DECONST(char **, cpustate_names); Move_to(cpustates_column, y_cpustates + cpu); lastline = y_cpustates + cpu; @@ -514,13 +514,13 @@ z_cpustates(void) { int i = 0; - char **names; + char * const *names; char *thisname; int *lp; int cpu, value; for (cpu = 0; cpu < num_cpus; cpu++) { - names = cpustate_names; + names = __DECONST(char **, cpustate_names); /* show tag and bump lastline */ if (num_cpus == 1) @@ -761,7 +761,7 @@ void i_header(const char *text) { - char *s; + const char *s; s = trim_header(text); if (s != NULL) @@ -777,7 +777,7 @@ { header_status = OFF; } - free(s); + free(__DECONST(char*, s)); } void Index: usr.bin/top/machine.c =================================================================== --- usr.bin/top/machine.c +++ usr.bin/top/machine.c @@ -16,6 +16,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -663,7 +664,7 @@ static struct kinfo_proc dummy; long ret; - oldp = get_old_proc(pp); + oldp = get_old_proc(__DECONST(struct kinfo_proc*, pp)); if (oldp == NULL) { memset(&dummy, 0, sizeof(dummy)); oldp = &dummy; Index: usr.bin/top/top.c =================================================================== --- usr.bin/top/top.c +++ usr.bin/top/top.c @@ -301,7 +301,8 @@ /* get preset options from the environment */ if ((env_top = getenv("TOP")) != NULL) { - av = preset_argv = argparse(env_top, &preset_argc); + preset_argv = __DECONST(const char**, argparse(env_top, &preset_argc)); + av = __DECONST(char**, preset_argv); ac = preset_argc; /* set the dummy argument to an explanatory message, in case @@ -523,7 +524,7 @@ { if ((order_index = string_index(order_name, statics.order_names)) == -1) { - char **pp; + const char * const *pp; fprintf(stderr, "%s: '%s' is not a recognized sorting order.\n", myname, order_name);