1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-02 00:41:42 +00:00

- Fixing setting exported and imported globals as volatile method...

Now using the directives approach at pass0 instead of in VariableBuilder.
This commit is contained in:
Sven Van de Velde 2024-01-02 21:14:21 +01:00
parent fab740f797
commit f2b5d160a8
2 changed files with 9 additions and 2 deletions

View File

@ -107,7 +107,6 @@ public class Variable implements Symbol {
if(asmLibraryName != null) {
this.asmExportLibrary = new AsmIdentifier(asmLibraryName);
setExport(true);
setOptimize(false);
setDeclarationOnly(false);
}
}
@ -117,7 +116,6 @@ public class Variable implements Symbol {
this.asmImportLibrary = new AsmIdentifier(asmLibraryName);
setExport(false);
setDeclarationOnly(false);
setOptimize(false);
}
}

View File

@ -1144,6 +1144,14 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
} else if(directive instanceof Directive.Const) {
// Type-qualifier directive const
this.declType = this.declType.getQualified(this.declType.isVolatile(), true);
} else if(directive instanceof Directive.AsmExportDirective) {
// Type-qualifier directive volatile
this.declDirectives.add(directive);
this.declType = this.declType.getQualified(true, this.declType.isNomodify());
} else if(directive instanceof Directive.AsmImportDirective) {
// Type-qualifier directive volatile
this.declDirectives.add(directive);
this.declType = this.declType.getQualified(true, this.declType.isNomodify());
} else {
// variable directive
if(!this.declDirectives.contains(directive))
@ -1512,6 +1520,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
// if(asmExport == null) {
// throw new CompileError("__asm_export directive used before #pragma asm_library declaration.", new StatementSource(ctx));
// }
return new Directive.AsmExportDirective(asmExport);
}