Sat Jul 10 18:13:06 2021 UTC ()
lint: rename func_arg_list to align with C99

No functional change.


(rillig)
diff -r1.297 -r1.298 src/usr.bin/xlint/lint1/cgram.y

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

--- src/usr.bin/xlint/lint1/cgram.y 2021/07/10 17:46:55 1.297
+++ src/usr.bin/xlint/lint1/cgram.y 2021/07/10 18:13:06 1.298
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1%{ 1%{
2/* $NetBSD: cgram.y,v 1.297 2021/07/10 17:46:55 rillig Exp $ */ 2/* $NetBSD: cgram.y,v 1.298 2021/07/10 18:13:06 rillig 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.297 2021/07/10 17:46:55 rillig Exp $"); 38__RCSID("$NetBSD: cgram.y,v 1.298 2021/07/10 18:13:06 rillig Exp $");
39#endif 39#endif
40 40
41#include <limits.h> 41#include <limits.h>
42#include <stdlib.h> 42#include <stdlib.h>
43#include <string.h> 43#include <string.h>
44 44
45#include "lint1.h" 45#include "lint1.h"
46 46
47extern char *yytext; 47extern char *yytext;
48 48
49/* 49/*
50 * Contains the level of current declaration, used for symbol table entries. 50 * Contains the level of current declaration, used for symbol table entries.
51 * 0 is the top-level, > 0 is inside a function body. 51 * 0 is the top-level, > 0 is inside a function body.
@@ -319,27 +319,27 @@ anonymize(sym_t *s) @@ -319,27 +319,27 @@ anonymize(sym_t *s)
319%type <y_sym> identifier_list 319%type <y_sym> identifier_list
320%type <y_sym> abstract_declarator 320%type <y_sym> abstract_declarator
321%type <y_sym> direct_abstract_declarator 321%type <y_sym> direct_abstract_declarator
322%type <y_sym> direct_abstract_declarator_postfix 322%type <y_sym> direct_abstract_declarator_postfix
323%type <y_sym> vararg_parameter_type_list 323%type <y_sym> vararg_parameter_type_list
324%type <y_sym> parameter_type_list 324%type <y_sym> parameter_type_list
325%type <y_sym> parameter_declaration 325%type <y_sym> parameter_declaration
326%type <y_tnode> expr 326%type <y_tnode> expr
327%type <y_tnode> assignment_expression 327%type <y_tnode> assignment_expression
328%type <y_tnode> gcc_statement_expr_list 328%type <y_tnode> gcc_statement_expr_list
329%type <y_tnode> gcc_statement_expr_item 329%type <y_tnode> gcc_statement_expr_item
330%type <y_tnode> term 330%type <y_tnode> term
331%type <y_tnode> generic_selection 331%type <y_tnode> generic_selection
332%type <y_tnode> func_arg_list 332%type <y_tnode> argument_expression_list
333%type <y_op> point_or_arrow 333%type <y_op> point_or_arrow
334%type <y_type> type_name 334%type <y_type> type_name
335%type <y_sym> abstract_declaration 335%type <y_sym> abstract_declaration
336%type <y_tnode> expr_opt 336%type <y_tnode> expr_opt
337%type <y_string> string 337%type <y_string> string
338%type <y_string> string2 338%type <y_string> string2
339%type <y_name> asm_or_symbolrename_opt 339%type <y_name> asm_or_symbolrename_opt
340%type <y_range> range 340%type <y_range> range
341%type <y_seen_statement> block_item_list 341%type <y_seen_statement> block_item_list
342%type <y_seen_statement> block_item 342%type <y_seen_statement> block_item
343%type <y_generic> generic_assoc_list 343%type <y_generic> generic_assoc_list
344%type <y_generic> generic_association 344%type <y_generic> generic_association
345 345
@@ -1721,27 +1721,27 @@ term: /* see C99 6.5.1 */ @@ -1721,27 +1721,27 @@ term: /* see C99 6.5.1 */
1721 | T_ADDITIVE term { 1721 | T_ADDITIVE term {
1722 if (tflag && $1 == PLUS) { 1722 if (tflag && $1 == PLUS) {
1723 /* unary + is illegal in traditional C */ 1723 /* unary + is illegal in traditional C */
1724 warning(100); 1724 warning(100);
1725 } 1725 }
1726 $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL); 1726 $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL);
1727 } 1727 }
1728 | term T_LBRACK expr T_RBRACK { 1728 | term T_LBRACK expr T_RBRACK {
1729 $$ = build(INDIR, build(PLUS, $1, $3), NULL); 1729 $$ = build(INDIR, build(PLUS, $1, $3), NULL);
1730 } 1730 }
1731 | term T_LPAREN T_RPAREN { 1731 | term T_LPAREN T_RPAREN {
1732 $$ = new_function_call_node($1, NULL); 1732 $$ = new_function_call_node($1, NULL);
1733 } 1733 }
1734 | term T_LPAREN func_arg_list T_RPAREN { 1734 | term T_LPAREN argument_expression_list T_RPAREN {
1735 $$ = new_function_call_node($1, $3); 1735 $$ = new_function_call_node($1, $3);
1736 } 1736 }
1737 | term point_or_arrow T_NAME { 1737 | term point_or_arrow T_NAME {
1738 if ($1 != NULL) { 1738 if ($1 != NULL) {
1739 sym_t *msym; 1739 sym_t *msym;
1740 /* 1740 /*
1741 * XXX struct_or_union_member should be integrated 1741 * XXX struct_or_union_member should be integrated
1742 * in build() 1742 * in build()
1743 */ 1743 */
1744 if ($2 == ARROW) { 1744 if ($2 == ARROW) {
1745 /* 1745 /*
1746 * must do this before struct_or_union_member 1746 * must do this before struct_or_union_member
1747 * is called 1747 * is called
@@ -1814,26 +1814,35 @@ generic_assoc_list: /* C11 6.5.1.1 */ @@ -1814,26 +1814,35 @@ generic_assoc_list: /* C11 6.5.1.1 */
1814generic_association: /* C11 6.5.1.1 */ 1814generic_association: /* C11 6.5.1.1 */
1815 type_name T_COLON assignment_expression { 1815 type_name T_COLON assignment_expression {
1816 $$ = getblk(sizeof(*$$)); 1816 $$ = getblk(sizeof(*$$));
1817 $$->ga_arg = $1; 1817 $$->ga_arg = $1;
1818 $$->ga_result = $3; 1818 $$->ga_result = $3;
1819 } 1819 }
1820 | T_DEFAULT T_COLON assignment_expression { 1820 | T_DEFAULT T_COLON assignment_expression {
1821 $$ = getblk(sizeof(*$$)); 1821 $$ = getblk(sizeof(*$$));
1822 $$->ga_arg = NULL; 1822 $$->ga_arg = NULL;
1823 $$->ga_result = $3; 1823 $$->ga_result = $3;
1824 } 1824 }
1825 ; 1825 ;
1826 1826
 1827argument_expression_list: /* C99 6.5.2 */
 1828 expr %prec T_COMMA {
 1829 $$ = new_function_argument_node(NULL, $1);
 1830 }
 1831 | argument_expression_list T_COMMA expr {
 1832 $$ = new_function_argument_node($1, $3);
 1833 }
 1834 ;
 1835
1827/* 1836/*
1828 * The inner part of a GCC statement-expression of the form ({ ... }). 1837 * The inner part of a GCC statement-expression of the form ({ ... }).
1829 * 1838 *
1830 * https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html 1839 * https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
1831 */ 1840 */
1832gcc_statement_expr_list: 1841gcc_statement_expr_list:
1833 gcc_statement_expr_item 1842 gcc_statement_expr_item
1834 | gcc_statement_expr_list gcc_statement_expr_item { 1843 | gcc_statement_expr_list gcc_statement_expr_item {
1835 $$ = $2; 1844 $$ = $2;
1836 } 1845 }
1837 ; 1846 ;
1838 1847
1839gcc_statement_expr_item: 1848gcc_statement_expr_item:
@@ -1870,35 +1879,26 @@ string: @@ -1870,35 +1879,26 @@ string:
1870string2: 1879string2:
1871 T_STRING { 1880 T_STRING {
1872 if (tflag) { 1881 if (tflag) {
1873 /* concatenated strings are illegal in traditional C */ 1882 /* concatenated strings are illegal in traditional C */
1874 warning(219); 1883 warning(219);
1875 } 1884 }
1876 $$ = $1; 1885 $$ = $1;
1877 } 1886 }
1878 | string2 T_STRING { 1887 | string2 T_STRING {
1879 $$ = cat_strings($1, $2); 1888 $$ = cat_strings($1, $2);
1880 } 1889 }
1881 ; 1890 ;
1882 1891
1883func_arg_list: 
1884 expr %prec T_COMMA { 
1885 $$ = new_function_argument_node(NULL, $1); 
1886 } 
1887 | func_arg_list T_COMMA expr { 
1888 $$ = new_function_argument_node($1, $3); 
1889 } 
1890 ; 
1891 
1892point_or_arrow: 1892point_or_arrow:
1893 T_POINT { 1893 T_POINT {
1894 symtyp = FMEMBER; 1894 symtyp = FMEMBER;
1895 $$ = POINT; 1895 $$ = POINT;
1896 } 1896 }
1897 | T_ARROW { 1897 | T_ARROW {
1898 symtyp = FMEMBER; 1898 symtyp = FMEMBER;
1899 $$ = ARROW; 1899 $$ = ARROW;
1900 } 1900 }
1901 ; 1901 ;
1902 1902
1903identifier: /* C99 6.4.2.1 */ 1903identifier: /* C99 6.4.2.1 */
1904 T_NAME { 1904 T_NAME {