| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tree.c,v 1.118 2021/01/03 17:42:45 rillig Exp $ */ | | 1 | /* $NetBSD: tree.c,v 1.119 2021/01/03 18:35:51 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1994, 1995 Jochen Pohl | | 4 | * Copyright (c) 1994, 1995 Jochen Pohl |
5 | * All Rights Reserved. | | 5 | * All Rights Reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -27,39 +27,38 @@ | | | @@ -27,39 +27,38 @@ |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #if HAVE_NBTOOL_CONFIG_H | | 34 | #if HAVE_NBTOOL_CONFIG_H |
35 | #include "nbtool_config.h" | | 35 | #include "nbtool_config.h" |
36 | #endif | | 36 | #endif |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | #if defined(__RCSID) && !defined(lint) | | 39 | #if defined(__RCSID) && !defined(lint) |
40 | __RCSID("$NetBSD: tree.c,v 1.118 2021/01/03 17:42:45 rillig Exp $"); | | 40 | __RCSID("$NetBSD: tree.c,v 1.119 2021/01/03 18:35:51 rillig Exp $"); |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <float.h> | | 43 | #include <float.h> |
44 | #include <limits.h> | | 44 | #include <limits.h> |
45 | #include <math.h> | | 45 | #include <math.h> |
46 | #include <signal.h> | | 46 | #include <signal.h> |
47 | #include <stdlib.h> | | 47 | #include <stdlib.h> |
48 | #include <string.h> | | 48 | #include <string.h> |
49 | | | 49 | |
50 | #include "lint1.h" | | 50 | #include "lint1.h" |
51 | #include "cgram.h" | | 51 | #include "cgram.h" |
52 | #include "externs1.h" | | | |
53 | | | 52 | |
54 | static tnode_t *new_int_const_node(tspec_t, int64_t); | | 53 | static tnode_t *new_int_const_node(tspec_t, int64_t); |
55 | static void check_pointer_comparison(op_t, tnode_t *, tnode_t *); | | 54 | static void check_pointer_comparison(op_t, tnode_t *, tnode_t *); |
56 | static int check_assign_types_compatible(op_t, int, tnode_t *, tnode_t *); | | 55 | static int check_assign_types_compatible(op_t, int, tnode_t *, tnode_t *); |
57 | static void check_bad_enum_operation(op_t, tnode_t *, tnode_t *); | | 56 | static void check_bad_enum_operation(op_t, tnode_t *, tnode_t *); |
58 | static void check_enum_type_mismatch(op_t, int, tnode_t *, tnode_t *); | | 57 | static void check_enum_type_mismatch(op_t, int, tnode_t *, tnode_t *); |
59 | static void check_enum_int_mismatch(op_t, int, tnode_t *, tnode_t *); | | 58 | static void check_enum_int_mismatch(op_t, int, tnode_t *, tnode_t *); |
60 | static tnode_t *new_tnode(op_t, type_t *, tnode_t *, tnode_t *); | | 59 | static tnode_t *new_tnode(op_t, type_t *, tnode_t *, tnode_t *); |
61 | static void balance(op_t, tnode_t **, tnode_t **); | | 60 | static void balance(op_t, tnode_t **, tnode_t **); |
62 | static void warn_incompatible_types(op_t, tspec_t, tspec_t); | | 61 | static void warn_incompatible_types(op_t, tspec_t, tspec_t); |
63 | static void warn_incompatible_pointers(mod_t *, type_t *, type_t *); | | 62 | static void warn_incompatible_pointers(mod_t *, type_t *, type_t *); |
64 | static void merge_qualifiers(type_t **, type_t *, type_t *); | | 63 | static void merge_qualifiers(type_t **, type_t *, type_t *); |
65 | static int has_constant_member(type_t *); | | 64 | static int has_constant_member(type_t *); |