Skip to content

Commit

Permalink
unsubmitted patches for clang compiling (from @joerg)
Browse files Browse the repository at this point in the history
  • Loading branch information
plusun committed May 22, 2018
1 parent 533087b commit 57ce7ee
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 44 deletions.
6 changes: 3 additions & 3 deletions external/gpl2/dtc/dist/srcpos.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ struct srcpos {
if (N) { \
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
(Current).file = YYRHSLOC(Rhs, N).file; \
(Current).last_line = YYRHSLOC(Rhs, N-1).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N-1).last_column; \
(Current).file = YYRHSLOC(Rhs, N-1).file; \
} else { \
(Current).first_line = (Current).last_line = \
YYRHSLOC(Rhs, 0).last_line; \
Expand Down
4 changes: 1 addition & 3 deletions lib/libc/stdlib/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ static void insertionsort(u_char *, size_t, size_t,
*/
/* Assumption: PSIZE is a power of 2. */
#define EVAL(p) ((u_char **)(void *) \
((u_char *)0 + \
(((u_char *)(void *)(p) + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1))))

(((u_char *)(void *)(p) + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
/*
* Arguments are as for qsort.
*/
Expand Down
4 changes: 2 additions & 2 deletions sys/external/bsd/acpica/dist/include/actypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ typedef UINT64 ACPI_INTEGER;

/* Pointer/Integer type conversions */

#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) 0, (ACPI_SIZE) (i))
#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) 0)
#define ACPI_TO_POINTER(i) ((void *)((uintptr_t)(ACPI_SIZE) (i)))
#define ACPI_TO_INTEGER(p) ((uintptr_t)(p))
#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0)
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
Expand Down
10 changes: 2 additions & 8 deletions usr.bin/mkdep/mkdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ static int verbose;
static void save_for_optional(const char *, const char *);
static size_t write_optional(int, opt_t *, size_t);

static inline void *
deconst(const void *p)
{
return (const char *)p - (const char *)0 + (char *)0;
}

__dead static void
usage(void)
{
Expand Down Expand Up @@ -119,8 +113,8 @@ run_cc(int argc, char **argv, const char **fname)
if ((args = malloc((argc + 3) * sizeof(char *))) == NULL)
err(EXIT_FAILURE, "malloc");

args[0] = deconst(CC);
args[1] = deconst("-M");
args[0] = __UNCONST(CC);
args[1] = __UNCONST("-M");
(void)memcpy(&args[2], argv, (argc + 1) * sizeof(char *));

if ((tmpdir = getenv("TMPDIR")) == NULL)
Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/alpha/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ md_post_newfs(void)

if (error != 0)
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/hp300/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ md_post_newfs(void)
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/uboot.lif", pm->diskdev))
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/hppa/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ md_post_newfs(void)
"/usr/sbin/installboot -v /dev/r%sc /usr/mdec/xxboot",
pm->diskdev))
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions usr.sbin/sysinst/arch/i386/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ md_check_partitions(void)
free(bootxx);
if (rval == 0)
return 1;
process_menu(MENU_ok, deconst(MSG_No_Bootcode));
process_menu(MENU_ok, __UNCONST(MSG_No_Bootcode));
return 0;
}

Expand Down Expand Up @@ -362,7 +362,7 @@ md_post_newfs(void)

if (ret != 0)
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/landisk/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ md_post_newfs(void)

if (error != 0)
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/mipsco/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ md_post_newfs(void)
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", pm->diskdev))
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/mvme68k/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ md_post_newfs(void)
"/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa",
target_expand("/.bootsd"), pm->diskdev))
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/pmax/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ md_post_newfs(void)

if (error != 0)
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/arch/x68k/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ md_post_newfs(void)
"/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa",
pm->diskdev))
process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable"));
__UNCONST("Warning: disk is probably not bootable"));
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions usr.sbin/sysinst/bsddisklabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,15 +800,15 @@ check_partitions(void)
} else
rv = -1;
if (rv != 0) {
process_menu(MENU_ok, deconst(MSG_No_Bootcode));
process_menu(MENU_ok, __UNCONST(MSG_No_Bootcode));
return 0;
}
#endif
#ifndef HAVE_UFS2_BOOT
fstype = pm->bsdlabel[pm->rootpart].pi_fstype;
if (fstype == FS_BSDFFS &&
(pm->bsdlabel[pm->rootpart].pi_flags & PIF_FFSv2) != 0) {
process_menu(MENU_ok, deconst(MSG_cannot_ufs2_root));
process_menu(MENU_ok, __UNCONST(MSG_cannot_ufs2_root));
return 0;
}
#endif
Expand Down
6 changes: 0 additions & 6 deletions usr.sbin/sysinst/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@

