Sat May 2 16:10:49 2009 UTC ()
Add __alignof__.


(christos)
diff -r1.43 -r1.44 src/usr.bin/xlint/lint1/cgram.y
diff -r1.43 -r1.44 src/usr.bin/xlint/lint1/scan.l
diff -r1.41 -r1.42 src/usr.bin/xlint/lint1/err.c
diff -r1.26 -r1.27 src/usr.bin/xlint/lint1/externs1.h
diff -r1.58 -r1.59 src/usr.bin/xlint/lint1/tree.c

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

--- src/usr.bin/xlint/lint1/cgram.y 2009/05/01 22:03:36 1.43
+++ src/usr.bin/xlint/lint1/cgram.y 2009/05/02 16:10:49 1.44
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1%{ 1%{
2/* $NetBSD: cgram.y,v 1.43 2009/05/01 22:03:36 christos Exp $ */ 2/* $NetBSD: cgram.y,v 1.44 2009/05/02 16:10:49 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.43 2009/05/01 22:03:36 christos Exp $"); 38__RCSID("$NetBSD: cgram.y,v 1.44 2009/05/02 16:10:49 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,27 @@ static inline void RESTORE(const char *f @@ -120,26 +120,27 @@ 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_ALIGNOF
133%token <y_op> T_MULT 134%token <y_op> T_MULT
134%token <y_op> T_DIVOP 135%token <y_op> T_DIVOP
135%token <y_op> T_ADDOP 136%token <y_op> T_ADDOP
136%token <y_op> T_SHFTOP 137%token <y_op> T_SHFTOP
137%token <y_op> T_RELOP 138%token <y_op> T_RELOP
138%token <y_op> T_EQOP 139%token <y_op> T_EQOP
139%token <y_op> T_AND 140%token <y_op> T_AND
140%token <y_op> T_XOR 141%token <y_op> T_XOR
141%token <y_op> T_OR 142%token <y_op> T_OR
142%token <y_op> T_LOGAND 143%token <y_op> T_LOGAND
143%token <y_op> T_LOGOR 144%token <y_op> T_LOGOR
144%token T_QUEST 145%token T_QUEST
145%token T_COLON 146%token T_COLON
@@ -185,27 +186,27 @@ static inline void RESTORE(const char *f @@ -185,27 +186,27 @@ static inline void RESTORE(const char *f
185%left T_COMMA 186%left T_COMMA
186%right T_ASSIGN T_OPASS 187%right T_ASSIGN T_OPASS
187%right T_QUEST T_COLON 188%right T_QUEST T_COLON
188%left T_LOGOR 189%left T_LOGOR
189%left T_LOGAND 190%left T_LOGAND
190%left T_OR 191%left T_OR
191%left T_XOR 192%left T_XOR
192%left T_AND 193%left T_AND
193%left T_EQOP 194%left T_EQOP
194%left T_RELOP 195%left T_RELOP
195%left T_SHFTOP 196%left T_SHFTOP
196%left T_ADDOP 197%left T_ADDOP
197%left T_MULT T_DIVOP 198%left T_MULT T_DIVOP
198%right T_UNOP T_INCDEC T_SIZEOF T_REAL T_IMAG 199%right T_UNOP T_INCDEC T_SIZEOF T_ALIGNOF T_REAL T_IMAG
199%left T_LPARN T_LBRACK T_STROP 200%left T_LPARN T_LBRACK T_STROP
200 201
201%token <y_sb> T_NAME 202%token <y_sb> T_NAME
202%token <y_sb> T_TYPENAME 203%token <y_sb> T_TYPENAME
203%token <y_val> T_CON 204%token <y_val> T_CON
204%token <y_strg> T_STRING 205%token <y_strg> T_STRING
205 206
206%type <y_sym> func_decl 207%type <y_sym> func_decl
207%type <y_sym> notype_decl 208%type <y_sym> notype_decl
208%type <y_sym> type_decl 209%type <y_sym> type_decl
209%type <y_type> typespec 210%type <y_type> typespec
210%type <y_type> clrtyp_typespec 211%type <y_type> clrtyp_typespec
211%type <y_type> notype_typespec 212%type <y_type> notype_typespec
@@ -1684,26 +1685,29 @@ term: @@ -1684,26 +1685,29 @@ term:
1684 | T_REAL T_LPARN term T_RPARN { 1685 | T_REAL T_LPARN term T_RPARN {
1685 $$ = build(REAL, $3, NULL); 1686 $$ = build(REAL, $3, NULL);
1686 } 1687 }
1687 | T_IMAG T_LPARN term T_RPARN { 1688 | T_IMAG T_LPARN term T_RPARN {
1688 $$ = build(IMAG, $3, NULL); 1689 $$ = build(IMAG, $3, NULL);
1689 } 1690 }
1690 | T_SIZEOF term %prec T_SIZEOF { 1691 | T_SIZEOF term %prec T_SIZEOF {
1691 if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL) 1692 if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
1692 chkmisc($2, 0, 0, 0, 0, 0, 1); 1693 chkmisc($2, 0, 0, 0, 0, 0, 1);
1693 } 1694 }
1694 | T_SIZEOF T_LPARN type_name T_RPARN %prec T_SIZEOF { 1695 | T_SIZEOF T_LPARN type_name T_RPARN %prec T_SIZEOF {
1695 $$ = bldszof($3); 1696 $$ = bldszof($3);
1696 } 1697 }
 1698 | T_ALIGNOF T_LPARN type_name T_RPARN %prec T_ALIGNOF {
 1699 $$ = bldalof($3);
 1700 }
1697 | T_LPARN type_name T_RPARN term %prec T_UNOP { 1701 | T_LPARN type_name T_RPARN term %prec T_UNOP {
1698 $$ = cast($4, $2); 1702 $$ = cast($4, $2);
1699 } 1703 }
1700 | T_LPARN type_name T_RPARN %prec T_UNOP { 1704 | T_LPARN type_name T_RPARN %prec T_UNOP {
1701 sym_t *tmp = mktempsym($2); 1705 sym_t *tmp = mktempsym($2);
1702 idecl(tmp, 1, NULL); 1706 idecl(tmp, 1, NULL);
1703 } init_lbrace init_expr_list init_rbrace { 1707 } init_lbrace init_expr_list init_rbrace {
1704 if (!Sflag) 1708 if (!Sflag)
1705 gnuism(319); 1709 gnuism(319);
1706 $$ = getnnode(initsym, 0); 1710 $$ = getnnode(initsym, 0);
1707 } 1711 }
1708 ; 1712 ;
1709 1713

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

--- src/usr.bin/xlint/lint1/scan.l 2009/04/15 01:20:57 1.43
+++ src/usr.bin/xlint/lint1/scan.l 2009/05/02 16:10:49 1.44
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1%{ 1%{
2/* $NetBSD: scan.l,v 1.43 2009/04/15 01:20:57 christos Exp $ */ 2/* $NetBSD: scan.l,v 1.44 2009/05/02 16:10:49 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.43 2009/04/15 01:20:57 christos Exp $"); 38__RCSID("$NetBSD: scan.l,v 1.44 2009/05/02 16:10:49 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
@@ -183,26 +183,27 @@ badchar(int c) @@ -183,26 +183,27 @@ badchar(int c)
183 * Keywords. 183 * Keywords.
184 * During initialisation they are written to the symbol table. 184 * During initialisation they are written to the symbol table.
185 */ 185 */
186static struct kwtab { 186static struct kwtab {
187 const char *kw_name; /* keyword */ 187 const char *kw_name; /* keyword */
188 int kw_token; /* token returned by yylex() */ 188 int kw_token; /* token returned by yylex() */
189 scl_t kw_scl; /* storage class if kw_token T_SCLASS */ 189 scl_t kw_scl; /* storage class if kw_token T_SCLASS */
190 tspec_t kw_tspec; /* type spec. if kw_token T_TYPE or T_SOU */ 190 tspec_t kw_tspec; /* type spec. if kw_token T_TYPE or T_SOU */
191 tqual_t kw_tqual; /* type qual. fi kw_token T_QUAL */ 191 tqual_t kw_tqual; /* type qual. fi kw_token T_QUAL */
192 u_int kw_c89; /* c89 keyword */ 192 u_int kw_c89; /* c89 keyword */
193 u_int kw_c99; /* c99 keyword */ 193 u_int kw_c99; /* c99 keyword */
194 u_int kw_gcc; /* GCC keyword */ 194 u_int kw_gcc; /* GCC keyword */
195} kwtab[] = { 195} kwtab[] = {
 196 { "__alignof__",T_ALIGNOF, 0, 0, 0, 0, 0, 0 },
196 { "asm", T_ASM, 0, 0, 0, 0, 0, 1 }, 197 { "asm", T_ASM, 0, 0, 0, 0, 0, 1 },
197 { "__asm", T_ASM, 0, 0, 0, 0, 0, 0 }, 198 { "__asm", T_ASM, 0, 0, 0, 0, 0, 0 },
198 { "__asm__", T_ASM, 0, 0, 0, 0, 0, 0 }, 199 { "__asm__", T_ASM, 0, 0, 0, 0, 0, 0 },
199 { "auto", T_SCLASS, AUTO, 0, 0, 0, 0, 0 }, 200 { "auto", T_SCLASS, AUTO, 0, 0, 0, 0, 0 },
200 { "break", T_BREAK, 0, 0, 0, 0, 0, 0 }, 201 { "break", T_BREAK, 0, 0, 0, 0, 0, 0 },
201 { "_Bool", T_TYPE, 0, BOOL, 0, 0, 1, 0 }, 202 { "_Bool", T_TYPE, 0, BOOL, 0, 0, 1, 0 },
202 { "case", T_CASE, 0, 0, 0, 0, 0, 0 }, 203 { "case", T_CASE, 0, 0, 0, 0, 0, 0 },
203 { "char", T_TYPE, 0, CHAR, 0, 0, 0, 0 }, 204 { "char", T_TYPE, 0, CHAR, 0, 0, 0, 0 },
204 { "const", T_QUAL, 0, 0, CONST, 1, 0, 0 }, 205 { "const", T_QUAL, 0, 0, CONST, 1, 0, 0 },
205 { "_Complex", T_TYPE, 0, COMPLEX,0, 0, 1, 0 }, 206 { "_Complex", T_TYPE, 0, COMPLEX,0, 0, 1, 0 },
206 { "__const__", T_QUAL, 0, 0, CONST, 0, 0, 0 }, 207 { "__const__", T_QUAL, 0, 0, CONST, 0, 0, 0 },
207 { "__const", T_QUAL, 0, 0, CONST, 0, 0, 0 }, 208 { "__const", T_QUAL, 0, 0, CONST, 0, 0, 0 },
208 { "continue", T_CONTINUE, 0, 0, 0, 0, 0, 0 }, 209 { "continue", T_CONTINUE, 0, 0, 0, 0, 0, 0 },

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

--- src/usr.bin/xlint/lint1/err.c 2009/05/01 22:03:36 1.41
+++ src/usr.bin/xlint/lint1/err.c 2009/05/02 16:10:49 1.42
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: err.c,v 1.41 2009/05/01 22:03:36 christos Exp $ */ 1/* $NetBSD: err.c,v 1.42 2009/05/02 16:10:49 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.41 2009/05/01 22:03:36 christos Exp $"); 40__RCSID("$NetBSD: err.c,v 1.42 2009/05/02 16:10:49 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;
@@ -192,30 +192,30 @@ const char *msgs[] = { @@ -192,30 +192,30 @@ const char *msgs[] = {
192 "enum type mismatch, op %s", /* 130 */ 192 "enum type mismatch, op %s", /* 130 */
193 "conversion to '%s' may sign-extend incorrectly", /* 131 */ 193 "conversion to '%s' may sign-extend incorrectly", /* 131 */
194 "conversion from '%s' to '%s' may lose accuracy", /* 132 */ 194 "conversion from '%s' to '%s' may lose accuracy", /* 132 */
195 "conversion of pointer to '%s' loses bits", /* 133 */ 195 "conversion of pointer to '%s' loses bits", /* 133 */
196 "conversion of pointer to '%s' may lose bits", /* 134 */ 196 "conversion of pointer to '%s' may lose bits", /* 134 */
197 "possible pointer alignment problem", /* 135 */ 197 "possible pointer alignment problem", /* 135 */
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 of incomplete type", /* 143 */ 205 "cannot take size/alignment of incomplete type", /* 143 */
206 "cannot take size of function", /* 144 */ 206 "cannot take size/alignment of function", /* 144 */
207 "cannot take size of bit-field", /* 145 */ 207 "cannot take size/alignment of bit-field", /* 145 */
208 "cannot take size 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", /* 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 */

cvs diff -r1.26 -r1.27 src/usr.bin/xlint/lint1/externs1.h (expand / switch to unified diff)

--- src/usr.bin/xlint/lint1/externs1.h 2009/04/15 01:20:57 1.26
+++ src/usr.bin/xlint/lint1/externs1.h 2009/05/02 16:10:49 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: externs1.h,v 1.26 2009/04/15 01:20:57 christos Exp $ */ 1/* $NetBSD: externs1.h,v 1.27 2009/05/02 16:10:49 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.
@@ -190,26 +190,27 @@ extern void initmtab(void); @@ -190,26 +190,27 @@ extern void initmtab(void);
190extern type_t *incref(type_t *, tspec_t); 190extern type_t *incref(type_t *, tspec_t);
191extern type_t *tincref(type_t *, tspec_t); 191extern type_t *tincref(type_t *, tspec_t);
192extern tnode_t *getcnode(type_t *, val_t *); 192extern tnode_t *getcnode(type_t *, val_t *);
193extern tnode_t *getnnode(sym_t *, int); 193extern tnode_t *getnnode(sym_t *, int);
194extern tnode_t *getsnode(strg_t *); 194extern tnode_t *getsnode(strg_t *);
195extern sym_t *strmemb(tnode_t *, op_t, sym_t *); 195extern sym_t *strmemb(tnode_t *, op_t, sym_t *);
196extern tnode_t *build(op_t, tnode_t *, tnode_t *); 196extern tnode_t *build(op_t, tnode_t *, tnode_t *);
197extern tnode_t *cconv(tnode_t *); 197extern tnode_t *cconv(tnode_t *);
198extern int typeok(op_t, int, tnode_t *, tnode_t *); 198extern int typeok(op_t, int, tnode_t *, tnode_t *);
199extern tnode_t *promote(op_t, int, tnode_t *); 199extern tnode_t *promote(op_t, int, tnode_t *);
200extern tnode_t *convert(op_t, int, type_t *, tnode_t *); 200extern tnode_t *convert(op_t, int, type_t *, tnode_t *);
201extern void cvtcon(op_t, int, type_t *, val_t *, val_t *); 201extern void cvtcon(op_t, int, type_t *, val_t *, val_t *);
202extern tnode_t *bldszof(type_t *); 202extern tnode_t *bldszof(type_t *);
 203extern tnode_t *bldalof(type_t *);
203extern tnode_t *cast(tnode_t *, type_t *); 204extern tnode_t *cast(tnode_t *, type_t *);
204extern tnode_t *funcarg(tnode_t *, tnode_t *); 205extern tnode_t *funcarg(tnode_t *, tnode_t *);
205extern tnode_t *funccall(tnode_t *, tnode_t *); 206extern tnode_t *funccall(tnode_t *, tnode_t *);
206extern val_t *constant(tnode_t *, int); 207extern val_t *constant(tnode_t *, int);
207extern void expr(tnode_t *, int, int, int); 208extern void expr(tnode_t *, int, int, int);
208extern void chkmisc(tnode_t *, int, int, int, int, int, int); 209extern void chkmisc(tnode_t *, int, int, int, int, int, int);
209extern int conaddr(tnode_t *, sym_t **, ptrdiff_t *); 210extern int conaddr(tnode_t *, sym_t **, ptrdiff_t *);
210extern strg_t *catstrg(strg_t *, strg_t *); 211extern strg_t *catstrg(strg_t *, strg_t *);
211 212
212/* 213/*
213 * func.c 214 * func.c
214 */ 215 */
215extern sym_t *funcsym; 216extern sym_t *funcsym;

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

--- src/usr.bin/xlint/lint1/tree.c 2009/04/27 15:08:10 1.58
+++ src/usr.bin/xlint/lint1/tree.c 2009/05/02 16:10:49 1.59
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tree.c,v 1.58 2009/04/27 15:08:10 ginsbach Exp $ */ 1/* $NetBSD: tree.c,v 1.59 2009/05/02 16:10:49 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.58 2009/04/27 15:08:10 ginsbach Exp $"); 40__RCSID("$NetBSD: tree.c,v 1.59 2009/05/02 16:10:49 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
@@ -3088,26 +3088,75 @@ bldszof(type_t *tp) @@ -3088,26 +3088,75 @@ bldszof(type_t *tp)
3088 break; 3088 break;
3089 } 3089 }
3090 3090
3091#if SIZEOF_IS_ULONG 3091#if SIZEOF_IS_ULONG
3092 st = ULONG; 3092 st = ULONG;
3093#else 3093#else
3094 st = UINT; 3094 st = UINT;
3095#endif 3095#endif
3096 3096
3097 return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT))); 3097 return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT)));
3098} 3098}
3099 3099
3100/* 3100/*
 3101 */
 3102tnode_t *
 3103bldalof(type_t *tp)
 3104{
 3105 tspec_t st;
 3106
 3107 switch (tp->t_tspec) {
 3108 case ARRAY:
 3109 break;
 3110
 3111 case FUNC:
 3112 /* cannot take align of function */
 3113 error(144);
 3114 return 0;
 3115
 3116 case STRUCT:
 3117 case UNION:
 3118 if (incompl(tp)) {
 3119 /* cannot take align of incomplete type */
 3120 error(143);
 3121 return 0;
 3122 }
 3123 break;
 3124 case ENUM:
 3125 break;
 3126 default:
 3127 if (tp->t_isfield) {
 3128 /* cannot take align of bit-field */
 3129 error(145);
 3130 return 0;
 3131 }
 3132 if (tp->t_tspec == VOID) {
 3133 /* cannot take alignsize of void */
 3134 error(146);
 3135 return 0;
 3136 }
 3137 break;
 3138 }
 3139
 3140#if SIZEOF_IS_ULONG
 3141 st = ULONG;
 3142#else
 3143 st = UINT;
 3144#endif
 3145
 3146 return getinode(st, (int64_t)getbound(tp));
 3147}
 3148
 3149/*
3101 * Type casts. 3150 * Type casts.
3102 */ 3151 */
3103tnode_t * 3152tnode_t *
3104cast(tnode_t *tn, type_t *tp) 3153cast(tnode_t *tn, type_t *tp)
3105{ 3154{
3106 tspec_t nt, ot; 3155 tspec_t nt, ot;
3107 3156
3108 if (tn == NULL) 3157 if (tn == NULL)
3109 return (NULL); 3158 return (NULL);
3110 3159
3111 tn = cconv(tn); 3160 tn = cconv(tn);
3112 3161
3113 nt = tp->t_tspec; 3162 nt = tp->t_tspec;