diff options
author | Steven Moreland <smoreland@google.com> | 2018-06-04 09:43:07 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-06-04 18:21:11 +0000 |
commit | a421b310a7ce6a2e839eaad65a70efb8026e482a (patch) | |
tree | 155f17a0c16ef52b5583acef5fab80f4abdd2cde | |
parent | fd184e8c951d7bbcfc06b82083d61f4880bf8b53 (diff) | |
download | hidl-a421b310a7ce6a2e839eaad65a70efb8026e482a.tar.gz |
Better error for doc_comment at the end of block.android-o-mr1-iot-release-1.0.1
Previous error:
ERROR: syntax error, unexpected '}' at ...
New error:
ERROR: Doc comments must preceed what they describe at ...
Bug: 78135149
Test: hidl_error_test
Change-Id: Id56e34a4beb33b0323eb86a85190be63ec3b135d
-rw-r--r-- | hidl-gen_y.yy | 5 | ||||
-rw-r--r-- | test/error_test/doc_comment_ends_block/1.0/IFoo.hal | 23 | ||||
-rw-r--r-- | test/error_test/doc_comment_ends_block/1.0/required_error | 1 |
3 files changed, 29 insertions, 0 deletions
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy index 1f7d1c69..515cf35c 100644 --- a/hidl-gen_y.yy +++ b/hidl-gen_y.yy @@ -339,6 +339,11 @@ doc_comments $1->merge($2); $$ = $1; } + | doc_comments '}' + { + std::cerr << "ERROR: Doc comments must preceed what they describe at " << @1 << "\n"; + YYERROR; + } ; valid_identifier diff --git a/test/error_test/doc_comment_ends_block/1.0/IFoo.hal b/test/error_test/doc_comment_ends_block/1.0/IFoo.hal new file mode 100644 index 00000000..26c768e2 --- /dev/null +++ b/test/error_test/doc_comment_ends_block/1.0/IFoo.hal @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package test.empty_generates@1.0; + +interface IFoo { + doFoo(); + /** + * Does foo! + */ +}; diff --git a/test/error_test/doc_comment_ends_block/1.0/required_error b/test/error_test/doc_comment_ends_block/1.0/required_error new file mode 100644 index 00000000..94c947a9 --- /dev/null +++ b/test/error_test/doc_comment_ends_block/1.0/required_error @@ -0,0 +1 @@ +Doc comments must preceed what they describe at
\ No newline at end of file |