From a9937510fd549108ef9533b61533b540c9274052 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Sat, 13 Sep 2014 03:18:26 +0200 Subject: emulator/opengl/emugl: Remove ispointer field from types definitions. Change-Id: If8f42a739dce6d1ac4d737ee50c7d2d569004153 --- emulator/opengl/host/tools/emugen/TypeFactory.cpp | 35 ++++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'emulator/opengl/host/tools/emugen') 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()); -- cgit v1.2.3