const char *getfslabelname(uint8_t);

static inline void *
deconst(const void *p)
{
return (char *)0 + ((const char *)p - (const char *)0);
}

#include "msg_defs.h"
#include "menu_defs.h"

Expand Down
6 changes: 3 additions & 3 deletions usr.sbin/sysinst/menus.mi
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ menu pmpartentry, x=50, y=5, exit, default exit;
};
option MSG_fmtasraid, exit, action {
if (pm->gpt || pm->isspecial) {
process_menu(MENU_ok, deconst(MSG_notsupported));
process_menu(MENU_ok, __UNCONST(MSG_notsupported));
return -1;
}
pm->unsaved = 1;
Expand All @@ -673,7 +673,7 @@ menu pmpartentry, x=50, y=5, exit, default exit;
};
option MSG_fmtaslvm, exit, action {
if (pm->gpt || pm->isspecial) {
process_menu(MENU_ok, deconst(MSG_notsupported));
process_menu(MENU_ok, __UNCONST(MSG_notsupported));
return -1;
}
pm->unsaved = 1;
Expand All @@ -683,7 +683,7 @@ menu pmpartentry, x=50, y=5, exit, default exit;
};
option MSG_encrypt, exit, action {
if (pm->gpt || pm->isspecial) {
process_menu(MENU_ok, deconst(MSG_notsupported));
process_menu(MENU_ok, __UNCONST(MSG_notsupported));
return -1;
}
pm->unsaved = 1;
Expand Down
2 changes: 1 addition & 1 deletion usr.sbin/sysinst/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ get_via_ftp(const char *xfer_type)
arg_rv arg;

arg.rv = -1;
arg.arg = deconst(xfer_type);
arg.arg = __UNCONST(xfer_type);
process_menu(MENU_ftpsource, &arg);

if (arg.rv == SET_RETRY)
Expand Down
8 changes: 4 additions & 4 deletions usr.sbin/sysinst/partman.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pm_edit(int menu_entries_count, void (*menu_fmt)(menudesc *, int, void *),
}
if (!ok) {
/* We do not have free device slots */
process_menu(MENU_ok, deconst(MSG_limitcount));
process_menu(MENU_ok, __UNCONST(MSG_limitcount));
return -1;
}
}
Expand Down Expand Up @@ -357,7 +357,7 @@ pm_manage_getfreenode(void *node, const char *d, structinfo_t *s)
return i;
}
}
process_menu(MENU_ok, deconst(MSG_nofreedev));
process_menu(MENU_ok, __UNCONST(MSG_nofreedev));
return -1;
}

Expand Down Expand Up @@ -467,7 +467,7 @@ pm_raid_set_value(menudesc *m, void *arg)
dev_ptr->raid_level = retvalue;
return 0;
case PMR_MENU_NUMROW:
process_menu(MENU_ok, deconst(MSG_raid_nomultidim));
process_menu(MENU_ok, __UNCONST(MSG_raid_nomultidim));
return 0;
#if 0 /* notyet */
msg_to_show = MSG_raid_numrow_ask;
Expand Down Expand Up @@ -1748,7 +1748,7 @@ pm_wedges_fill(pm_devs_t *pm_cur)
if (pm_cur->bsdlabel[i].pi_fstype != FS_UNUSED) {
current = pm_wedge_getfree();
if (current < 0) {
process_menu(MENU_ok, deconst(MSG_limitcount));
process_menu(MENU_ok, __UNCONST(MSG_limitcount));
return;
}
wedges[current].pm = pm_cur;
Expand Down
4 changes: 2 additions & 2 deletions usr.sbin/sysinst/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ ask_yesno(const char* msgtxt)
{
arg_rv p;

p.arg = deconst(msgtxt);
p.arg = __UNCONST(msgtxt);
p.rv = -1;

process_menu(MENU_yesno, &p);
Expand All @@ -1736,7 +1736,7 @@ ask_noyes(const char *msgtxt)
{
arg_rv p;

p.arg = deconst(msgtxt);
p.arg = __UNCONST(msgtxt);
p.rv = -1;

process_menu(MENU_noyes, &p);
Expand Down

0 comments on commit 57ce7ee

Please sign in to comment.