Tue Feb 18 22:01:37 2014 UTC ()
add __extension__ and typeof


(christos)
diff -r1.57 -r1.58 src/usr.bin/xlint/lint1/cgram.y
diff -r1.46 -r1.47 src/usr.bin/xlint/lint1/err.c
diff -r1.53 -r1.54 src/usr.bin/xlint/lint1/scan.l
diff -r1.74 -r1.75 src/usr.bin/xlint/lint1/tree.c

cvs diff -r1.57 -r1.58 src/usr.bin/xlint/lint1/cgram.y (expand / switch to unified diff)

--- src/usr.bin/xlint/lint1/cgram.y 2014/02/04 08:08:59 1.57
+++ src/usr.bin/xlint/lint1/cgram.y 2014/02/18 22:01:36 1.58
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1%{ 1%{
2/* $NetBSD: cgram.y,v 1.57 2014/02/04 08:08:59 njoly Exp $ */ 2/* $NetBSD: cgram.y,v 1.58 2014/02/18 22:01:36 christos Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. 5 * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
6 * Copyright (c) 1994, 1995 Jochen Pohl 6 * Copyright (c) 1994, 1995 Jochen Pohl
7 * All Rights Reserved. 7 * All Rights Reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37#if defined(__RCSID) && !defined(lint) 37#if defined(__RCSID) && !defined(lint)
38__RCSID("$NetBSD: cgram.y,v 1.57 2014/02/04 08:08:59 njoly Exp $"); 38__RCSID("$NetBSD: cgram.y,v 1.58 2014/02/18 22:01:36 christos Exp $");
39#endif 39#endif
40 40
41#include <stdlib.h> 41#include <stdlib.h>
42#include <string.h> 42#include <string.h>
43#include <limits.h> 43#include <limits.h>
44 44
45#include "lint1.h" 45#include "lint1.h"
46 46
47extern char *yytext; 47extern char *yytext;
48/* 48/*
49 * Contains the level of current declaration. 0 is extern. 49 * Contains the level of current declaration. 0 is extern.
50 * Used for symbol table entries. 50 * Used for symbol table entries.
51 */ 51 */
@@ -120,26 +120,28 @@ static inline void RESTORE(const char *f @@ -120,26 +120,28 @@ static inline void RESTORE(const char *f
120 tqual_t y_tqual; 120 tqual_t y_tqual;
121 type_t *y_type; 121 type_t *y_type;
122 tnode_t *y_tnode; 122 tnode_t *y_tnode;
123 range_t y_range; 123 range_t y_range;
124 strg_t *y_strg; 124 strg_t *y_strg;
125 pqinf_t *y_pqinf; 125 pqinf_t *y_pqinf;
126}; 126};
127 127
128%token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPARN T_RPARN 128%token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPARN T_RPARN
129%token <y_op> T_STROP 129%token <y_op> T_STROP
130%token <y_op> T_UNOP 130%token <y_op> T_UNOP
131%token <y_op> T_INCDEC 131%token <y_op> T_INCDEC
132%token T_SIZEOF 132%token T_SIZEOF
 133%token T_TYPEOF
 134%token T_EXTENSION
133%token T_ALIGNOF 135%token T_ALIGNOF
134%token <y_op> T_MULT 136%token <y_op> T_MULT
135%token <y_op> T_DIVOP 137%token <y_op> T_DIVOP
136%token <y_op> T_ADDOP 138%token <y_op> T_ADDOP
137%token <y_op> T_SHFTOP 139%token <y_op> T_SHFTOP
138%token <y_op> T_RELOP 140%token <y_op> T_RELOP
139%token <y_op> T_EQOP 141%token <y_op> T_EQOP
140%token <y_op> T_AND 142%token <y_op> T_AND
141%token <y_op> T_XOR 143%token <y_op> T_XOR
142%token <y_op> T_OR 144%token <y_op> T_OR
143%token <y_op> T_LOGAND 145%token <y_op> T_LOGAND
144%token <y_op> T_LOGOR 146%token <y_op> T_LOGOR
145%token T_QUEST 147%token T_QUEST
@@ -543,26 +545,29 @@ clrtyp_typespec: @@ -543,26 +545,29 @@ clrtyp_typespec:
543typespec: 545typespec:
544 notype_typespec { 546 notype_typespec {
545 $$ = $1; 547 $$ = $1;
546 } 548 }
547 | T_TYPENAME { 549 | T_TYPENAME {
548 $$ = getsym($1)->s_type; 550 $$ = getsym($1)->s_type;
549 } 551 }
550 ; 552 ;
551 553
552notype_typespec: 554notype_typespec:
553 T_TYPE { 555 T_TYPE {
554 $$ = gettyp($1); 556 $$ = gettyp($1);
555 } 557 }
 558 | T_TYPEOF T_LPARN term T_RPARN {
 559 $$ = $3->tn_type;
 560 }
556 | struct_spec { 561 | struct_spec {
557 popdecl(); 562 popdecl();
558 $$ = $1; 563 $$ = $1;
559 } 564 }
560 | enum_spec { 565 | enum_spec {
561 popdecl(); 566 popdecl();
562 $$ = $1; 567 $$ = $1;
563 } 568 }
564 ; 569 ;
565 570
566struct_spec: 571struct_spec:
567 struct struct_tag { 572 struct struct_tag {
568 /* 573 /*
@@ -1722,26 +1727,29 @@ term: @@ -1722,26 +1727,29 @@ term:
1722 } 1727 }
1723 | T_REAL term { 1728 | T_REAL term {
1724 $$ = build(REAL, $2, NULL); 1729 $$ = build(REAL, $2, NULL);
1725 } 1730 }
1726 | T_IMAG term { 1731 | T_IMAG term {
1727 $$ = build(IMAG, $2, NULL); 1732 $$ = build(IMAG, $2, NULL);
1728 } 1733 }
1729 | T_REAL T_LPARN term T_RPARN { 1734 | T_REAL T_LPARN term T_RPARN {
1730 $$ = build(REAL, $3, NULL); 1735 $$ = build(REAL, $3, NULL);
1731 } 1736 }
1732 | T_IMAG T_LPARN term T_RPARN { 1737 | T_IMAG T_LPARN term T_RPARN {
1733 $$ = build(IMAG, $3, NULL); 1738 $$ = build(IMAG, $3, NULL);
1734 } 1739 }
 1740 | T_EXTENSION T_LPARN term T_RPARN {
 1741 $$ = $3;
 1742 }
1735 | T_SIZEOF term %prec T_SIZEOF { 1743 | T_SIZEOF term %prec T_SIZEOF {
1736 if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL) 1744 if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
1737 chkmisc($2, 0, 0, 0, 0, 0, 1); 1745 chkmisc($2, 0, 0, 0, 0, 0, 1);
1738 } 1746 }
1739 | T_SIZEOF T_LPARN type_name T_RPARN %prec T_SIZEOF { 1747 | T_SIZEOF T_LPARN type_name T_RPARN %prec T_SIZEOF {
1740 $$ = bldszof($3); 1748 $$ = bldszof($3);
1741 } 1749 }
1742 | T_ALIGNOF T_LPARN type_name T_RPARN %prec T_ALIGNOF { 1750 | T_ALIGNOF T_LPARN type_name T_RPARN %prec T_ALIGNOF {
1743 $$ = bldalof($3); 1751 $$ = bldalof($3);
1744 } 1752 }
1745 | T_LPARN type_name T_RPARN term %prec T_UNOP { 1753 | T_LPARN type_name T_RPARN term %prec T_UNOP {
1746 $$ = cast($4, $2); 1754 $$ = cast($4, $2);
1747 } 1755 }

cvs diff -r1.46 -r1.47 src/usr.bin/xlint/lint1/err.c (expand / switch to unified diff)

--- src/usr.bin/xlint/lint1/err.c 2013/04/19 17:43:05 1.46
+++ src/usr.bin/xlint/lint1/err.c 2014/02/18 22:01:36 1.47
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: err.c,v 1.46 2013/04/19 17:43:05 christos Exp $ */ 1/* $NetBSD: err.c,v 1.47 2014/02/18 22:01:36 christos 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,27 +27,27 @@ @@ -27,27 +27,27 @@
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: err.c,v 1.46 2013/04/19 17:43:05 christos Exp $"); 40__RCSID("$NetBSD: err.c,v 1.47 2014/02/18 22:01:36 christos Exp $");
41#endif 41#endif
42 42
43#include <sys/types.h> 43#include <sys/types.h>
44#include <stdlib.h> 44#include <stdlib.h>
45#include <stdarg.h> 45#include <stdarg.h>
46 46
47#include "lint1.h" 47#include "lint1.h"
48 48
49/* number of errors found */ 49/* number of errors found */
50int nerr; 50int nerr;
51 51
52/* number of syntax errors */ 52/* number of syntax errors */
53int sytxerr; 53int sytxerr;
@@ -198,27 +198,27 @@ const char *msgs[] = { @@ -198,27 +198,27 @@ const char *msgs[] = {
198 "cannot do pointer arithmetic on operand of unknown size", /* 136 */ 198 "cannot do pointer arithmetic on operand of unknown size", /* 136 */
199 "use of incomplete enum type, op %s", /* 137 */ 199 "use of incomplete enum type, op %s", /* 137 */
200 "unknown operand size, op %s", /* 138 */ 200 "unknown operand size, op %s", /* 138 */
201 "division by 0", /* 139 */ 201 "division by 0", /* 139 */
202 "modulus by 0", /* 140 */ 202 "modulus by 0", /* 140 */
203 "integer overflow detected, op %s", /* 141 */ 203 "integer overflow detected, op %s", /* 141 */
204 "floating point overflow detected, op %s", /* 142 */ 204 "floating point overflow detected, op %s", /* 142 */
205 "cannot take size/alignment of incomplete type", /* 143 */ 205 "cannot take size/alignment of incomplete type", /* 143 */
206 "cannot take size/alignment of function", /* 144 */ 206 "cannot take size/alignment of function", /* 144 */
207 "cannot take size/alignment of bit-field", /* 145 */ 207 "cannot take size/alignment of bit-field", /* 145 */
208 "cannot take size/alignment of void", /* 146 */ 208 "cannot take size/alignment of void", /* 146 */
209 "invalid cast expression", /* 147 */ 209 "invalid cast expression", /* 147 */
210 "improper cast of void expression", /* 148 */ 210 "improper cast of void expression", /* 148 */
211 "illegal function", /* 149 */ 211 "illegal function (type %s)", /* 149 */
212 "argument mismatch: %d arg%s passed, %d expected", /* 150 */ 212 "argument mismatch: %d arg%s passed, %d expected", /* 150 */
213 "void expressions may not be arguments, arg #%d", /* 151 */ 213 "void expressions may not be arguments, arg #%d", /* 151 */
214 "argument cannot have unknown size, arg #%d", /* 152 */ 214 "argument cannot have unknown size, arg #%d", /* 152 */
215 "argument has incompatible pointer type, arg #%d (%s != %s)", /* 153 */ 215 "argument has incompatible pointer type, arg #%d (%s != %s)", /* 153 */
216 "illegal combination of pointer and integer, arg #%d", /* 154 */ 216 "illegal combination of pointer and integer, arg #%d", /* 154 */
217 "argument is incompatible with prototype, arg #%d", /* 155 */ 217 "argument is incompatible with prototype, arg #%d", /* 155 */
218 "enum type mismatch, arg #%d", /* 156 */ 218 "enum type mismatch, arg #%d", /* 156 */
219 "ANSI C treats constant as unsigned", /* 157 */ 219 "ANSI C treats constant as unsigned", /* 157 */
220 "%s may be used before set", /* 158 */ 220 "%s may be used before set", /* 158 */
221 "assignment in conditional context", /* 159 */ 221 "assignment in conditional context", /* 159 */
222 "operator '==' found where '=' was expected", /* 160 */ 222 "operator '==' found where '=' was expected", /* 160 */
223 "constant in conditional context", /* 161 */ 223 "constant in conditional context", /* 161 */
224 "comparison of %s with %s, op %s", /* 162 */ 224 "comparison of %s with %s, op %s", /* 162 */

cvs diff -r1.53 -r1.54 src/usr.bin/xlint/lint1/scan.l (expand / switch to unified diff)

--- src/usr.bin/xlint/lint1/scan.l 2013/10/18 20:46:09 1.53
+++ src/usr.bin/xlint/lint1/scan.l 2014/02/18 22:01:36 1.54
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1%{ 1%{
2/* $NetBSD: scan.l,v 1.53 2013/10/18 20:46:09 christos Exp $ */ 2/* $NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. 5 * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
6 * Copyright (c) 1994, 1995 Jochen Pohl 6 * Copyright (c) 1994, 1995 Jochen Pohl
7 * All Rights Reserved. 7 * All Rights Reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37#if defined(__RCSID) && !defined(lint) 37#if defined(__RCSID) && !defined(lint)
38__RCSID("$NetBSD: scan.l,v 1.53 2013/10/18 20:46:09 christos Exp $"); 38__RCSID("$NetBSD: scan.l,v 1.54 2014/02/18 22:01:36 christos Exp $");
39#endif 39#endif
40 40
41#include <stdlib.h> 41#include <stdlib.h>
42#include <string.h> 42#include <string.h>
43#include <limits.h> 43#include <limits.h>
44#include <float.h> 44#include <float.h>
45#include <ctype.h> 45#include <ctype.h>
46#include <errno.h> 46#include <errno.h>
47#include <math.h> 47#include <math.h>
48 48
49#include "lint1.h" 49#include "lint1.h"
50#include "cgram.h" 50#include "cgram.h"
51 51
@@ -220,52 +220,56 @@ static struct kwtab { @@ -220,52 +220,56 @@ static struct kwtab {
220 { "_Bool", T_TYPE, 0, BOOL, 0, 0, 1, 0 }, 220 { "_Bool", T_TYPE, 0, BOOL, 0, 0, 1, 0 },
221 { "case", T_CASE, 0, 0, 0, 0, 0, 0 }, 221 { "case", T_CASE, 0, 0, 0, 0, 0, 0 },
222 { "char", T_TYPE, 0, CHAR, 0, 0, 0, 0 }, 222 { "char", T_TYPE, 0, CHAR, 0, 0, 0, 0 },
223 { "const", T_QUAL, 0, 0, CONST, 1, 0, 0 }, 223 { "const", T_QUAL, 0, 0, CONST, 1, 0, 0 },
224 { "_Complex", T_TYPE, 0, COMPLEX,0, 0, 1, 0 }, 224 { "_Complex", T_TYPE, 0, COMPLEX,0, 0, 1, 0 },
225 { "__const__", T_QUAL, 0, 0, CONST, 0, 0, 0 }, 225 { "__const__", T_QUAL, 0, 0, CONST, 0, 0, 0 },
226 { "__const", T_QUAL, 0, 0, CONST, 0, 0, 0 }, 226 { "__const", T_QUAL, 0, 0, CONST, 0, 0, 0 },
227 { "continue", T_CONTINUE, 0, 0, 0, 0, 0, 0 }, 227 { "continue", T_CONTINUE, 0, 0, 0, 0, 0, 0 },
228 { "default", T_DEFAULT, 0, 0, 0, 0, 0, 0 }, 228 { "default", T_DEFAULT, 0, 0, 0, 0, 0, 0 },
229 { "do", T_DO, 0, 0, 0, 0, 0, 0 }, 229 { "do", T_DO, 0, 0, 0, 0, 0, 0 },
230 { "double", T_TYPE, 0, DOUBLE, 0, 0, 0, 0 }, 230 { "double", T_TYPE, 0, DOUBLE, 0, 0, 0, 0 },
231 { "else", T_ELSE, 0, 0, 0, 0, 0, 0 }, 231 { "else", T_ELSE, 0, 0, 0, 0, 0, 0 },
232 { "enum", T_ENUM, 0, 0, 0, 0, 0, 0 }, 232 { "enum", T_ENUM, 0, 0, 0, 0, 0, 0 },
 233 { "__extension__", T_EXTENSION, 0, 0, 0, 0, 0, 1 },
233 { "extern", T_SCLASS, EXTERN, 0, 0, 0, 0, 0 }, 234 { "extern", T_SCLASS, EXTERN, 0, 0, 0, 0, 0 },
234 { "float", T_TYPE, 0, FLOAT, 0, 0, 0, 0 }, 235 { "float", T_TYPE, 0, FLOAT, 0, 0, 0, 0 },
235 { "for", T_FOR, 0, 0, 0, 0, 0, 0 }, 236 { "for", T_FOR, 0, 0, 0, 0, 0, 0 },
236 { "goto", T_GOTO, 0, 0, 0, 0, 0, 0 }, 237 { "goto", T_GOTO, 0, 0, 0, 0, 0, 0 },
237 { "if", T_IF, 0, 0, 0, 0, 0, 0 }, 238 { "if", T_IF, 0, 0, 0, 0, 0, 0 },
238 { "__imag__", T_IMAG, 0, 0, 0, 0, 1, 0 }, 239 { "__imag__", T_IMAG, 0, 0, 0, 0, 1, 0 },
239 { "inline", T_SCLASS, INLINE, 0, 0, 0, 1, 0 }, 240 { "inline", T_SCLASS, INLINE, 0, 0, 0, 1, 0 },
240 { "__inline__", T_SCLASS, INLINE, 0, 0, 0, 0, 0 }, 241 { "__inline__", T_SCLASS, INLINE, 0, 0, 0, 0, 0 },
241 { "__inline", T_SCLASS, INLINE, 0, 0, 0, 0, 0 }, 242 { "__inline", T_SCLASS, INLINE, 0, 0, 0, 0, 0 },
242 { "int", T_TYPE, 0, INT, 0, 0, 0, 0 }, 243 { "int", T_TYPE, 0, INT, 0, 0, 0, 0 },
243 { "__symbolrename", T_SYMBOLRENAME, 0, 0, 0, 0, 0, 0 }, 244 { "__symbolrename", T_SYMBOLRENAME, 0, 0, 0, 0, 0, 0 },
244 { "long", T_TYPE, 0, LONG, 0, 0, 0, 0 }, 245 { "long", T_TYPE, 0, LONG, 0, 0, 0, 0 },
245 { "__real__", T_REAL, 0, 0, 0, 0, 1, 0 }, 246 { "__real__", T_REAL, 0, 0, 0, 0, 1, 0 },
246 { "register", T_SCLASS, REG, 0, 0, 0, 0, 0 }, 247 { "register", T_SCLASS, REG, 0, 0, 0, 0, 0 },
247 { "restrict", T_QUAL, 0, 0, RESTRICT, 0, 1, 0 }, 248 { "restrict", T_QUAL, 0, 0, RESTRICT, 0, 1, 0 },
248 { "return", T_RETURN, 0, 0, 0, 0, 0, 0 }, 249 { "return", T_RETURN, 0, 0, 0, 0, 0, 0 },
249 { "__packed", T_PACKED, 0, 0, 0, 0, 0, 0 }, 250 { "__packed", T_PACKED, 0, 0, 0, 0, 0, 0 },
250 { "short", T_TYPE, 0, SHORT, 0, 0, 0, 0 }, 251 { "short", T_TYPE, 0, SHORT, 0, 0, 0, 0 },
251 { "signed", T_TYPE, 0, SIGNED, 0, 1, 0, 0 }, 252 { "signed", T_TYPE, 0, SIGNED, 0, 1, 0, 0 },
252 { "__signed__", T_TYPE, 0, SIGNED, 0, 0, 0, 0 }, 253 { "__signed__", T_TYPE, 0, SIGNED, 0, 0, 0, 0 },
253 { "__signed", T_TYPE, 0, SIGNED, 0, 0, 0, 0 }, 254 { "__signed", T_TYPE, 0, SIGNED, 0, 0, 0, 0 },
254 { "sizeof", T_SIZEOF, 0, 0, 0, 0, 0, 0 }, 255 { "sizeof", T_SIZEOF, 0, 0, 0, 0, 0, 0 },
255 { "static", T_SCLASS, STATIC, 0, 0, 0, 0, 0 }, 256 { "static", T_SCLASS, STATIC, 0, 0, 0, 0, 0 },
256 { "struct", T_SOU, 0, STRUCT, 0, 0, 0, 0 }, 257 { "struct", T_SOU, 0, STRUCT, 0, 0, 0, 0 },
257 { "switch", T_SWITCH, 0, 0, 0, 0, 0, 0 }, 258 { "switch", T_SWITCH, 0, 0, 0, 0, 0, 0 },
258 { "typedef", T_SCLASS, TYPEDEF, 0, 0, 0, 0, 0 }, 259 { "typedef", T_SCLASS, TYPEDEF, 0, 0, 0, 0, 0 },
 260 { "typeof", T_TYPEOF, 0, 0, 0, 0, 0, 1 },
 261 { "__typeof", T_TYPEOF, 0, 0, 0, 0, 0, 1 },
 262 { "__typeof__", T_TYPEOF, 0, 0, 0, 0, 0, 1 },
259 { "union", T_SOU, 0, UNION, 0, 0, 0, 0 }, 263 { "union", T_SOU, 0, UNION, 0, 0, 0, 0 },
260 { "unsigned", T_TYPE, 0, UNSIGN, 0, 0, 0, 0 }, 264 { "unsigned", T_TYPE, 0, UNSIGN, 0, 0, 0, 0 },
261 { "void", T_TYPE, 0, VOID, 0, 0, 0, 0 }, 265 { "void", T_TYPE, 0, VOID, 0, 0, 0, 0 },
262 { "volatile", T_QUAL, 0, 0, VOLATILE, 1, 0, 0 }, 266 { "volatile", T_QUAL, 0, 0, VOLATILE, 1, 0, 0 },
263 { "__volatile__", T_QUAL, 0, 0, VOLATILE, 0, 0, 0 }, 267 { "__volatile__", T_QUAL, 0, 0, VOLATILE, 0, 0, 0 },
264 { "__volatile", T_QUAL, 0, 0, VOLATILE, 0, 0, 0 }, 268 { "__volatile", T_QUAL, 0, 0, VOLATILE, 0, 0, 0 },
265 { "while", T_WHILE, 0, 0, 0, 0, 0, 0 }, 269 { "while", T_WHILE, 0, 0, 0, 0, 0, 0 },
266 { NULL, 0, 0, 0, 0, 0, 0, 0 } 270 { NULL, 0, 0, 0, 0, 0, 0, 0 }
267}; 271};
268 272
269/* Symbol table */ 273/* Symbol table */
270static sym_t *symtab[HSHSIZ1]; 274static sym_t *symtab[HSHSIZ1];
271 275

cvs diff -r1.74 -r1.75 src/usr.bin/xlint/lint1/tree.c (expand / switch to unified diff)

--- src/usr.bin/xlint/lint1/tree.c 2014/02/18 20:43:36 1.74
+++ src/usr.bin/xlint/lint1/tree.c 2014/02/18 22:01:36 1.75
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tree.c,v 1.74 2014/02/18 20:43:36 christos Exp $ */ 1/* $NetBSD: tree.c,v 1.75 2014/02/18 22:01:36 christos 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,27 +27,27 @@ @@ -27,27 +27,27 @@
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.74 2014/02/18 20:43:36 christos Exp $"); 40__RCSID("$NetBSD: tree.c,v 1.75 2014/02/18 22:01:36 christos Exp $");
41#endif 41#endif
42 42
43#include <stdlib.h> 43#include <stdlib.h>
44#include <string.h> 44#include <string.h>
45#include <float.h> 45#include <float.h>
46#include <limits.h> 46#include <limits.h>
47#include <math.h> 47#include <math.h>
48#include <signal.h> 48#include <signal.h>
49 49
50#include "lint1.h" 50#include "lint1.h"
51#include "cgram.h" 51#include "cgram.h"
52#include "externs1.h" 52#include "externs1.h"
53 53
@@ -3161,28 +3161,29 @@ funccall(tnode_t *func, tnode_t *args) @@ -3161,28 +3161,29 @@ funccall(tnode_t *func, tnode_t *args)
3161 fcop = CALL; 3161 fcop = CALL;
3162 } else { 3162 } else {
3163 fcop = ICALL; 3163 fcop = ICALL;
3164 } 3164 }
3165 3165
3166 /* 3166 /*
3167 * after cconv() func will always be a pointer to a function 3167 * after cconv() func will always be a pointer to a function
3168 * if it is a valid function designator. 3168 * if it is a valid function designator.
3169 */ 3169 */
3170 func = cconv(func); 3170 func = cconv(func);
3171 3171
3172 if (func->tn_type->t_tspec != PTR || 3172 if (func->tn_type->t_tspec != PTR ||
3173 func->tn_type->t_subt->t_tspec != FUNC) { 3173 func->tn_type->t_subt->t_tspec != FUNC) {
 3174 char buf[256];
3174 /* illegal function */ 3175 /* illegal function */
3175 error(149); 3176 error(149, tyname(buf, sizeof(buf), func->tn_type));
3176 return (NULL); 3177 return (NULL);
3177 } 3178 }
3178 3179
3179 args = chkfarg(func->tn_type->t_subt, args); 3180 args = chkfarg(func->tn_type->t_subt, args);
3180 3181
3181 ntn = mktnode(fcop, func->tn_type->t_subt->t_subt, func, args); 3182 ntn = mktnode(fcop, func->tn_type->t_subt->t_subt, func, args);
3182 3183
3183 return (ntn); 3184 return (ntn);
3184} 3185}
3185 3186
3186/* 3187/*
3187 * Check types of all function arguments and insert conversions, 3188 * Check types of all function arguments and insert conversions,
3188 * if necessary. 3189 * if necessary.