diff options
| author | Jack Palevich <jackpal@google.com> | 2009-07-16 14:30:33 -0700 |
|---|---|---|
| committer | Jack Palevich <jackpal@google.com> | 2009-07-16 14:30:33 -0700 |
| commit | ce105a908262c6cee2b0b81e7f212a6bcdbaa876 (patch) | |
| tree | 732c8848fd3e39407c9bb8a62b1a85415c996c25 /libacc | |
| parent | 588d2bdefe0d8a4ff3a5ad45afe1806aee022762 (diff) | |
| download | system_core-ce105a908262c6cee2b0b81e7f212a6bcdbaa876.tar.gz system_core-ce105a908262c6cee2b0b81e7f212a6bcdbaa876.tar.bz2 system_core-ce105a908262c6cee2b0b81e7f212a6bcdbaa876.zip | |
If the compile failed, return NULL from symbol lookups.
Diffstat (limited to 'libacc')
| -rw-r--r-- | libacc/acc.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libacc/acc.cpp b/libacc/acc.cpp index c527a96f..7da744a8 100644 --- a/libacc/acc.cpp +++ b/libacc/acc.cpp @@ -9,7 +9,6 @@ */ #include <ctype.h> -#include <dlfcn.h> #include <errno.h> #include <stdarg.h> #include <stdint.h> @@ -3266,6 +3265,7 @@ class Compiler : public ErrorSink { String mPragmas; int mPragmaStringCount; + int mCompileResult; static const int ALLOC_SIZE = 99999; @@ -3974,7 +3974,7 @@ class Compiler : public ErrorSink { int argCount = 0; while (tok != ')' && tok != EOF) { if (! varArgs && !pArgList) { - error ("Unexpected argument."); + error("Unexpected argument."); } expr(); Type* pTargetType; @@ -4002,7 +4002,7 @@ class Compiler : public ErrorSink { argCount += 1; } if (! varArgs && pArgList) { - error ("Expected more argument(s). Saw %d", argCount); + error("Expected more argument(s). Saw %d", argCount); } pGen->endFunctionCallArguments(pDecl, a, l); skip(')'); @@ -4685,6 +4685,7 @@ class Compiler : public ErrorSink { pGlobalBase = 0; pGen = 0; mPragmaStringCount = 0; + mCompileResult = 0; } void setArchitecture(const char* architecture) { @@ -4780,6 +4781,7 @@ public: result = -2; } } + mCompileResult = result; return result; } @@ -4827,10 +4829,12 @@ public: * If found, return its value. */ void* lookup(const char* name) { - tokenid_t tok = mTokenTable.intern(name, strlen(name)); - VariableInfo* pVariableInfo = VI(tok); - if (pVariableInfo) { - return pVariableInfo->pAddress; + if (mCompileResult == 0) { + tokenid_t tok = mTokenTable.intern(name, strlen(name)); + VariableInfo* pVariableInfo = VI(tok); + if (pVariableInfo) { + return pVariableInfo->pAddress; + } } return NULL; } |
