| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $ */ | | 1 | /* $NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. | | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. |
5 | * Copyright (c) 1994, 1995 Jochen Pohl | | 5 | * Copyright (c) 1994, 1995 Jochen Pohl |
6 | * All Rights Reserved. | | 6 | * All Rights Reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #if HAVE_NBTOOL_CONFIG_H | | 35 | #if HAVE_NBTOOL_CONFIG_H |
36 | #include "nbtool_config.h" | | 36 | #include "nbtool_config.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | #if defined(__RCSID) && !defined(lint) | | 40 | #if defined(__RCSID) && !defined(lint) |
41 | __RCSID("$NetBSD: decl.c,v 1.200 2021/07/15 07:58:05 rin Exp $"); | | 41 | __RCSID("$NetBSD: decl.c,v 1.201 2021/07/15 21:56:51 rillig Exp $"); |
42 | #endif | | 42 | #endif |
43 | | | 43 | |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <limits.h> | | 45 | #include <limits.h> |
46 | #include <stdlib.h> | | 46 | #include <stdlib.h> |
47 | #include <string.h> | | 47 | #include <string.h> |
48 | | | 48 | |
49 | #include "lint1.h" | | 49 | #include "lint1.h" |
50 | | | 50 | |
51 | const char *unnamed = "<unnamed>"; | | 51 | const char *unnamed = "<unnamed>"; |
52 | | | 52 | |
53 | /* shared type structures for arithmetic types and void */ | | 53 | /* shared type structures for arithmetic types and void */ |
54 | static type_t *typetab; | | 54 | static type_t *typetab; |
| @@ -820,26 +820,28 @@ end_type(void) | | | @@ -820,26 +820,28 @@ end_type(void) |
820 | if (l == LONG) { | | 820 | if (l == LONG) { |
821 | l = NOTSPEC; | | 821 | l = NOTSPEC; |
822 | t = LCOMPLEX; | | 822 | t = LCOMPLEX; |
823 | if (tflag) | | 823 | if (tflag) |
824 | /* 'long double' is illegal in ... */ | | 824 | /* 'long double' is illegal in ... */ |
825 | warning(266); | | 825 | warning(266); |
826 | } | | 826 | } |
827 | break; | | 827 | break; |
828 | case VOID: | | 828 | case VOID: |
829 | case FCOMPLEX: | | 829 | case FCOMPLEX: |
830 | case LCOMPLEX: | | 830 | case LCOMPLEX: |
831 | break; | | 831 | break; |
832 | default: | | 832 | default: |
| | | 833 | if (is_integer(t)) |
| | | 834 | break; |
833 | INTERNAL_ERROR("end_type(%s)", tspec_name(t)); | | 835 | INTERNAL_ERROR("end_type(%s)", tspec_name(t)); |
834 | } | | 836 | } |
835 | if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) { | | 837 | if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) { |
836 | dcs->d_terr = true; | | 838 | dcs->d_terr = true; |
837 | l = s = NOTSPEC; | | 839 | l = s = NOTSPEC; |
838 | } | | 840 | } |
839 | if (l != NOTSPEC) | | 841 | if (l != NOTSPEC) |
840 | t = l; | | 842 | t = l; |
841 | dcs->d_type = gettyp(merge_type_specifiers(t, s)); | | 843 | dcs->d_type = gettyp(merge_type_specifiers(t, s)); |
842 | } | | 844 | } |
843 | | | 845 | |
844 | if (dcs->d_mscl) { | | 846 | if (dcs->d_mscl) { |
845 | /* only one storage class allowed */ | | 847 | /* only one storage class allowed */ |