add sizeof checks for unsigned data types

This commit is contained in:
Wei-keng Liao 2016-10-28 18:16:49 -05:00
parent 04e5ff4c74
commit 7572e1cbbf
4 changed files with 56 additions and 3 deletions

View File

@ -1161,9 +1161,13 @@ CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
CHECK_TYPE_SIZE("ssize_t" SIZEOF_SSIZE_T)
# __int64 is used on Windows for large file support.
CHECK_TYPE_SIZE("__int64" SIZEOF___INT_64)
CHECK_TYPE_SIZE("uchar" SIZEOF_UCHAR)
CHECK_TYPE_SIZE("int64_t" SIZEOF_INT64_T)
CHECK_TYPE_SIZE("uint64_t" SIZEOF_UINT64_T)
CHECK_TYPE_SIZE("unsigned char" SIZEOF_UCHAR)
CHECK_TYPE_SIZE("unsigned short int" SIZEOF_USHORT)
CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
CHECK_TYPE_SIZE("long long" SIZEOF_LONGLONG)
CHECK_TYPE_SIZE("unsigned long long" SIZEOF_ULONGLONG)
# On windows systems, we redefine off_t as __int64
# to enable LFS. This is true on 32 and 64 bit system.s

View File

@ -251,6 +251,14 @@ are set when opening a binary file on Windows. */
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
/* The size of `__int64` found on Windows systems. */
#cmakedefine SIZEOF___INT64 @SIZEOF___INT64@
/* The size of `ushort` as computed by sizeof. */
#cmakedefine SIZEOF_USHORT @SIZEOF_USHORT@
/* The size of `ushort` as computed by sizeof. */
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
/* The size of `ushort` as computed by sizeof. */
#cmakedefine SIZEOF_LONGLONG @SIZEOF_LONGLONG@
/* The size of `ushort` as computed by sizeof. */
#cmakedefine SIZEOF_ULONGLONG @SIZEOF_ULONGLONG@

View File

@ -857,6 +857,13 @@ AC_CHECK_SIZEOF(size_t)
$SLEEPCMD
AC_CHECK_SIZEOF(unsigned long long)
$SLEEPCMD
if test "$ac_cv_type_uchar" = yes ; then
AC_CHECK_SIZEOF(uchar)
else
AC_CHECK_SIZEOF(unsigned char)
fi
$SLEEPCMD
if test "$ac_cv_type_ushort" = yes ; then
AC_CHECK_SIZEOF(ushort)

View File

@ -9,7 +9,7 @@ dnl
* Copyright (C) 2014, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
/* $Id: ncx.m4 2585 2016-10-28 04:47:51Z wkliao $ */
/* $Id: ncx.m4 2586 2016-10-28 23:07:40Z wkliao $ */
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-parameter"
@ -167,31 +167,65 @@ define(`FillDefaultValue', `ifelse(
#define Max(a,b) ((a) > (b) ? (a) : (b))
#ifndef SIZEOF_UCHAR
#ifdef SIZEOF_UNSIGNED_CHAR
#define SIZEOF_UCHAR SIZEOF_UNSIGNED_CHAR
#else
#error "unknown SIZEOF_UCHAR"
#endif
#endif
#ifndef SIZEOF_USHORT
#ifdef SIZEOF_UNSIGNED_SHORT_INT
#define SIZEOF_USHORT SIZEOF_UNSIGNED_SHORT_INT
#elif defined(SIZEOF_UNSIGNED_SHORT)
#define SIZEOF_USHORT SIZEOF_UNSIGNED_SHORT
#else
#error "size of short is unknown"
#error "unknown SIZEOF_USHORT"
#endif
#endif
#ifndef SIZEOF_UINT
#ifdef SIZEOF_UNSIGNED_INT
#define SIZEOF_UINT SIZEOF_UNSIGNED_INT
#else
#error "unknown SIZEOF_UINT"
#endif
#endif
#ifndef SIZEOF_LONGLONG
#ifdef SIZEOF_LONG_LONG
#define SIZEOF_LONGLONG SIZEOF_LONG_LONG
#else
#error "unknown SIZEOF_LONGLONG"
#endif
#endif
#ifndef SIZEOF_INT64
#ifdef SIZEOF_LONG_LONG
#define SIZEOF_INT64 SIZEOF_LONG_LONG
#elif defined(SIZEOF_LONGLONG)
#define SIZEOF_INT64 SIZEOF_LONGLONG
#else
#error "unknown SIZEOF_INT64"
#endif
#endif
#ifndef SIZEOF_ULONGLONG
#ifdef SIZEOF_UNSIGNED_LONG_LONG
#define SIZEOF_ULONGLONG SIZEOF_UNSIGNED_LONG_LONG
#else
#error "unknown SIZEOF_ULONGLONG"
#endif
#endif
#ifndef SIZEOF_UINT64
#ifdef SIZEOF_UNSIGNED_LONG_LONG
#define SIZEOF_UINT64 SIZEOF_UNSIGNED_LONG_LONG
#elif defined(SIZEOF_ULONGLONG)
#define SIZEOF_UINT64 SIZEOF_ULONGLONG
#else
#error "unknown SIZEOF_UINT64"
#endif
#endif
/*