mask the shift by __n with NBBY*sizeof(uintmax-t)-1

to suppress the following diagnostic from clang:
error: shift count >= width of type [-Werror,-Wshift-count-overflow]
    PAR_ATTR            = __BITS(63,56),// F=0 memory attributes
                          ^~~~~~~~~~~~~
src/sys/sys/cdefs.h:554:4: note: expanded from macro '__BITS'
        ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/sys/sys/cdefs.h:550:73: note: expanded from macro '__BIT'
    (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)(__n)))
                                                                        ^  ~~~~~~~~~~~~~~~~
This commit is contained in:
matt 2014-02-05 00:18:09 +00:00
parent 5e9aed4314
commit bfd343aba6
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cdefs.h,v 1.116 2013/10/25 14:54:25 apb Exp $ */
/* $NetBSD: cdefs.h,v 1.117 2014/02/05 00:18:09 matt Exp $ */
/*
* Copyright (c) 1991, 1993
@ -547,7 +547,7 @@
#ifndef __ASSEMBLER__
/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
#define __BIT(__n) \
(((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)(__n)))
(((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)(__n & (NBBY * sizeof(uintmax_t) - 1))))
/* __BITS(m, n): bits m through n, m < n. */
#define __BITS(__m, __n) \