Do all validation during validation phase.
When hidl-gen was originally written, validation occured
at two different times: parsing and generation.
Since then, hidl-gen was re-written to be a multi-pass compiler.
The basic phases are now (see main + AST::postParse):
parse, process, validate, generate
However, some validation still exists during the generation phase.
This validation code has been gradually cleaned up, but, here, I am
cleaning up all the rest.
By moving the code to validation, we are fixing several classes
of problems:
1. generate functions almost exclusively (except for the few exceptions
that this CL cleans up) always return status OK. We have a bunch of
data flow logic which exists solely to propagate "return OK". This
is just plain silly.
2. a large number of the returns from emit/generate functions are not
actually checked. We've had a several bugs from this and also many
CLs just to fix this when they've been discovered. This causes problems
where hidl-gen fails but nothing notices.
3. sometimes files are written before things are validated. This is
extremely frustrating and also the cause of other bugs. One common
case of this (while developing) is when updating makefiles, the hidl-gen
compiler complains something is wrong with an interface, but it has
already partially written new but invalid makefiles. This means that
they have to be manually fixed before another build can begin.
4. having status_t returns from generate functions indicates to someone
working on hidl-gen that they can return an error here, but they
should always return an error from the correct validation function.
Removing the ability to return ERROR makes sure that new errors are
caught/validated in the correct place. One instance in this CL of
this happening is that annotations are also checked on isHidlReserved
methods whereas before, these were incorrectly only checked on regular
methods.
(note, breaking text to avoid pinging these)
B ug: 65636464 (forward declarations, made this possible)
B ug: 34807779 (better tools for java compatibility, closer to being solved)
B ug: 32573681 (instance of 2 above).
Test: hidl's run_all_host_tests.sh
Merged-In: I8988e1fdf16e15b925c0a613122c41e6a41bd4dd
Change-Id: I8988e1fdf16e15b925c0a613122c41e6a41bd4dd
diff --git a/MemoryType.h b/MemoryType.h
index dd59b54..7bce55f 100644
--- a/MemoryType.h
+++ b/MemoryType.h
@@ -63,7 +63,7 @@
void getAlignmentAndSize(size_t *align, size_t *size) const override;
- status_t emitVtsTypeDeclarations(Formatter &out) const override;
+ void emitVtsTypeDeclarations(Formatter& out) const override;
};
} // namespace android