Changeset 11800


Ignore:
Timestamp:
Oct 30, 2018 3:45:37 PM (13 months ago)
Author:
Jonathan Kämpe
Message:

#5670 Removed some unnecessary and erroneous code. Added test for external function without inputs or outputs.

Location:
branches/dev-1637/Compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-1637/Compiler/ModelicaCBackEnd/src/jastadd/CCodeGen/CCodeGenExternalCeval.jrag

    r11777 r11800  
    246246     */
    247247    syn Collection<ExternalArgument> FExternalStmt.varsToSerialize() {
    248         if (!hasArg() && !hasReturnVar())
    249             return new ArrayList<ExternalArgument>(myCommonVarDecls());
    250        
    251248        Collection<ExternalArgument> res = new LinkedHashSet<>();
    252249        if (hasReturnVar()) {
     
    305302        }
    306303        return res;
    307     }
    308    
    309     /**
    310      * CommonVariableDecls from enclosing function
    311      */
    312     private ArrayList<CommonVariableDecl> FExternalStmt.myCommonVarDecls() {
    313         FFunctionDecl decl = containingFFunctionDecl();
    314         if (decl != null) {
    315             return new ArrayList<CommonVariableDecl>(decl.getFFunctionVariables().toArrayList());
    316         } else {
    317             ArrayList<CommonVariableDecl> res = new ArrayList<>();
    318             for (CommonVariableDecl cvd : enclosingInstClassDecl().allInstComponentDecls()) {
    319                 if (!cvd.variability().constantVariability()) {
    320                     res.add(cvd);
    321                 }
    322             }
    323             return res;
    324         }
    325304    }
    326305
  • branches/dev-1637/Compiler/ModelicaFrontEnd/test/modelica/FunctionTestsExternal.mo

    r10788 r11800  
    1717
    1818package FunctionTestsExternal
     19
     20model ExternalFuncEmpty1
     21 function f
     22 external;
     23 end f;
     24equation
     25 f();
     26
     27    annotation(__JModelica(UnitTesting(tests={
     28        FlatteningTestCase(
     29            name="ExternalFuncEmpty1",
     30            description="External functions: No IO",
     31            flatModel="
     32fclass FunctionTestsExternal.ExternalFuncEmpty1
     33equation
     34 FunctionTestsExternal.ExternalFuncEmpty1.f();
     35
     36public
     37 function FunctionTestsExternal.ExternalFuncEmpty1.f
     38 algorithm
     39  external \"C\" f();
     40  return;
     41 end FunctionTestsExternal.ExternalFuncEmpty1.f;
     42
     43end FunctionTestsExternal.ExternalFuncEmpty1;
     44")})));
     45end ExternalFuncEmpty1;
    1946
    2047model ExternalFunc1
Note: See TracChangeset for help on using the changeset viewer.