summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenl <benl@FreeBSD.org>2011-06-18 13:56:33 +0000
committerbenl <benl@FreeBSD.org>2011-06-18 13:56:33 +0000
commit2071e3510abcb0d23655e9ec6f21ded8a0d7fa8a (patch)
tree6edd0c06e1319e9f8e2572723af2f2d72fabda97
parenta90ed93de49d2b89aafba19680f2fd1d400eb91e (diff)
downloadFreeBSD-src-2071e3510abcb0d23655e9ec6f21ded8a0d7fa8a.zip
FreeBSD-src-2071e3510abcb0d23655e9ec6f21ded8a0d7fa8a.tar.gz
Fix clang warnings.
Approved by: philip (mentor)
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c16
-rw-r--r--contrib/binutils/bfd/coffcode.h2
-rw-r--r--contrib/binutils/bfd/opncls.c2
-rw-r--r--contrib/binutils/bfd/peicode.h2
-rw-r--r--contrib/binutils/gas/config/obj-elf.c2
-rw-r--r--contrib/binutils/gas/frags.c2
-rw-r--r--contrib/binutils/gas/subsegs.c4
-rw-r--r--contrib/binutils/ld/ldexp.c6
-rw-r--r--contrib/binutils/ld/sysdep.h3
-rw-r--r--contrib/binutils/opcodes/i386-dis.c24
-rw-r--r--contrib/gcc/cfg.c2
-rw-r--r--contrib/gcc/output.h3
-rw-r--r--contrib/gcc/rtl.h11
-rw-r--r--contrib/gcc/tree.h13
-rw-r--r--contrib/gperf/src/gen-perf.cc2
-rw-r--r--contrib/gperf/src/key-list.cc2
-rw-r--r--lib/libc/db/btree/bt_split.c7
-rw-r--r--lib/libprocstat/libprocstat.c4
-rw-r--r--lib/msun/ld80/e_rem_pio2l.h2
-rw-r--r--libexec/rtld-elf/rtld.c8
-rw-r--r--sbin/ipfw/ipfw2.c3
-rw-r--r--sys/boot/i386/libi386/biosacpi.c2
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h2
-rw-r--r--sys/sys/diskpc98.h4
-rw-r--r--sys/sys/param.h6
-rw-r--r--usr.bin/ldd/sods.c46
-rw-r--r--usr.bin/xlint/lint1/decl.c3
-rw-r--r--usr.bin/xlint/lint1/scan.l3
-rw-r--r--usr.bin/xlint/lint2/msg.c3
-rw-r--r--usr.bin/xlint/lint2/read.c4
30 files changed, 117 insertions, 76 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
index f4eadbc..9722f89 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
@@ -45,6 +45,7 @@
#include <assert.h>
#include <libgen.h>
#include <limits.h>
+#include <stdint.h>
#include <dt_impl.h>
@@ -811,15 +812,14 @@ dt_basename(char *str)
ulong_t
dt_popc(ulong_t x)
{
-#ifdef _ILP32
+#if defined(_ILP32)
x = x - ((x >> 1) & 0x55555555UL);
x = (x & 0x33333333UL) + ((x >> 2) & 0x33333333UL);
x = (x + (x >> 4)) & 0x0F0F0F0FUL;
x = x + (x >> 8);
x = x + (x >> 16);
return (x & 0x3F);
-#endif
-#ifdef _LP64
+#elif defined(_LP64)
x = x - ((x >> 1) & 0x5555555555555555ULL);
x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
@@ -827,6 +827,8 @@ dt_popc(ulong_t x)
x = x + (x >> 16);
x = x + (x >> 32);
return (x & 0x7F);
+#else
+# warning need td_popc() implementation
#endif
}
@@ -958,7 +960,7 @@ dtrace_uaddr2str(dtrace_hdl_t *dtp, pid_t pid,
P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0);
if (P == NULL) {
- (void) snprintf(c, sizeof (c), "0x%llx", addr);
+ (void) snprintf(c, sizeof (c), "0x%jx", (uintmax_t)addr);
return (dt_string2str(c, str, nbytes));
}
@@ -976,10 +978,10 @@ dtrace_uaddr2str(dtrace_hdl_t *dtp, pid_t pid,
(void) snprintf(c, sizeof (c), "%s`%s", obj, name);
}
} else if (Pobjname(P, addr, objname, sizeof (objname)) != 0) {
- (void) snprintf(c, sizeof (c), "%s`0x%llx",
- dt_basename(objname), addr);
+ (void) snprintf(c, sizeof (c), "%s`0x%jx",
+ dt_basename(objname), (uintmax_t)addr);
} else {
- (void) snprintf(c, sizeof (c), "0x%llx", addr);
+ (void) snprintf(c, sizeof (c), "0x%jx", (uintmax_t)addr);
}
dt_proc_unlock(dtp, P);
diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h
index a2aac5f..e654148 100644
--- a/contrib/binutils/bfd/coffcode.h
+++ b/contrib/binutils/bfd/coffcode.h
@@ -3240,7 +3240,7 @@ coff_compute_section_file_positions (bfd * abfd)
incremented in coff_set_section_contents. This is right for
SVR3.2. */
if (strcmp (current->name, _LIB) == 0)
- bfd_set_section_vma (abfd, current, 0);
+ (void) bfd_set_section_vma (abfd, current, 0);
#endif
previous = current;
diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c
index 9e0cc26..ad22db5 100644
--- a/contrib/binutils/bfd/opncls.c
+++ b/contrib/binutils/bfd/opncls.c
@@ -231,7 +231,7 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
then it may have been opened with special flags that make it
unsafe to close and reopen the file. */
if (fd == -1)
- bfd_set_cacheable (nbfd, TRUE);
+ (void) bfd_set_cacheable (nbfd, TRUE);
return nbfd;
}
diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h
index 0f4858f..4ae10db 100644
--- a/contrib/binutils/bfd/peicode.h
+++ b/contrib/binutils/bfd/peicode.h
@@ -607,7 +607,7 @@ pe_ILF_make_a_section (pe_ILF_vars * vars,
bfd_set_section_flags (vars->abfd, sec, flags | extra_flags);
- bfd_set_section_alignment (vars->abfd, sec, 2);
+ (void) bfd_set_section_alignment (vars->abfd, sec, 2);
/* Check that we will not run out of space. */
BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size);
diff --git a/contrib/binutils/gas/config/obj-elf.c b/contrib/binutils/gas/config/obj-elf.c
index 2f93990..12ca242 100644
--- a/contrib/binutils/gas/config/obj-elf.c
+++ b/contrib/binutils/gas/config/obj-elf.c
@@ -1636,7 +1636,7 @@ obj_elf_init_stab_section (segT seg)
/* Force the section to align to a longword boundary. Without this,
UnixWare ar crashes. */
- bfd_set_section_alignment (stdoutput, seg, 2);
+ (void) bfd_set_section_alignment (stdoutput, seg, 2);
/* Make space for this first symbol. */
p = frag_more (12);
diff --git a/contrib/binutils/gas/frags.c b/contrib/binutils/gas/frags.c
index adb9b19..98ac536 100644
--- a/contrib/binutils/gas/frags.c
+++ b/contrib/binutils/gas/frags.c
@@ -146,7 +146,7 @@ frag_new (int old_frags_var_max_size
/* This will align the obstack so the next struct we allocate on it
will begin at a correct boundary. */
- obstack_finish (&frchain_now->frch_obstack);
+ (void) obstack_finish (&frchain_now->frch_obstack);
frchP = frchain_now;
know (frchP);
former_last_fragP = frchP->frch_last;
diff --git a/contrib/binutils/gas/subsegs.c b/contrib/binutils/gas/subsegs.c
index 0094764..066a2fd 100644
--- a/contrib/binutils/gas/subsegs.c
+++ b/contrib/binutils/gas/subsegs.c
@@ -67,7 +67,7 @@ subseg_change (register segT seg, register int subseg)
{
seginfo = xcalloc (1, sizeof (*seginfo));
seginfo->bfd_section = seg;
- bfd_set_section_userdata (stdoutput, seg, seginfo);
+ (void) bfd_set_section_userdata (stdoutput, seg, seginfo);
}
}
@@ -169,7 +169,7 @@ subseg_get (const char *segname, int force_new)
secptr->output_section = secptr;
seginfo = xcalloc (1, sizeof (*seginfo));
seginfo->bfd_section = secptr;
- bfd_set_section_userdata (stdoutput, secptr, seginfo);
+ (void) bfd_set_section_userdata (stdoutput, secptr, seginfo);
}
return secptr;
}
diff --git a/contrib/binutils/ld/ldexp.c b/contrib/binutils/ld/ldexp.c
index 4f1d61d..809b958 100644
--- a/contrib/binutils/ld/ldexp.c
+++ b/contrib/binutils/ld/ldexp.c
@@ -1112,9 +1112,9 @@ exp_get_fill (etree_type *tree, fill_type *def, char *name)
fill = xmalloc (4 + sizeof (*fill) - 1);
val = expld.result.value;
fill->data[0] = (val >> 24) & 0xff;
- fill->data[1] = (val >> 16) & 0xff;
- fill->data[2] = (val >> 8) & 0xff;
- fill->data[3] = (val >> 0) & 0xff;
+ __PAST_END(fill->data, 1) = (val >> 16) & 0xff;
+ __PAST_END(fill->data, 2) = (val >> 8) & 0xff;
+ __PAST_END(fill->data, 3) = (val >> 0) & 0xff;
fill->size = 4;
}
return fill;
diff --git a/contrib/binutils/ld/sysdep.h b/contrib/binutils/ld/sysdep.h
index 4c5e994..2ee2047 100644
--- a/contrib/binutils/ld/sysdep.h
+++ b/contrib/binutils/ld/sysdep.h
@@ -54,6 +54,9 @@ extern char *strrchr ();
/* for MAXPATHLEN */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
+#ifndef __PAST_END
+# define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset])
+#endif
#endif
#ifdef PATH_MAX
# define LD_PATHMAX PATH_MAX
diff --git a/contrib/binutils/opcodes/i386-dis.c b/contrib/binutils/opcodes/i386-dis.c
index e84d314..10de45b 100644
--- a/contrib/binutils/opcodes/i386-dis.c
+++ b/contrib/binutils/opcodes/i386-dis.c
@@ -3203,7 +3203,7 @@ ckprefix (void)
rex_used = 0;
while (1)
{
- FETCH_DATA (the_info, codep + 1);
+ (void) FETCH_DATA (the_info, codep + 1);
newrex = 0;
switch (*codep)
{
@@ -3606,7 +3606,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
insn_codep = codep;
sizeflag = priv.orig_sizeflag;
- FETCH_DATA (info, codep + 1);
+ (void) FETCH_DATA (info, codep + 1);
two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
if (((prefixes & PREFIX_FWAIT)
@@ -3628,7 +3628,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
if (*codep == 0x0f)
{
unsigned char threebyte;
- FETCH_DATA (info, codep + 2);
+ (void) FETCH_DATA (info, codep + 2);
threebyte = *++codep;
dp = &dis386_twobyte[threebyte];
need_modrm = twobyte_has_modrm[*codep];
@@ -3639,7 +3639,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
codep++;
if (dp->name == NULL && dp->op[0].bytemode == IS_3BYTE_OPCODE)
{
- FETCH_DATA (info, codep + 2);
+ (void) FETCH_DATA (info, codep + 2);
op = *codep++;
switch (threebyte)
{
@@ -3724,7 +3724,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
}
else if (need_modrm)
{
- FETCH_DATA (info, codep + 1);
+ (void) FETCH_DATA (info, codep + 1);
modrm.mod = (*codep >> 6) & 3;
modrm.reg = (*codep >> 3) & 7;
modrm.rm = *codep & 7;
@@ -4890,7 +4890,7 @@ OP_E (int bytemode, int sizeflag)
if (base == 4)
{
havesib = 1;
- FETCH_DATA (the_info, codep + 1);
+ (void) FETCH_DATA (the_info, codep + 1);
index = (*codep >> 3) & 7;
if (address_mode == mode_64bit || index != 0x4)
/* When INDEX == 0x4 in 32 bit mode, SCALE is ignored. */
@@ -5147,7 +5147,7 @@ get64 (void)
unsigned int a;
unsigned int b;
- FETCH_DATA (the_info, codep + 8);
+ (void) FETCH_DATA (the_info, codep + 8);
a = *codep++ & 0xff;
a |= (*codep++ & 0xff) << 8;
a |= (*codep++ & 0xff) << 16;
@@ -5169,7 +5169,7 @@ get32 (void)
{
bfd_signed_vma x = 0;
- FETCH_DATA (the_info, codep + 4);
+ (void) FETCH_DATA (the_info, codep + 4);
x = *codep++ & (bfd_signed_vma) 0xff;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
@@ -5182,7 +5182,7 @@ get32s (void)
{
bfd_signed_vma x = 0;
- FETCH_DATA (the_info, codep + 4);
+ (void) FETCH_DATA (the_info, codep + 4);
x = *codep++ & (bfd_signed_vma) 0xff;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 8;
x |= (*codep++ & (bfd_signed_vma) 0xff) << 16;
@@ -5198,7 +5198,7 @@ get16 (void)
{
int x = 0;
- FETCH_DATA (the_info, codep + 2);
+ (void) FETCH_DATA (the_info, codep + 2);
x = *codep++ & 0xff;
x |= (*codep++ & 0xff) << 8;
return x;
@@ -6018,7 +6018,7 @@ OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
{
const char *mnemonic;
- FETCH_DATA (the_info, codep + 1);
+ (void) FETCH_DATA (the_info, codep + 1);
/* AMD 3DNow! instructions are specified by an opcode suffix in the
place where an 8-bit immediate would normally go. ie. the last
byte of the instruction. */
@@ -6054,7 +6054,7 @@ OP_SIMD_Suffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
{
unsigned int cmp_type;
- FETCH_DATA (the_info, codep + 1);
+ (void) FETCH_DATA (the_info, codep + 1);
obufp = obuf + strlen (obuf);
cmp_type = *codep++ & 0xff;
if (cmp_type < 8)
diff --git a/contrib/gcc/cfg.c b/contrib/gcc/cfg.c
index aa8eaca..ec11f43 100644
--- a/contrib/gcc/cfg.c
+++ b/contrib/gcc/cfg.c
@@ -830,7 +830,7 @@ dump_cfg_bb_info (FILE *file, basic_block bb)
else
fprintf (file, ", ");
first = false;
- fprintf (file, bb_bitnames[i]);
+ fputs (bb_bitnames[i], file);
}
if (!first)
fprintf (file, ")");
diff --git a/contrib/gcc/output.h b/contrib/gcc/output.h
index 1d9b837..9b29059 100644
--- a/contrib/gcc/output.h
+++ b/contrib/gcc/output.h
@@ -109,13 +109,14 @@ extern void output_addr_const (FILE *, rtx);
/* Output a string of assembler code, substituting numbers, strings
and fixed syntactic prefixes. */
-#if GCC_VERSION >= 3004
+#if GCC_VERSION >= 3004 && !defined(__clang__)
#define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fprintf__, m, n))) ATTRIBUTE_NONNULL(m)
/* This is a magic identifier which allows GCC to figure out the type
of HOST_WIDE_INT for %wd specifier checks. You must issue this
typedef before using the __asm_fprintf__ format attribute. */
typedef HOST_WIDE_INT __gcc_host_wide_int__;
#else
+/* FIXME(benl): what about %wd? */
#define ATTRIBUTE_ASM_FPRINTF(m, n) ATTRIBUTE_NONNULL(m)
#endif
diff --git a/contrib/gcc/rtl.h b/contrib/gcc/rtl.h
index 6c76f9d..d4af682 100644
--- a/contrib/gcc/rtl.h
+++ b/contrib/gcc/rtl.h
@@ -22,6 +22,11 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef GCC_RTL_H
#define GCC_RTL_H
+#include <sys/param.h>
+#ifndef __PAST_END
+# define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset])
+#endif
+
#include "statistics.h"
#include "machmode.h"
#include "input.h"
@@ -565,12 +570,12 @@ extern void rtvec_check_failed_bounds (rtvec, int, const char *, int,
#define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N])
#define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N])
-#define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N])
+#define RTL_CHECKC1(RTX, N, C) __PAST_END((RTX)->u.fld, N)
#define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N])
-#define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I])
+#define RTVEC_ELT(RTVEC, I) __PAST_END((RTVEC)->elem, I)
#define XWINT(RTX, N) ((RTX)->u.hwint[N])
#define XCWINT(RTX, N, C) ((RTX)->u.hwint[N])
-#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
+#define XCMWINT(RTX, N, C, M) __PAST_END((RTX)->u.hwint, N)
#define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
#define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
#define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
diff --git a/contrib/gcc/tree.h b/contrib/gcc/tree.h
index 7861514..97090be 100644
--- a/contrib/gcc/tree.h
+++ b/contrib/gcc/tree.h
@@ -22,6 +22,11 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef GCC_TREE_H
#define GCC_TREE_H
+#include <sys/param.h>
+#ifndef __PAST_END
+# define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset])
+#endif
+
#include "hashtab.h"
#include "machmode.h"
#include "input.h"
@@ -830,12 +835,12 @@ extern void omp_clause_range_check_failed (const tree, const char *, int,
#define TREE_RANGE_CHECK(T, CODE1, CODE2) (T)
#define EXPR_CHECK(T) (T)
#define NON_TYPE_CHECK(T) (T)
-#define TREE_VEC_ELT_CHECK(T, I) ((T)->vec.a[I])
-#define TREE_OPERAND_CHECK(T, I) ((T)->exp.operands[I])
-#define TREE_OPERAND_CHECK_CODE(T, CODE, I) ((T)->exp.operands[I])
+#define TREE_VEC_ELT_CHECK(T, I) __PAST_END((T)->vec.a, I)
+#define TREE_OPERAND_CHECK(T, I) __PAST_END((T)->exp.operands, I)
+#define TREE_OPERAND_CHECK_CODE(T, CODE, I) __PAST_END((T)->exp.operands, I)
#define TREE_RTL_OPERAND_CHECK(T, CODE, I) (*(rtx *) &((T)->exp.operands[I]))
#define PHI_NODE_ELT_CHECK(T, i) ((T)->phi.a[i])
-#define OMP_CLAUSE_ELT_CHECK(T, i) ((T)->omp_clause.ops[i])
+#define OMP_CLAUSE_ELT_CHECK(T, i) __PAST_END((T)->omp_clause.ops, i)
#define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) (T)
#define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) (T)
diff --git a/contrib/gperf/src/gen-perf.cc b/contrib/gperf/src/gen-perf.cc
index 8840dc6..7cf9f06 100644
--- a/contrib/gperf/src/gen-perf.cc
+++ b/contrib/gperf/src/gen-perf.cc
@@ -246,7 +246,7 @@ Gen_Perf::change (List_Node *prior, List_Node *curr)
{
if (option[DEBUG])
{
- fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n",
+ fprintf (stderr, " by changing asso_value['%c'] (char #%td) to %d\n",
*p, p - union_set + 1, asso_values[(unsigned char)(*p)]);
fflush (stderr);
}
diff --git a/contrib/gperf/src/key-list.cc b/contrib/gperf/src/key-list.cc
index 2461470..11292bc 100644
--- a/contrib/gperf/src/key-list.cc
+++ b/contrib/gperf/src/key-list.cc
@@ -1441,7 +1441,7 @@ Key_List::output_lookup_array (void)
if (option[DEBUG])
fprintf (stderr,
- "dup_ptr[%zd]: hash_value = %d, index = %d, count = %d\n",
+ "dup_ptr[%td]: hash_value = %d, index = %d, count = %d\n",
dup_ptr - duplicates,
dup_ptr->hash_value, dup_ptr->index, dup_ptr->count);
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c
index ca8b16a..f0db406 100644
--- a/lib/libc/db/btree/bt_split.c
+++ b/lib/libc/db/btree/bt_split.c
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)bt_split.c 8.10 (Berkeley) 1/9/95";
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/param.h>
#include <limits.h>
#include <stdio.h>
@@ -482,7 +483,7 @@ bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
WR_RINTERNAL(dest,
l->flags & P_RLEAF ? NEXTINDEX(l) : rec_total(l), l->pgno);
- h->linp[1] = h->upper -= NRINTERNAL;
+ __PAST_END(h->linp, 1) = h->upper -= NRINTERNAL;
dest = (char *)h + h->upper;
WR_RINTERNAL(dest,
r->flags & P_RLEAF ? NEXTINDEX(r) : rec_total(r), r->pgno);
@@ -534,7 +535,7 @@ bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
case P_BLEAF:
bl = GETBLEAF(r, 0);
nbytes = NBINTERNAL(bl->ksize);
- h->linp[1] = h->upper -= nbytes;
+ __PAST_END(h->linp, 1) = h->upper -= nbytes;
dest = (char *)h + h->upper;
WR_BINTERNAL(dest, bl->ksize, r->pgno, 0);
memmove(dest, bl->bytes, bl->ksize);
@@ -550,7 +551,7 @@ bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
case P_BINTERNAL:
bi = GETBINTERNAL(r, 0);
nbytes = NBINTERNAL(bi->ksize);
- h->linp[1] = h->upper -= nbytes;
+ __PAST_END(h->linp, 1) = h->upper -= nbytes;
dest = (char *)h + h->upper;
memmove(dest, bi, nbytes);
((BINTERNAL *)dest)->pgno = r->pgno;
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 384fe73..e1bdfcd 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -1283,7 +1283,7 @@ vntype2psfsttype(int type)
static char *
getmnton(kvm_t *kd, struct mount *m)
{
- static struct mount mnt;
+ struct mount mnt;
static struct mtab {
struct mtab *next;
struct mount *m;
@@ -1302,7 +1302,7 @@ getmnton(kvm_t *kd, struct mount *m)
err(1, NULL);
mt->m = m;
bcopy(&mnt.mnt_stat.f_mntonname[0], &mt->mntonname[0], MNAMELEN);
- mnt.mnt_stat.f_mntonname[MNAMELEN] = '\0';
+ mt->mntonname[MNAMELEN] = '\0';
mt->next = mhead;
mhead = mt;
return (mt->mntonname);
diff --git a/lib/msun/ld80/e_rem_pio2l.h b/lib/msun/ld80/e_rem_pio2l.h
index 81a5ab6..75e4e4b 100644
--- a/lib/msun/ld80/e_rem_pio2l.h
+++ b/lib/msun/ld80/e_rem_pio2l.h
@@ -82,7 +82,7 @@ __ieee754_rem_pio2l(long double x, long double *y)
u.e = x;
expsign = u.xbits.expsign;
ex = expsign & 0x7fff;
- if (ex < BIAS + 25 || ex == BIAS + 25 && u.bits.manh < 0xc90fdaa2) {
+ if (ex < BIAS + 25 || (ex == BIAS + 25 && u.bits.manh < 0xc90fdaa2)) {
/* |x| ~< 2^25*(pi/2), medium size */
/* Use a specialized rint() to get fn. Assume round-to-nearest. */
fn = x*invpio2+0x1.8p63;
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 5c2db0a..722b274 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -928,8 +928,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
obj->textrel = true;
if (dynp->d_un.d_val & DF_BIND_NOW)
obj->bind_now = true;
- if (dynp->d_un.d_val & DF_STATIC_TLS)
- ;
+ /*if (dynp->d_un.d_val & DF_STATIC_TLS)
+ ;*/
break;
#ifdef __mips__
case DT_MIPS_LOCAL_GOTNO:
@@ -958,8 +958,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
obj->z_noopen = true;
if ((dynp->d_un.d_val & DF_1_ORIGIN) && trust)
obj->z_origin = true;
- if (dynp->d_un.d_val & DF_1_GLOBAL)
- /* XXX */;
+ /*if (dynp->d_un.d_val & DF_1_GLOBAL)
+ XXX ;*/
if (dynp->d_un.d_val & DF_1_BIND_NOW)
obj->bind_now = true;
if (dynp->d_un.d_val & DF_1_NODELETE)
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 97d98a3..64e5eb1 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -21,6 +21,7 @@
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
@@ -3567,7 +3568,7 @@ read_options:
}
if (lookup_key[j] <= 0)
errx(EX_USAGE, "format: cannot lookup on %s", *av);
- c->d[1] = j; // i converted to option
+ __PAST_END(c->d, 1) = j; // i converted to option
av++;
cmd->arg1 = strtoul(*av, &p, 0);
if (p && *p)
diff --git a/sys/boot/i386/libi386/biosacpi.c b/sys/boot/i386/libi386/biosacpi.c
index f511eb7..ff8b1ca 100644
--- a/sys/boot/i386/libi386/biosacpi.c
+++ b/sys/boot/i386/libi386/biosacpi.c
@@ -61,7 +61,7 @@ biosacpi_detect(void)
return;
/* export values from the RSDP */
- sprintf(buf, "%p", VTOP(rsdp));
+ sprintf(buf, "%u", VTOP(rsdp));
setenv("hint.acpi.0.rsdp", buf, 1);
revision = rsdp->Revision;
if (revision == 0)
diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h b/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
index cd4caaa..b810f07 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
@@ -65,7 +65,7 @@ typedef long ctf_id_t;
* filling in ctf_sect_t structures and passing them to ctf_bufopen():
*/
typedef struct ctf_sect {
- char *cts_name; /* section name (if any) */
+ const char *cts_name; /* section name (if any) */
ulong_t cts_type; /* section type (ELF SHT_... value) */
ulong_t cts_flags; /* section flags (ELF SHF_... value) */
#if defined(sun)
diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h
index c20ca6c..66bda90 100644
--- a/sys/sys/diskpc98.h
+++ b/sys/sys/diskpc98.h
@@ -36,8 +36,11 @@
#include <sys/ioccom.h>
#define DOSBBSECTOR 0 /* DOS boot block relative sector number */
+#undef DOSPARTOFF
#define DOSPARTOFF 0
+#undef DOSPARTSIZE
#define DOSPARTSIZE 32
+#undef NDOSPART
#define NDOSPART 16
#define DOSMAGICOFFSET 510
#define DOSMAGIC 0xAA55
@@ -52,6 +55,7 @@
#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE)
#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE)
+#undef DOSPTYP_386BSD
#define DOSPTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD)
struct pc98_partition {
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 838769f..589a0f7 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -319,4 +319,10 @@ __END_DECLS
#define member2struct(s, m, x) \
((struct s *)(void *)((char *)(x) - offsetof(struct s, m)))
+/*
+ * Access a variable length array that has been declared as a fixed
+ * length array.
+ */
+#define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset])
+
#endif /* _SYS_PARAM_H_ */
diff --git a/usr.bin/ldd/sods.c b/usr.bin/ldd/sods.c
index e6de90f..adf0f4f 100644
--- a/usr.bin/ldd/sods.c
+++ b/usr.bin/ldd/sods.c
@@ -142,6 +142,24 @@ main(int argc, char *argv[])
}
#endif
+static inline const void *align_struct(const void *expr)
+{
+ assert(!(((int)expr) & 3));
+ return expr;
+}
+
+static inline const void *align_long(const void *expr)
+{
+ assert(!(((int)expr) & 3));
+ return expr;
+}
+
+static inline const void *align_short(const void *expr)
+{
+ assert(!(((int)expr) & 1));
+ return expr;
+}
+
#ifdef STANDALONE
static
#endif
@@ -182,7 +200,7 @@ dump_file(const char *fname)
file_base = (const char *) objbase; /* Makes address arithmetic easier */
- if (IS_ELF(*(const Elf32_Ehdr*) file_base)) {
+ if (IS_ELF(*(const Elf32_Ehdr*) align_struct(file_base))) {
warnx("%s: this is an ELF program; use objdump to examine", fname);
++error_count;
munmap(objbase, sb.st_size);
@@ -190,7 +208,7 @@ dump_file(const char *fname)
return;
}
- ex = (const struct exec *) file_base;
+ ex = (const struct exec *) align_struct(file_base);
printf("%s: a_midmag = 0x%lx\n", fname, (long)ex->a_midmag);
printf(" magic = 0x%lx = 0%lo, netmagic = 0x%lx = 0%lo\n",
@@ -214,8 +232,9 @@ dump_file(const char *fname)
text_base = file_base + N_TXTOFF(*ex);
data_base = file_base + N_DATOFF(*ex);
- rel_base = (const struct relocation_info *) (file_base + N_RELOFF(*ex));
- sym_base = (const struct nlist *) (file_base + N_SYMOFF(*ex));
+ rel_base = (const struct relocation_info *)
+ align_struct(file_base + N_RELOFF(*ex));
+ sym_base = (const struct nlist *) align_struct(file_base + N_SYMOFF(*ex));
str_base = file_base + N_STROFF(*ex);
rel_count = (ex->a_trsize + ex->a_drsize) / sizeof rel_base[0];
@@ -276,19 +295,20 @@ dump_file(const char *fname)
printf(" Object file, origin = %lx\n", origin);
if (N_GETFLAG(*ex) & EX_DYNAMIC) {
- dyn = (const struct _dynamic *) data_base;
+ dyn = (const struct _dynamic *) align_struct(data_base);
printf(" Dynamic version = %d\n", dyn->d_version);
sdt = (const struct section_dispatch_table *)
- (text_addr + (unsigned long) dyn->d_un.d_sdt);
+ align_struct(text_addr + (unsigned long) dyn->d_un.d_sdt);
- rtrel_base =
- (const struct relocation_info *) (text_addr + sdt->sdt_rel);
+ rtrel_base = (const struct relocation_info *)
+ align_struct(text_addr + sdt->sdt_rel);
rtrel_count = (sdt->sdt_hash - sdt->sdt_rel) / sizeof rtrel_base[0];
assert(rtrel_count * sizeof rtrel_base[0] ==
(size_t)(sdt->sdt_hash - sdt->sdt_rel));
- rtsym_base = (const struct nzlist *) (text_addr + sdt->sdt_nzlist);
+ rtsym_base = (const struct nzlist *)
+ align_struct(text_addr + sdt->sdt_nzlist);
rtsym_count = (sdt->sdt_strings - sdt->sdt_nzlist) /
sizeof rtsym_base[0];
assert(rtsym_count * sizeof rtsym_base[0] ==
@@ -352,11 +372,13 @@ dump_rels(const char *label, const struct relocation_info *base,
break;
case 2:
snprintf(contents, sizeof contents, " [%04x]",
- *(unsigned const short *)(text_addr + r->r_address));
+ *(unsigned const short *)
+ align_short(text_addr + r->r_address));
break;
case 4:
snprintf(contents, sizeof contents, "[%08lx]",
- *(unsigned const long *)(text_addr + r->r_address));
+ *(unsigned const long *)
+ align_long(text_addr + r->r_address));
break;
}
} else
@@ -429,7 +451,7 @@ dump_sods(void)
sod_offset = sdt->sdt_sods;
printf(" Shared object dependencies:\n");
while (sod_offset != 0) {
- const struct sod *sodp = (const struct sod *) (text_addr + sod_offset);
+ const struct sod *sodp = (const struct sod *) align_struct((text_addr + sod_offset));
const char *name = (const char *) (text_addr + sodp->sod_name);
if (sodp->sod_library)
diff --git a/usr.bin/xlint/lint1/decl.c b/usr.bin/xlint/lint1/decl.c
index 41492cf..06a412c 100644
--- a/usr.bin/xlint/lint1/decl.c
+++ b/usr.bin/xlint/lint1/decl.c
@@ -415,9 +415,6 @@ tdeferr(type_t *td, tspec_t t)
case UINT:
case INT:
break;
-
- case NTSPEC: /* this value unused */
- break;
}
/* Anything other is not accepted. */
diff --git a/usr.bin/xlint/lint1/scan.l b/usr.bin/xlint/lint1/scan.l
index 05f4ed7..65d2d11 100644
--- a/usr.bin/xlint/lint1/scan.l
+++ b/usr.bin/xlint/lint1/scan.l
@@ -580,9 +580,6 @@ icon(int base)
case CHAR:
case UNSIGN:
break;
-
- case NTSPEC: /* this value unused */
- break;
}
if (typ != QUAD && typ != UQUAD) {
diff --git a/usr.bin/xlint/lint2/msg.c b/usr.bin/xlint/lint2/msg.c
index b4a6a31..b7855ad 100644
--- a/usr.bin/xlint/lint2/msg.c
+++ b/usr.bin/xlint/lint2/msg.c
@@ -32,6 +32,7 @@
*/
#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: msg.c,v 1.6 2002/01/21 19:49:52 tv Exp $");
#endif
@@ -127,7 +128,7 @@ mkpos(pos_t *posp)
if (len > blen)
buf = xrealloc(buf, blen = len);
if (line != 0) {
- (void)sprintf(buf, "%s%s(%hu)",
+ (void)sprintf(buf, "%s%s(%d)",
fn, qm ? "?" : "", line);
} else {
(void)sprintf(buf, "%s", fn);
diff --git a/usr.bin/xlint/lint2/read.c b/usr.bin/xlint/lint2/read.c
index 6288cc1..9dfecfd 100644
--- a/usr.bin/xlint/lint2/read.c
+++ b/usr.bin/xlint/lint2/read.c
@@ -696,8 +696,6 @@ inptype(const char *cp, const char **epp)
case SIGNED:
case NOTSPEC:
break;
- case NTSPEC:
- abort();
}
*epp = cp;
@@ -901,8 +899,6 @@ gettlen(const char *cp, const char **epp)
case UQUAD:
case LONG:
break;
- case NTSPEC:
- abort();
}
*epp = cp;
OpenPOWER on IntegriCloud