lint: make target platform independent of host platform

If lint is run on a platform that has CHAR_BIT == 10, this doesn't
magically make an ILP32 platform have 40 bits per uint32_t.

At the moment, all of the supported platforms are either ILP32 or
I32LP64 anyway, and all of them have CHAR_BIT == 8 == CHAR_SIZE,
so nothing changes practically.
This commit is contained in:
rillig 2021-01-09 14:10:12 +00:00
parent 1f9fa21d0b
commit 63bde02018
28 changed files with 184 additions and 180 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.2 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.3 2021/01/09 14:10:12 rillig Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -45,8 +45,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (16 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 128
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.5 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.6 2021/01/09 14:10:12 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:12 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,9 +47,9 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
/* XXX ARM ELF ABI says packed enums -- variable size! */
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.3 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.4 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.5 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.6 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (12 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 96
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.3 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.4 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (16 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 128
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.4 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.5 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.5 2021/01/09 13:58:43 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.6 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (12 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 96
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:44 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -53,8 +53,8 @@
#define INTPTR_IS_LONG 0
#endif
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:44 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -48,8 +48,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (16 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 128
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.2 2021/01/09 13:58:44 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.3 2021/01/09 14:10:13 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:44 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.3 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.4 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.2 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.3 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.2 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.3 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 0
#define INTPTR_IS_LONG 0
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.5 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.6 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.6 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.7 2021/01/09 14:10:14 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (16 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 128
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.7 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.8 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -46,8 +46,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (8 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 64
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: targparam.h,v 1.5 2021/01/09 13:58:45 rillig Exp $ */
/* $NetBSD: targparam.h,v 1.6 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -47,8 +47,8 @@
#define SIZEOF_IS_ULONG 1
#define INTPTR_IS_LONG 1
#define FLOAT_SIZE (4 * CHAR_BIT)
#define DOUBLE_SIZE (8 * CHAR_BIT)
#define LDOUBLE_SIZE (16 * CHAR_BIT)
#define FLOAT_SIZE 32
#define DOUBLE_SIZE 64
#define LDOUBLE_SIZE 128
#define ENUM_SIZE (4 * CHAR_BIT)
#define ENUM_SIZE 32

View File

@ -1,4 +1,4 @@
/* $NetBSD: ilp32.h,v 1.4 2021/01/04 01:11:01 rillig Exp $ */
/* $NetBSD: ilp32.h,v 1.5 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -39,16 +39,16 @@
* Type sizes for ILP32 platforms (int, long, pointer: 32-bit)
*/
#define CHAR_SIZE (CHAR_BIT)
#define SHORT_SIZE (2 * CHAR_BIT)
#define INT_SIZE (4 * CHAR_BIT)
#define LONG_SIZE (4 * CHAR_BIT)
#define QUAD_SIZE (8 * CHAR_BIT)
#define PTR_SIZE (4 * CHAR_BIT)
#define CHAR_SIZE 8
#define SHORT_SIZE 16
#define INT_SIZE 32
#define LONG_SIZE 32
#define QUAD_SIZE 64
#define PTR_SIZE 32
#define TARG_SCHAR_MAX ((signed char) (((unsigned char) -1) >> 1))
#define TARG_SCHAR_MAX ((int8_t) (((uint8_t) -1) >> 1))
#define TARG_SCHAR_MIN ((-TARG_CHAR_MAX) - 1)
#define TARG_UCHAR_MAX ((unsigned char) -1)
#define TARG_UCHAR_MAX ((uint8_t) -1)
#define TARG_SHRT_MAX ((int16_t) (((uint16_t) -1) >> 1))
#define TARG_SHRT_MIN ((-TARG_SHRT_MAX) - 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: inittyp.c,v 1.15 2021/01/04 01:12:20 rillig Exp $ */
/* $NetBSD: inittyp.c,v 1.16 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: inittyp.c,v 1.15 2021/01/04 01:12:20 rillig Exp $");
__RCSID("$NetBSD: inittyp.c,v 1.16 2021/01/09 14:10:15 rillig Exp $");
#endif
#include <limits.h>
@ -71,64 +71,68 @@ inittyp(void)
{ BOOL, { CHAR_SIZE, 1,
BOOL, BOOL,
1, 1, 0, 1, 1, 0, "_Bool" } },
{ CHAR, { CHAR_SIZE, CHAR_BIT,
{ CHAR, { CHAR_SIZE, 8,
SCHAR, UCHAR,
1, 0, 0, 1, 1, 0, "char" } },
{ SCHAR, { CHAR_SIZE, CHAR_BIT,
{ SCHAR, { CHAR_SIZE, 8,
SCHAR, UCHAR,
1, 0, 0, 1, 1, 0, "signed char" } },
{ UCHAR, { CHAR_SIZE, CHAR_BIT,
{ UCHAR, { CHAR_SIZE, 8,
SCHAR, UCHAR,
1, 1, 0, 1, 1, 0, "unsigned char" } },
{ SHORT, { SHORT_SIZE, 2 * CHAR_BIT,
{ SHORT, { SHORT_SIZE, 16,
SHORT, USHORT,
1, 0, 0, 1, 1, 0, "short" } },
{ USHORT, { SHORT_SIZE, 2 * CHAR_BIT,
{ USHORT, { SHORT_SIZE, 16,
SHORT, USHORT,
1, 1, 0, 1, 1, 0, "unsigned short" } },
{ INT, { INT_SIZE, INT_RSIZE * CHAR_BIT,
{ INT, { INT_SIZE, INT_RSIZE * 8,
INT, UINT,
1, 0, 0, 1, 1, 0, "int" } },
{ UINT, { INT_SIZE, INT_RSIZE * CHAR_BIT,
{ UINT, { INT_SIZE, INT_RSIZE * 8,
INT, UINT,
1, 1, 0, 1, 1, 0, "unsigned int" } },
{ LONG, { LONG_SIZE, 4 * CHAR_BIT,
{ LONG, { LONG_SIZE, 32,
LONG, ULONG,
1, 0, 0, 1, 1, 0, "long" } },
{ ULONG, { LONG_SIZE, 4 * CHAR_BIT,
{ ULONG, { LONG_SIZE, 32,
LONG, ULONG,
1, 1, 0, 1, 1, 0, "unsigned long" } },
{ QUAD, { QUAD_SIZE, 8 * CHAR_BIT,
{ QUAD, { QUAD_SIZE, 64,
QUAD, UQUAD,
1, 0, 0, 1, 1, 0, "long long" } },
{ UQUAD, { QUAD_SIZE, 8 * CHAR_BIT,
{ UQUAD, { QUAD_SIZE, 64,
QUAD, UQUAD,
1, 1, 0, 1, 1, 0, "unsigned long long" } },
#ifdef INT128_SIZE
{ INT128, { INT128_SIZE, 16 * CHAR_BIT,
{ INT128, { INT128_SIZE, 128,
INT128, UINT128,
1, 0, 0, 1, 1, 0, "__int128_t" } },
{ UINT128, { INT128_SIZE, 16 * CHAR_BIT,
{ UINT128, { INT128_SIZE, 128,
INT128, UINT128,
1, 1, 0, 1, 1, 0, "__uint128_t" } },
#endif
{ FLOAT, { FLOAT_SIZE, 4 * CHAR_BIT,
{ FLOAT, { FLOAT_SIZE, 32,
FLOAT, FLOAT,
0, 0, 1, 1, 1, 0, "float" } },
{ DOUBLE, { DOUBLE_SIZE, 8 * CHAR_BIT,
{ DOUBLE, { DOUBLE_SIZE, 64,
DOUBLE, DOUBLE,
0, 0, 1, 1, 1, 0, "double" } },
{ LDOUBLE, { LDOUBLE_SIZE, 10 * CHAR_BIT,
{ LDOUBLE, { LDOUBLE_SIZE, 80,
LDOUBLE, LDOUBLE,
0, 0, 1, 1, 1, 0, "long double" } },
{ FCOMPLEX, { FLOAT_SIZE * 2, 4 * CHAR_BIT * 2,
{ FCOMPLEX, { FLOAT_SIZE * 2, 32 * 2,
FCOMPLEX, FCOMPLEX,
0, 0, 1, 1, 1, 1, "float _Complex" } },
{ DCOMPLEX, { DOUBLE_SIZE * 2, 8 * CHAR_BIT * 2,
{ DCOMPLEX, { DOUBLE_SIZE * 2, 64 * 2,
DCOMPLEX, DCOMPLEX,
0, 0, 1, 1, 1, 1, "double _Complex" } },
{ LCOMPLEX, { LDOUBLE_SIZE * 2, 8 * CHAR_BIT * 2,
/*
* XXX: with -p, LCOMPLEX.tt_psz != 2 * LDOUBLE.tt_psz.
* This may or may not have been intentional.
*/
{ LCOMPLEX, { LDOUBLE_SIZE * 2, 64 * 2,
LCOMPLEX, LCOMPLEX,
0, 0, 1, 1, 1, 1, "long double _Complex" } },
{ VOID, { -1, -1,
@ -140,10 +144,10 @@ inittyp(void)
{ UNION, { -1, -1,
UNION, UNION,
0, 0, 0, 0, 0, 0, "union" } },
{ ENUM, { ENUM_SIZE, 3 * CHAR_BIT,
{ ENUM, { ENUM_SIZE, 24,
ENUM, ENUM,
1, 0, 0, 1, 1, 0, "enum" } },
{ PTR, { PTR_SIZE, 4 * CHAR_BIT,
{ PTR, { PTR_SIZE, 32,
PTR, PTR,
0, 1, 0, 0, 1, 0, "pointer" } },
{ ARRAY, { -1, -1,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lp64.h,v 1.9 2021/01/04 01:12:20 rillig Exp $ */
/* $NetBSD: lp64.h,v 1.10 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -39,19 +39,19 @@
* Type sizes for LP64 platforms (long, pointer: 64-bit)
*/
#define CHAR_SIZE (CHAR_BIT)
#define SHORT_SIZE (2 * CHAR_BIT)
#define INT_SIZE (4 * CHAR_BIT)
#define LONG_SIZE (8 * CHAR_BIT)
#define QUAD_SIZE (8 * CHAR_BIT)
#define PTR_SIZE (8 * CHAR_BIT)
#define CHAR_SIZE 8
#define SHORT_SIZE 16
#define INT_SIZE 32
#define LONG_SIZE 64
#define QUAD_SIZE 64
#define PTR_SIZE 64
#ifdef _LP64
#define INT128_SIZE (16 * CHAR_BIT)
#define INT128_SIZE 128
#endif
#define TARG_SCHAR_MAX ((signed char) (((unsigned char) -1) >> 1))
#define TARG_SCHAR_MAX ((int8_t) (((uint8_t) -1) >> 1))
#define TARG_SCHAR_MIN ((-TARG_CHAR_MAX) - 1)
#define TARG_UCHAR_MAX ((unsigned char) -1)
#define TARG_UCHAR_MAX ((uint8_t) -1)
#define TARG_SHRT_MAX ((int16_t) (((uint16_t) -1) >> 1))
#define TARG_SHRT_MIN ((-TARG_SHRT_MAX) - 1)

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: cgram.y,v 1.135 2021/01/09 13:12:13 rillig Exp $ */
/* $NetBSD: cgram.y,v 1.136 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: cgram.y,v 1.135 2021/01/09 13:12:13 rillig Exp $");
__RCSID("$NetBSD: cgram.y,v 1.136 2021/01/09 14:10:15 rillig Exp $");
#endif
#include <limits.h>
@ -728,7 +728,7 @@ struct:
symtyp = FTAG;
pushdecl($1 == STRUCT ? MOS : MOU);
dcs->d_offset = 0;
dcs->d_stralign = CHAR_BIT;
dcs->d_stralign = CHAR_SIZE;
$$ = $1;
}
;

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl.c,v 1.112 2021/01/09 13:12:13 rillig Exp $ */
/* $NetBSD: decl.c,v 1.113 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: decl.c,v 1.112 2021/01/09 13:12:13 rillig Exp $");
__RCSID("$NetBSD: decl.c,v 1.113 2021/01/09 14:10:15 rillig Exp $");
#endif
#include <sys/param.h>
@ -942,16 +942,16 @@ getbound(type_t *tp)
} else if (t == FUNC) {
/* compiler takes alignment of function */
error(14);
a = WORST_ALIGN(1) * CHAR_BIT;
a = WORST_ALIGN(1) * CHAR_SIZE;
} else {
if ((a = size(t)) == 0) {
a = CHAR_BIT;
} else if (a > WORST_ALIGN(1) * CHAR_BIT) {
a = WORST_ALIGN(1) * CHAR_BIT;
a = CHAR_SIZE;
} else if (a > WORST_ALIGN(1) * CHAR_SIZE) {
a = WORST_ALIGN(1) * CHAR_SIZE;
}
}
lint_assert(a >= CHAR_BIT);
lint_assert(a <= WORST_ALIGN(1) * CHAR_BIT);
lint_assert(a >= CHAR_SIZE);
lint_assert(a <= WORST_ALIGN(1) * CHAR_SIZE);
return a;
}
@ -1659,7 +1659,7 @@ mktag(sym_t *tag, tspec_t kind, int decl, int semi)
tp->t_tspec = kind;
if (kind != ENUM) {
tp->t_str = getblk(sizeof (str_t));
tp->t_str->align = CHAR_BIT;
tp->t_str->align = CHAR_SIZE;
tp->t_str->stag = tag;
} else {
tp->t_isenum = 1;

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: scan.l,v 1.114 2021/01/09 02:38:27 rillig Exp $ */
/* $NetBSD: scan.l,v 1.115 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: scan.l,v 1.114 2021/01/09 02:38:27 rillig Exp $");
__RCSID("$NetBSD: scan.l,v 1.115 2021/01/09 14:10:15 rillig Exp $");
#endif
#include <ctype.h>
@ -49,7 +49,7 @@ __RCSID("$NetBSD: scan.l,v 1.114 2021/01/09 02:38:27 rillig Exp $");
#include "lint1.h"
#include "cgram.h"
#define CHAR_MASK ((int)(~(~0U << CHAR_BIT)))
#define CHAR_MASK ((int)(~(~0U << CHAR_SIZE)))
/* Current position (it's also updated when an included file is parsed) */
pos_t curr_pos = { 1, "", 0 };
@ -314,13 +314,13 @@ static struct kwtab {
static sym_t *symtab[HSHSIZ1];
/* bit i of the entry with index i is set */
uint64_t qbmasks[sizeof(uint64_t) * CHAR_BIT];
uint64_t qbmasks[64];
/* least significant i bits are set in the entry with index i */
uint64_t qlmasks[sizeof(uint64_t) * CHAR_BIT + 1];
uint64_t qlmasks[64 + 1];
/* least significant i bits are not set in the entry with index i */
uint64_t qumasks[sizeof(uint64_t) * CHAR_BIT + 1];
uint64_t qumasks[64 + 1];
/* free list for sbuf structures */
static sbuf_t *sbfrlst;
@ -401,7 +401,7 @@ initscan(void)
}
/* initialize bit-masks for quads */
for (i = 0; i < sizeof (uint64_t) * CHAR_BIT; i++) {
for (i = 0; i < 64; i++) {
qbmasks[i] = (uint64_t)1 << i;
uq = ~(uint64_t)0 << i;
qumasks[i] = uq;
@ -901,7 +901,7 @@ ccon(void)
n = 0;
val = 0;
while ((c = getescc('\'')) >= 0) {
val = (val << CHAR_BIT) + c;
val = (val << CHAR_SIZE) + c;
n++;
}
if (c == -2) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tree.c,v 1.135 2021/01/05 17:37:57 rillig Exp $ */
/* $NetBSD: tree.c,v 1.136 2021/01/09 14:10:15 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: tree.c,v 1.135 2021/01/05 17:37:57 rillig Exp $");
__RCSID("$NetBSD: tree.c,v 1.136 2021/01/09 14:10:15 rillig Exp $");
#endif
#include <float.h>
@ -1464,7 +1464,7 @@ new_tnode(op_t op, type_t *type, tnode_t *ln, tnode_t *rn)
if (rn->tn_op != CON)
break;
rnum = rn->tn_val->v_quad;
l = tsize(ln->tn_type) / CHAR_BIT;
l = tsize(ln->tn_type) / CHAR_SIZE;
t = ln->tn_type->t_tspec;
switch (l) {
case 8:
@ -2302,10 +2302,10 @@ build_struct_access(op_t op, tnode_t *ln, tnode_t *rn)
#if PTRDIFF_IS_LONG
ctn = new_integer_constant_node(LONG,
rn->tn_sym->s_value.v_quad / CHAR_BIT);
rn->tn_sym->s_value.v_quad / CHAR_SIZE);
#else
ctn = new_integer_constant_node(INT,
rn->tn_sym->s_value.v_quad / CHAR_BIT);
rn->tn_sym->s_value.v_quad / CHAR_SIZE);
#endif
ntn = new_tnode(PLUS, tincref(rn->tn_type, PTR), ln, ctn);
@ -2663,7 +2663,7 @@ plength(type_t *tp)
}
if (elsz == 0)
elsz = CHAR_BIT;
elsz = CHAR_SIZE;
#if PTRDIFF_IS_LONG
st = LONG;
@ -2671,7 +2671,7 @@ plength(type_t *tp)
st = INT;
#endif
return new_integer_constant_node(st, (int64_t)(elem * elsz / CHAR_BIT));
return new_integer_constant_node(st, (int64_t)(elem * elsz / CHAR_SIZE));
}
/*
@ -2983,7 +2983,7 @@ build_sizeof(type_t *tp)
#else
st = UINT;
#endif
return new_integer_constant_node(st, tsize(tp) / CHAR_BIT);
return new_integer_constant_node(st, tsize(tp) / CHAR_SIZE);
}
/*
@ -3004,7 +3004,7 @@ build_offsetof(type_t *tp, sym_t *sym)
error(111, "offsetof");
// XXX: wrong size, no checking for sym fixme
return new_integer_constant_node(st, tsize(tp) / CHAR_BIT);
return new_integer_constant_node(st, tsize(tp) / CHAR_SIZE);
}
int64_t
@ -3114,7 +3114,7 @@ build_alignof(type_t *tp)
st = UINT;
#endif
return new_integer_constant_node(st, (int64_t)getbound(tp) / CHAR_BIT);
return new_integer_constant_node(st, (int64_t)getbound(tp) / CHAR_SIZE);
}
/*
@ -3776,7 +3776,7 @@ check_array_index(tnode_t *tn, int amper)
/* Get the size of one array element */
if ((elsz = length(ln->tn_type->t_subt, NULL)) == 0)
return;
elsz /= CHAR_BIT;
elsz /= CHAR_SIZE;
/* Change the unit of the index from bytes to element size. */
if (tspec_is_uint(rn->tn_type->t_tspec)) {
@ -3817,14 +3817,14 @@ check_integer_comparison(op_t op, tnode_t *ln, tnode_t *rn)
if ((hflag || pflag) && lt == CHAR && rn->tn_op == CON &&
(rn->tn_val->v_quad < 0 ||
rn->tn_val->v_quad > (int)~(~0U << (CHAR_BIT - 1)))) {
rn->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1)))) {
/* nonportable character comparison, op %s */
warning(230, mp->m_name);
return;
}
if ((hflag || pflag) && rt == CHAR && ln->tn_op == CON &&
(ln->tn_val->v_quad < 0 ||
ln->tn_val->v_quad > (int)~(~0U << (CHAR_BIT - 1)))) {
ln->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1)))) {
/* nonportable character comparison, op %s */
warning(230, mp->m_name);
return;