From d7fc5db067ba90852ed35fac4b15001a3e679092 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Thu, 10 Jul 2014 19:14:21 -0400 Subject: [PATCH] compiler/libec: (#316) Added missing edge on opaque structs --- compiler/bootstrap/libec/bootstrap/pass15.c | 11 +++++++++-- compiler/libec/src/pass15.ec | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index c7c4df9..1247c53 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -14692,7 +14692,7 @@ if(spec->__anon1.specifier == TYPED_OBJECT) struct Declarator * d = param->declarator; struct TypeName * newParam = (newParam = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), newParam->qualifiers = MkListOne(MkSpecifier(VOID)), newParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d), newParam); -if(d->type != 5) +if(!d || d->type != 5) __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*newParam->qualifiers), (((void *)0)), MkSpecifier(CONST)); FreeList(param->qualifiers, (void *)(FreeSpecifier)); param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))); @@ -14708,7 +14708,7 @@ struct Declarator * d = param->declarator; FreeList(param->qualifiers, (void *)(FreeSpecifier)); param->qualifiers = MkListOne(MkSpecifier(VOID)); -if(d->type != 5) +if(!d || d->type != 5) __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*param->qualifiers), (((void *)0)), MkSpecifier(CONST)); param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d); break; @@ -14729,6 +14729,13 @@ else if(spec->type == 1) { ProcessSpecifier(spec, isFunction, 1); } +else if((spec->type == 3 || spec->type == 4) && !spec->__anon1.__anon2.definitions && spec->__anon1.__anon2.id && spec->__anon1.__anon2.id->string) +{ +struct Declarator * d = param->declarator; + +if(!d || d->type != 5) +DeclareStruct(curExternal, spec->__anon1.__anon2.id->string, 0, 1); +} } } if(param->declarator) diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index 7b404b1..6eaa2bb 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -11735,7 +11735,7 @@ static void ProcessDeclarator(Declarator decl, bool isFunction) qualifiers = MkListOne(MkSpecifier(VOID)); declarator = MkDeclaratorPointer(MkPointer(null,null), d); }; - if(d.type != pointerDeclarator) + if(!d || d.type != pointerDeclarator) newParam.qualifiers->Insert(null, MkSpecifier(CONST)); FreeList(param.qualifiers, FreeSpecifier); @@ -11756,7 +11756,7 @@ static void ProcessDeclarator(Declarator decl, bool isFunction) FreeList(param.qualifiers, FreeSpecifier); param.qualifiers = MkListOne(MkSpecifier(VOID)); - if(d.type != pointerDeclarator) + if(!d || d.type != pointerDeclarator) param.qualifiers->Insert(null, MkSpecifier(CONST)); param.declarator = MkDeclaratorPointer(MkPointer(null,null), d); break; @@ -11777,6 +11777,12 @@ static void ProcessDeclarator(Declarator decl, bool isFunction) { ProcessSpecifier(spec, isFunction, true); } + else if((spec.type == structSpecifier || spec.type == unionSpecifier) && !spec.definitions && spec.id && spec.id.string) + { + Declarator d = param.declarator; + if(!d || d.type != pointerDeclarator) + DeclareStruct(curExternal, spec.id.string, false, true); + } } } -- 1.8.3.1