diff options
| author | David 'Digit' Turner <digit@google.com> | 2014-09-13 03:18:26 +0200 |
|---|---|---|
| committer | David 'Digit' Turner <digit@google.com> | 2014-09-13 03:18:26 +0200 |
| commit | a9937510fd549108ef9533b61533b540c9274052 (patch) | |
| tree | 2f063e624598bf6adaf6c8ba36484931e2e4dfcf /emulator/opengl/host/tools/emugen | |
| parent | 60f24c2c943cdcbc12f20c4019650536991a8f04 (diff) | |
| download | sdk-a9937510fd549108ef9533b61533b540c9274052.tar.gz sdk-a9937510fd549108ef9533b61533b540c9274052.tar.bz2 sdk-a9937510fd549108ef9533b61533b540c9274052.zip | |
emulator/opengl/emugl: Remove ispointer field from types definitions.
Change-Id: If8f42a739dce6d1ac4d737ee50c7d2d569004153
Diffstat (limited to 'emulator/opengl/host/tools/emugen')
| -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 357d6b39c..7f495caac 100644 --- a/emulator/opengl/host/tools/emugen/TypeFactory.cpp +++ b/emulator/opengl/host/tools/emugen/TypeFactory.cpp @@ -85,23 +85,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; + } } size_t bitSize = atoi(size.c_str()); |
