Module Name: src Committed By: rillig Date: Thu Jul 15 21:56:51 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: decl.c src/usr.bin/xlint/lint1: decl.c Log Message: lint: fix internal error for sizeof(typeof) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.200 -r1.201 src/usr.bin/xlint/lint1/decl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/decl.c diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.7 src/tests/usr.bin/xlint/lint1/decl.c:1.8 --- src/tests/usr.bin/xlint/lint1/decl.c:1.7 Thu Jul 15 21:34:11 2021 +++ src/tests/usr.bin/xlint/lint1/decl.c Thu Jul 15 21:56:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.7 2021/07/15 21:34:11 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.8 2021/07/15 21:56:51 rillig Exp $ */ # 3 "decl.c" /* @@ -131,7 +131,33 @@ int *const volatile cover_type_qualifier unsigned long cover_abstract_declaration_declmods = sizeof(const); unsigned long cover_abstract_declaration_declmods_abstract_declarator = sizeof(const *); -// FIXME: -// lint: internal error in decl.c:833 near decl.c:135: end_type(unsigned long) -//unsigned long cover_abstract_declarator_typeof = -// sizeof(const typeof(cover_abstract_declaration_declmods)); + +unsigned long cover_abstract_declarator_typeof = + sizeof(const typeof(cover_abstract_declaration_declmods)); + +_Bool bool; +char plain_char; +signed char signed_char; +unsigned char unsigned_char; +short signed_short; +unsigned short unsigned_short; +int signed_int; +unsigned int unsigned_int; +long signed_long; +unsigned long unsigned_long; + +/* + * Before decl.c 1.201 from 2021-07-15, lint crashed with an internal error + * in end_type. + */ +unsigned long sizes = + sizeof(const typeof(bool)) + + sizeof(const typeof(plain_char)) + + sizeof(const typeof(signed_char)) + + sizeof(const typeof(unsigned_char)) + + sizeof(const typeof(signed_short)) + + sizeof(const typeof(unsigned_short)) + + sizeof(const typeof(signed_int)) + + sizeof(const typeof(unsigned_int)) + + sizeof(const typeof(signed_long)) + + sizeof(const typeof(unsigned_long)); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.200 src/usr.bin/xlint/lint1/decl.c:1.201 --- src/usr.bin/xlint/lint1/decl.c:1.200 Thu Jul 15 07:58:05 2021 +++ src/usr.bin/xlint/lint1/decl.c Thu Jul 15 21:56:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $ */ +/* $NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 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.200 2021/07/15 07:58:05 rin Exp $"); +__RCSID("$NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $"); #endif #include <sys/param.h> @@ -830,6 +830,8 @@ end_type(void) case LCOMPLEX: break; default: + if (is_integer(t)) + break; INTERNAL_ERROR("end_type(%s)", tspec_name(t)); } if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {