Skip to content

Commit

Permalink
Unused Method Fix
Browse files Browse the repository at this point in the history
My last fix included two changes to handle multiple instances of the
same object being included. One only fixed arrays of objects, the later
one actually handles all cases, but the first one interferes with the
second one, so I removed the first one and it resolved things.
Bumped to version 1.00.77
  • Loading branch information
reltham committed May 29, 2015
1 parent 492e8dc commit e0b9479
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
18 changes: 2 additions & 16 deletions PropellerCompiler/UnusedMethodUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,21 +336,6 @@ void InitUnusedMethodData()
s_nNumObjectNames = 0;
}

void AdvanceCompileIndex(unsigned char* pObject, int& nCompileIndex)
{
nCompileIndex++;

int nNextObjOffset = *((unsigned short *)pObject);
ObjectEntry* pObjectEntry = GetObject(pObject);
for (int i = 0; i < pObjectEntry->nObjectIndexCount; i++)
{
if (pObjectEntry->pIndexTable[i].offset >= nNextObjOffset)
{
AdvanceCompileIndex(&(pObject[pObjectEntry->pIndexTable[i].offset]), nCompileIndex);
}
}
}

void BuildTables(unsigned char* pObject, int indent, int& nCompileIndex)
{
#ifdef RPE_DEBUG
Expand All @@ -363,7 +348,6 @@ void BuildTables(unsigned char* pObject, int indent, int& nCompileIndex)
#ifdef RPE_DEBUG
printf("%sObject Already Added\n", &s_indent[MAX_INDENT-indent]);
#endif
AdvanceCompileIndex(pObject, nCompileIndex);
return;
}
nCompileIndex++;
Expand All @@ -381,6 +365,8 @@ void BuildTables(unsigned char* pObject, int indent, int& nCompileIndex)
#ifdef RPE_DEBUG
printf("%s Object Offset: %04d Vars Offset: %d\n", &s_indent[MAX_INDENT-indent], s_objects[nObject].pIndexTable[i].offset, s_objects[nObject].pIndexTable[i].vars);
#endif
// this skip logic here is to handle the case where there are multiple instances of the same object source included
// either as an array of objects or as separately named objects
bool bSkip = false;
for (int j = 0; j < i; j++)
{
Expand Down
7 changes: 1 addition & 6 deletions SpinSource/openspin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static bool s_bUnusedMethodElimination = false;
static void Banner(void)
{
fprintf(stdout, "Propeller Spin/PASM Compiler \'OpenSpin\' (c)2012-2015 Parallax Inc. DBA Parallax Semiconductor.\n");
fprintf(stdout, "Version 1.00.76 Compiled on %s %s\n",__DATE__, __TIME__);
fprintf(stdout, "Version 1.00.77 Compiled on %s %s\n",__DATE__, __TIME__);
}

/* Usage - display a usage message and exit */
Expand Down Expand Up @@ -320,11 +320,6 @@ bool CompileRecursively(char* pFilename, bool bQuiet, bool bFileTreeOutputOnly,
{
return false;
}
// advance compile index for multiple instances
if (s_pCompilerData->obj_instances[i] > 1)
{
nCompileIndex += s_pCompilerData->obj_instances[i] - 1;
}
}

// redo first pass on parent object
Expand Down

0 comments on commit e0b9479

Please sign in to comment.