| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | %{ | | 1 | %{ |
2 | /* $NetBSD: cgram.y,v 1.71 2015/07/28 17:56:56 christos Exp $ */ | | 2 | /* $NetBSD: cgram.y,v 1.72 2015/10/13 16:09:33 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.71 2015/07/28 17:56:56 christos Exp $"); | | 38 | __RCSID("$NetBSD: cgram.y,v 1.72 2015/10/13 16:09:33 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 | |
47 | extern char *yytext; | | 47 | extern 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 | */ |
| @@ -1962,27 +1962,27 @@ toicon(tnode_t *tn, int required) | | | @@ -1962,27 +1962,27 @@ toicon(tnode_t *tn, int required) |
1962 | | | 1962 | |
1963 | static void | | 1963 | static void |
1964 | idecl(sym_t *decl, int initflg, sbuf_t *renaming) | | 1964 | idecl(sym_t *decl, int initflg, sbuf_t *renaming) |
1965 | { | | 1965 | { |
1966 | char *s; | | 1966 | char *s; |
1967 | | | 1967 | |
1968 | initerr = 0; | | 1968 | initerr = 0; |
1969 | initsym = decl; | | 1969 | initsym = decl; |
1970 | | | 1970 | |
1971 | switch (dcs->d_ctx) { | | 1971 | switch (dcs->d_ctx) { |
1972 | case EXTERN: | | 1972 | case EXTERN: |
1973 | if (renaming != NULL) { | | 1973 | if (renaming != NULL) { |
1974 | if (decl->s_rename != NULL) | | 1974 | if (decl->s_rename != NULL) |
1975 | LERROR("idecl()"); | | 1975 | LERROR("idecl(rename)"); |
1976 | | | 1976 | |
1977 | s = getlblk(1, renaming->sb_len + 1); | | 1977 | s = getlblk(1, renaming->sb_len + 1); |
1978 | (void)memcpy(s, renaming->sb_name, renaming->sb_len + 1); | | 1978 | (void)memcpy(s, renaming->sb_name, renaming->sb_len + 1); |
1979 | decl->s_rename = s; | | 1979 | decl->s_rename = s; |
1980 | freeyyv(&renaming, T_NAME); | | 1980 | freeyyv(&renaming, T_NAME); |
1981 | } | | 1981 | } |
1982 | decl1ext(decl, initflg); | | 1982 | decl1ext(decl, initflg); |
1983 | break; | | 1983 | break; |
1984 | case ARG: | | 1984 | case ARG: |
1985 | if (renaming != NULL) { | | 1985 | if (renaming != NULL) { |
1986 | /* symbol renaming can't be used on function arguments */ | | 1986 | /* symbol renaming can't be used on function arguments */ |
1987 | error(310); | | 1987 | error(310); |
1988 | freeyyv(&renaming, T_NAME); | | 1988 | freeyyv(&renaming, T_NAME); |
| @@ -1990,27 +1990,27 @@ idecl(sym_t *decl, int initflg, sbuf_t * | | | @@ -1990,27 +1990,27 @@ idecl(sym_t *decl, int initflg, sbuf_t * |
1990 | } | | 1990 | } |
1991 | (void)decl1arg(decl, initflg); | | 1991 | (void)decl1arg(decl, initflg); |
1992 | break; | | 1992 | break; |
1993 | case AUTO: | | 1993 | case AUTO: |
1994 | if (renaming != NULL) { | | 1994 | if (renaming != NULL) { |
1995 | /* symbol renaming can't be used on automatic variables */ | | 1995 | /* symbol renaming can't be used on automatic variables */ |
1996 | error(311); | | 1996 | error(311); |
1997 | freeyyv(&renaming, T_NAME); | | 1997 | freeyyv(&renaming, T_NAME); |
1998 | break; | | 1998 | break; |
1999 | } | | 1999 | } |
2000 | decl1loc(decl, initflg); | | 2000 | decl1loc(decl, initflg); |
2001 | break; | | 2001 | break; |
2002 | default: | | 2002 | default: |
2003 | LERROR("idecl()"); | | 2003 | LERROR("idecl(%d)", dcs->d_ctx); |
2004 | } | | 2004 | } |
2005 | | | 2005 | |
2006 | if (initflg && !initerr) | | 2006 | if (initflg && !initerr) |
2007 | prepinit(); | | 2007 | prepinit(); |
2008 | } | | 2008 | } |
2009 | | | 2009 | |
2010 | /* | | 2010 | /* |
2011 | * Discard all input tokens up to and including the next | | 2011 | * Discard all input tokens up to and including the next |
2012 | * unmatched right paren | | 2012 | * unmatched right paren |
2013 | */ | | 2013 | */ |
2014 | static void | | 2014 | static void |
2015 | ignuptorp(void) | | 2015 | ignuptorp(void) |
2016 | { | | 2016 | { |