projects
/
cparser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0a1b4a6
)
K&R style parameter lists are not a prototype...
author
Matthias Braun
<matze@braunis.de>
Sat, 31 May 2008 07:49:41 +0000
(07:49 +0000)
committer
Matthias Braun
<matze@braunis.de>
Sat, 31 May 2008 07:49:41 +0000
(07:49 +0000)
[r19874]
parser.c
patch
|
blob
|
history
diff --git
a/parser.c
b/parser.c
index
a5e0d26
..
3ca86ca
100644
(file)
--- a/
parser.c
+++ b/
parser.c
@@
-4173,14
+4173,14
@@
static void parse_kr_declaration_list(declaration_t *declaration)
set_scope(&declaration->scope);
declaration_t *parameter = declaration->scope.declarations;
set_scope(&declaration->scope);
declaration_t *parameter = declaration->scope.declarations;
- for( ; parameter != NULL; parameter = parameter->next) {
+ for
( ; parameter != NULL; parameter = parameter->next) {
assert(parameter->parent_scope == NULL);
parameter->parent_scope = scope;
environment_push(parameter);
}
/* parse declaration list */
assert(parameter->parent_scope == NULL);
parameter->parent_scope = scope;
environment_push(parameter);
}
/* parse declaration list */
- while(is_declaration_specifier(&token, false)) {
+ while
(is_declaration_specifier(&token, false)) {
parse_declaration(finished_kr_declaration);
}
parse_declaration(finished_kr_declaration);
}
@@
-4191,7
+4191,6
@@
static void parse_kr_declaration_list(declaration_t *declaration)
/* update function type */
type_t *new_type = duplicate_type(type);
/* update function type */
type_t *new_type = duplicate_type(type);
- new_type->function.kr_style_parameters = false;
function_parameter_t *parameters = NULL;
function_parameter_t *last_parameter = NULL;
function_parameter_t *parameters = NULL;
function_parameter_t *last_parameter = NULL;
@@
-4229,7
+4228,11
@@
static void parse_kr_declaration_list(declaration_t *declaration)
}
last_parameter = function_parameter;
}
}
last_parameter = function_parameter;
}
+
+ /* § 6.9.1.7: A K&R style parameter list does NOT act as a function
+ * prototype */
new_type->function.parameters = parameters;
new_type->function.parameters = parameters;
+ new_type->function.unspecified_parameters = true;
type = typehash_insert(new_type);
if(type != new_type) {
type = typehash_insert(new_type);
if(type != new_type) {
@@
-4369,7
+4372,9
@@
static void parse_external_declaration(void)
/* § 6.7.5.3 (14) a function definition with () means no
* parameters (and not unspecified parameters) */
/* § 6.7.5.3 (14) a function definition with () means no
* parameters (and not unspecified parameters) */
- if(type->function.unspecified_parameters) {
+ if(type->function.unspecified_parameters
+ && type->function.parameters == NULL
+ && !type->function.kr_style_parameters) {
type_t *duplicate = duplicate_type(type);
duplicate->function.unspecified_parameters = false;
type_t *duplicate = duplicate_type(type);
duplicate->function.unspecified_parameters = false;