Skip to content

Commit 9c1c04c

Browse files
author
Daniel Kroening
authored
Merge pull request #142 from tautschnig/knr-function-pointers
Parse KnR functions returning function pointers
2 parents d2bdad9 + 2a1530d commit 9c1c04c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

regression/ansi-c/KnR3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33

44
^EXIT=0$

src/ansi-c/parser.y

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3134,14 +3134,20 @@ parameter_postfixing_abstract_declarator:
31343134
id2string(PARSER.current_scope().last_declarator)+"::");
31353135
}
31363136
parameter_type_list
3137-
')'
3137+
')' KnR_parameter_header_opt
31383138
{
31393139
$$=$1;
31403140
set($$, ID_code);
31413141
stack_type($$).subtype()=typet(ID_abstract);
31423142
stack_type($$).add(ID_parameters).get_sub().
31433143
swap((irept::subt &)(stack_type($3).subtypes()));
31443144
PARSER.pop_scope();
3145+
3146+
if(stack($5).is_not_nil())
3147+
{
3148+
adjust_KnR_parameters(stack($$).add(ID_parameters), stack($5));
3149+
stack($$).set(ID_C_KnR, true);
3150+
}
31453151
}
31463152
;
31473153

0 commit comments

Comments
 (0)