diff options
| author | David 'Digit' Turner <digit@google.com> | 2014-09-13 03:18:26 +0200 |
|---|---|---|
| committer | bohu <bohu@google.com> | 2014-11-25 12:30:38 -0800 |
| commit | 6245007ac26a8d2049f241d8377e05bfa49fae8f (patch) | |
| tree | 3acb1726e2ad29843ca4469350043d54eb5b9751 /emulator/opengl/host/tools | |
| parent | e91e177f6d18193c7abb18dd4f79d08658fadf92 (diff) | |
| download | sdk-6245007ac26a8d2049f241d8377e05bfa49fae8f.zip sdk-6245007ac26a8d2049f241d8377e05bfa49fae8f.tar.gz sdk-6245007ac26a8d2049f241d8377e05bfa49fae8f.tar.bz2 | |
emulator/opengl/emugl: Remove ispointer field from types definitions.
Change-Id: I3b4b5510eb5d5cb379f7a498b58b4adb6417290b
Diffstat (limited to 'emulator/opengl/host/tools')
| -rw-r--r-- | emulator/opengl/host/tools/emugen/TypeFactory.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/emulator/opengl/host/tools/emugen/TypeFactory.cpp b/emulator/opengl/host/tools/emugen/TypeFactory.cpp index 8884225..6646005 100644 --- a/emulator/opengl/host/tools/emugen/TypeFactory.cpp +++ b/emulator/opengl/host/tools/emugen/TypeFactory.cpp @@ -103,23 +103,30 @@ int TypeFactory::initFromFile(const std::string &filename) return -2; } + // The ispointer definition is optional since we can just + // look at the type name, and determine it is a pointer if + // it ends with '*'. + bool isPointer = (name[name.size() - 1U] == '*'); + pos = last + 1; std::string pointerDef; pointerDef = getNextToken(str, pos, &last, WHITESPACE); - if (pointerDef.size() == 0) { - fprintf(stderr, "Error: %d : missing ispointer definition\n", lc); - return -2; - } - - bool isPointer=false; - if (std::string("true")==pointerDef) - isPointer = true; - else if (std::string("false")==pointerDef) - isPointer = false; - else - { - fprintf(stderr, "Error: %d : invalid isPointer definition, must be either \"true\" or \"false\"\n", lc); - return -2; + if (pointerDef.size() != 0) { + // Just a little sanity check. + if (std::string("true")==pointerDef) { + if (!isPointer) { + fprintf(stderr, "Error: %d: invalid isPointer definition: 'true' but name does not end with '*'!\n", lc); + return -2; + } + } else if (std::string("false")==pointerDef) { + if (isPointer) { + fprintf(stderr, "Error: %d: invalid isPointer definition: 'false' but name does end with '*'!\n", lc); + return -2; + } + } else { + fprintf(stderr, "Error: %d : invalid isPointer definition, must be either \"true\" or \"false\"\n", lc); + return -2; + } } VarConverter *v = getVarConverter(atoi(size.c_str())); |
