diff options
-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 |