aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bookmaker
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-12-20 14:53:21 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-21 20:56:30 +0000
commitf059e7ca181ad20fa94edea65c8bfd839eceab46 (patch)
tree94e232ea30ac3c6710adfc3812e125191caeea95 /tools/bookmaker
parente260c46bbfe0e15e5b3d4a964484cc07b161b59a (diff)
fix bookmaker return value
crosscheck in bookmaker allows discovery of multiple errors, but fails to return that an error occurred. Fix SkSurface so it is up to date with includes. Add include parameter name in SkSurface. Allow longer parameter descriptions. TBR=bsalomon@google.com,rmistry@google.com Docs-Preview: https://skia.org/?cl=88041 Bug: skia:6898 Change-Id: I9daf83f7f6753b3d1dc996a76e4693b3b8d6798c Reviewed-on: https://skia-review.googlesource.com/88041 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'tools/bookmaker')
-rw-r--r--tools/bookmaker/bookmaker.h2
-rw-r--r--tools/bookmaker/includeParser.cpp15
-rw-r--r--tools/bookmaker/includeWriter.cpp2
3 files changed, 16 insertions, 3 deletions
diff --git a/tools/bookmaker/bookmaker.h b/tools/bookmaker/bookmaker.h
index d4126cebd4..cb0e8dab16 100644
--- a/tools/bookmaker/bookmaker.h
+++ b/tools/bookmaker/bookmaker.h
@@ -1552,6 +1552,7 @@ public:
fInEnum = false;
fInFunction = false;
fInString = false;
+ fFailed = false;
}
void setBracketShortCuts(Bracket bracket) {
@@ -1728,6 +1729,7 @@ protected:
bool fInEnum;
bool fInFunction;
bool fInString;
+ bool fFailed;
typedef ParserCommon INHERITED;
};
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index cd6e9e3914..2846614d44 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -301,11 +301,13 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
def->fVisited = true;
} else {
SkDebugf("missing toString bmh: %s\n", fullName.c_str());
+ fFailed = true;
}
}
break;
} else {
SkDebugf("method macro differs from bmh: %s\n", fullName.c_str());
+ fFailed = true;
}
}
}
@@ -337,6 +339,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
}
if (!def) {
SkDebugf("method missing from bmh: %s\n", fullName.c_str());
+ fFailed = true;
break;
}
if (def->crossCheck2(token)) {
@@ -346,6 +349,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
}
} else {
SkDebugf("method differs from bmh: %s\n", fullName.c_str());
+ fFailed = true;
}
} break;
case MarkType::kComment:
@@ -382,6 +386,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
}
if (!def) {
SkDebugf("enum missing from bmh: %s\n", fullName.c_str());
+ fFailed = true;
break;
}
}
@@ -394,12 +399,14 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
}
if (MarkType::kCode != def->fMarkType) {
SkDebugf("enum code missing from bmh: %s\n", fullName.c_str());
+ fFailed = true;
break;
}
if (def->crossCheck(token)) {
def->fVisited = true;
} else {
- SkDebugf("enum differs from bmh: %s\n", def->fName.c_str());
+ SkDebugf("enum differs from bmh: %s\n", def->fName.c_str());
+ fFailed = true;
}
for (auto& child : token.fChildren) {
string constName = MarkType::kEnumClass == token.fMarkType ?
@@ -413,6 +420,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
if (!def) {
if (string::npos == child->fName.find("Legacy_")) {
SkDebugf("const missing from bmh: %s\n", constName.c_str());
+ fFailed = true;
}
} else {
def->fVisited = true;
@@ -424,6 +432,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
def->fVisited = true;
} else {
SkDebugf("member missing from bmh: %s\n", fullName.c_str());
+ fFailed = true;
}
break;
case MarkType::kTypedef:
@@ -431,6 +440,7 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
def->fVisited = true;
} else {
SkDebugf("typedef missing from bmh: %s\n", fullName.c_str());
+ fFailed = true;
}
break;
default:
@@ -448,11 +458,12 @@ bool IncludeParser::crossCheck(BmhParser& bmhParser) {
RootDefinition* root = &finder->second;
if (!root->dumpUnVisited(bmhParser.fSkip)) {
SkDebugf("some struct elements not found; struct finding in includeParser is missing\n");
+ fFailed = true;
}
SkDebugf("cross-checked %s\n", className.c_str());
}
bmhParser.fWroteOut = true;
- return true;
+ return !fFailed;
}
IClassDefinition* IncludeParser::defineClass(const Definition& includeDef,
diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp
index b18585f4bf..e8d86f0916 100644
--- a/tools/bookmaker/includeWriter.cpp
+++ b/tools/bookmaker/includeWriter.cpp
@@ -633,7 +633,7 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child)
this->indentToColumn(column);
int partLen = (int) (partEnd - partStart);
// FIXME : detect this earlier; assert if #Return is empty
- SkASSERT(partLen > 0 && partLen < 200);
+ SkASSERT(partLen > 0 && partLen < 300); // may assert if param desc is especially long
fIndent = column;
this->rewriteBlock(partLen, partStart, Phrase::kYes);
fIndent = saveIndent;