From owner-svn-src-all@FreeBSD.ORG Sat Jun 18 13:56:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 076F41065675; Sat, 18 Jun 2011 13:56:34 +0000 (UTC) (envelope-from benl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E80228FC17; Sat, 18 Jun 2011 13:56:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5IDuXAO044203; Sat, 18 Jun 2011 13:56:33 GMT (envelope-from benl@svn.freebsd.org) Received: (from benl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5IDuXhW044171; Sat, 18 Jun 2011 13:56:33 GMT (envelope-from benl@svn.freebsd.org) Message-Id: <201106181356.p5IDuXhW044171@svn.freebsd.org> From: Ben Laurie Date: Sat, 18 Jun 2011 13:56:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes contr... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jun 2011 13:56:34 -0000 Author: benl Date: Sat Jun 18 13:56:33 2011 New Revision: 223262 URL: http://svn.freebsd.org/changeset/base/223262 Log: Fix clang warnings. Approved by: philip (mentor) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c head/contrib/binutils/bfd/coffcode.h head/contrib/binutils/bfd/opncls.c head/contrib/binutils/bfd/peicode.h head/contrib/binutils/gas/config/obj-elf.c head/contrib/binutils/gas/frags.c head/contrib/binutils/gas/subsegs.c head/contrib/binutils/ld/ldexp.c head/contrib/binutils/ld/sysdep.h head/contrib/binutils/opcodes/i386-dis.c head/contrib/gcc/cfg.c head/contrib/gcc/output.h head/contrib/gcc/rtl.h head/contrib/gcc/tree.h head/contrib/gperf/src/gen-perf.cc head/contrib/gperf/src/key-list.cc head/lib/libc/db/btree/bt_split.c head/lib/libprocstat/libprocstat.c head/lib/msun/ld80/e_rem_pio2l.h head/libexec/rtld-elf/rtld.c head/sbin/ipfw/ipfw2.c head/sys/boot/i386/libi386/biosacpi.c head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h head/sys/sys/diskpc98.h head/sys/sys/param.h head/usr.bin/ldd/sods.c head/usr.bin/xlint/lint1/decl.c head/usr.bin/xlint/lint1/scan.l head/usr.bin/xlint/lint2/msg.c head/usr.bin/xlint/lint2/read.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Sat Jun 18 13:56:33 2011 (r223262) @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -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_ 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_ (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); Modified: head/contrib/binutils/bfd/coffcode.h ============================================================================== --- head/contrib/binutils/bfd/coffcode.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/bfd/coffcode.h Sat Jun 18 13:56:33 2011 (r223262) @@ -3240,7 +3240,7 @@ coff_compute_section_file_positions (bfd 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; Modified: head/contrib/binutils/bfd/opncls.c ============================================================================== --- head/contrib/binutils/bfd/opncls.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/bfd/opncls.c Sat Jun 18 13:56:33 2011 (r223262) @@ -231,7 +231,7 @@ bfd_fopen (const char *filename, const c 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; } Modified: head/contrib/binutils/bfd/peicode.h ============================================================================== --- head/contrib/binutils/bfd/peicode.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/bfd/peicode.h Sat Jun 18 13:56:33 2011 (r223262) @@ -607,7 +607,7 @@ pe_ILF_make_a_section (pe_ILF_vars * var 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); Modified: head/contrib/binutils/gas/config/obj-elf.c ============================================================================== --- head/contrib/binutils/gas/config/obj-elf.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/gas/config/obj-elf.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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); Modified: head/contrib/binutils/gas/frags.c ============================================================================== --- head/contrib/binutils/gas/frags.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/gas/frags.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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; Modified: head/contrib/binutils/gas/subsegs.c ============================================================================== --- head/contrib/binutils/gas/subsegs.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/gas/subsegs.c Sat Jun 18 13:56:33 2011 (r223262) @@ -67,7 +67,7 @@ subseg_change (register segT seg, regist { 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 for 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; } Modified: head/contrib/binutils/ld/ldexp.c ============================================================================== --- head/contrib/binutils/ld/ldexp.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/ld/ldexp.c Sat Jun 18 13:56:33 2011 (r223262) @@ -1112,9 +1112,9 @@ exp_get_fill (etree_type *tree, fill_typ 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; Modified: head/contrib/binutils/ld/sysdep.h ============================================================================== --- head/contrib/binutils/ld/sysdep.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/ld/sysdep.h Sat Jun 18 13:56:33 2011 (r223262) @@ -54,6 +54,9 @@ extern char *strrchr (); /* for MAXPATHLEN */ #ifdef HAVE_SYS_PARAM_H #include +#ifndef __PAST_END +# define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset]) +#endif #endif #ifdef PATH_MAX # define LD_PATHMAX PATH_MAX Modified: head/contrib/binutils/opcodes/i386-dis.c ============================================================================== --- head/contrib/binutils/opcodes/i386-dis.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/binutils/opcodes/i386-dis.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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 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 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 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 } 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_U { 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_U { 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) Modified: head/contrib/gcc/cfg.c ============================================================================== --- head/contrib/gcc/cfg.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/gcc/cfg.c Sat Jun 18 13:56:33 2011 (r223262) @@ -830,7 +830,7 @@ dump_cfg_bb_info (FILE *file, basic_bloc else fprintf (file, ", "); first = false; - fprintf (file, bb_bitnames[i]); + fputs (bb_bitnames[i], file); } if (!first) fprintf (file, ")"); Modified: head/contrib/gcc/output.h ============================================================================== --- head/contrib/gcc/output.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/gcc/output.h Sat Jun 18 13:56:33 2011 (r223262) @@ -109,13 +109,14 @@ extern void output_addr_const (FILE *, r /* 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 Modified: head/contrib/gcc/rtl.h ============================================================================== --- head/contrib/gcc/rtl.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/gcc/rtl.h Sat Jun 18 13:56:33 2011 (r223262) @@ -22,6 +22,11 @@ Software Foundation, 51 Franklin Street, #ifndef GCC_RTL_H #define GCC_RTL_H +#include +#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 (r #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) Modified: head/contrib/gcc/tree.h ============================================================================== --- head/contrib/gcc/tree.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/gcc/tree.h Sat Jun 18 13:56:33 2011 (r223262) @@ -22,6 +22,11 @@ Software Foundation, 51 Franklin Street, #ifndef GCC_TREE_H #define GCC_TREE_H +#include +#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_faile #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) Modified: head/contrib/gperf/src/gen-perf.cc ============================================================================== --- head/contrib/gperf/src/gen-perf.cc Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/gperf/src/gen-perf.cc Sat Jun 18 13:56:33 2011 (r223262) @@ -246,7 +246,7 @@ Gen_Perf::change (List_Node *prior, List { 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); } Modified: head/contrib/gperf/src/key-list.cc ============================================================================== --- head/contrib/gperf/src/key-list.cc Sat Jun 18 13:54:36 2011 (r223261) +++ head/contrib/gperf/src/key-list.cc Sat Jun 18 13:56:33 2011 (r223262) @@ -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); Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/lib/libc/db/btree/bt_split.c Sat Jun 18 13:56:33 2011 (r223262) @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)bt_split.c 8 __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -482,7 +483,7 @@ bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAG 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, PAG 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, PAG 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; Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/lib/libprocstat/libprocstat.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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); Modified: head/lib/msun/ld80/e_rem_pio2l.h ============================================================================== --- head/lib/msun/ld80/e_rem_pio2l.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/lib/msun/ld80/e_rem_pio2l.h Sat Jun 18 13:56:33 2011 (r223262) @@ -82,7 +82,7 @@ __ieee754_rem_pio2l(long double x, long 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; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/libexec/rtld-elf/rtld.c Sat Jun 18 13:56:33 2011 (r223262) @@ -928,8 +928,8 @@ digest_dynamic1(Obj_Entry *obj, int earl 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 earl 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) Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/sbin/ipfw/ipfw2.c Sat Jun 18 13:56:33 2011 (r223262) @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -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) Modified: head/sys/boot/i386/libi386/biosacpi.c ============================================================================== --- head/sys/boot/i386/libi386/biosacpi.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/sys/boot/i386/libi386/biosacpi.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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) Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h Sat Jun 18 13:56:33 2011 (r223262) @@ -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) Modified: head/sys/sys/diskpc98.h ============================================================================== --- head/sys/sys/diskpc98.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/sys/sys/diskpc98.h Sat Jun 18 13:56:33 2011 (r223262) @@ -36,8 +36,11 @@ #include #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 { Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Jun 18 13:54:36 2011 (r223261) +++ head/sys/sys/param.h Sat Jun 18 13:56:33 2011 (r223262) @@ -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_ */ Modified: head/usr.bin/ldd/sods.c ============================================================================== --- head/usr.bin/ldd/sods.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/usr.bin/ldd/sods.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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 struc 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) Modified: head/usr.bin/xlint/lint1/decl.c ============================================================================== --- head/usr.bin/xlint/lint1/decl.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/usr.bin/xlint/lint1/decl.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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. */ Modified: head/usr.bin/xlint/lint1/scan.l ============================================================================== --- head/usr.bin/xlint/lint1/scan.l Sat Jun 18 13:54:36 2011 (r223261) +++ head/usr.bin/xlint/lint1/scan.l Sat Jun 18 13:56:33 2011 (r223262) @@ -580,9 +580,6 @@ icon(int base) case CHAR: case UNSIGN: break; - - case NTSPEC: /* this value unused */ - break; } if (typ != QUAD && typ != UQUAD) { Modified: head/usr.bin/xlint/lint2/msg.c ============================================================================== --- head/usr.bin/xlint/lint2/msg.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/usr.bin/xlint/lint2/msg.c Sat Jun 18 13:56:33 2011 (r223262) @@ -32,6 +32,7 @@ */ #include +__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); Modified: head/usr.bin/xlint/lint2/read.c ============================================================================== --- head/usr.bin/xlint/lint2/read.c Sat Jun 18 13:54:36 2011 (r223261) +++ head/usr.bin/xlint/lint2/read.c Sat Jun 18 13:56:33 2011 (r223262) @@ -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;