diff --git a/src/Type.cc b/src/Type.cc index 458a672d41..c770091ad6 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -848,8 +848,8 @@ void TypeDecl::DescribeReST(ODesc* d) const } CommentedTypeDecl::CommentedTypeDecl(BroType* t, const char* i, - attr_list* attrs, std::list* cmnt_list) - : TypeDecl(t, i, attrs) + attr_list* attrs, bool in_record, std::list* cmnt_list) + : TypeDecl(t, i, attrs, in_record) { comments = cmnt_list; } diff --git a/src/Type.h b/src/Type.h index 082e950921..b8cb7e2aa5 100644 --- a/src/Type.h +++ b/src/Type.h @@ -420,7 +420,7 @@ public: class CommentedTypeDecl : public TypeDecl { public: CommentedTypeDecl(BroType* t, const char* i, attr_list* attrs = 0, - std::list* cmnt_list = 0); + bool in_record = false, std::list* cmnt_list = 0); virtual ~CommentedTypeDecl(); void DescribeReST(ODesc* d) const; diff --git a/src/parse.y b/src/parse.y index 288b6c4cfe..a31b47b0bd 100644 --- a/src/parse.y +++ b/src/parse.y @@ -936,6 +936,7 @@ type_decl: if ( generate_documentation ) { + // TypeDecl ctor deletes the attr list, so make a copy attr_list* a = $5; attr_list* a_copy = 0; @@ -947,7 +948,7 @@ type_decl: } last_fake_type_decl = new CommentedTypeDecl( - $4, $2, a_copy, concat_opt_docs($1, $7)); + $4, $2, a_copy, (in_record > 0), concat_opt_docs($1, $7)); } $$ = new TypeDecl($4, $2, $5, (in_record > 0)); diff --git a/testing/btest/doc/record-attr-check.bro b/testing/btest/doc/record-attr-check.bro new file mode 100644 index 0000000000..33ada44bfd --- /dev/null +++ b/testing/btest/doc/record-attr-check.bro @@ -0,0 +1,9 @@ +# @TEST-EXEC: bro --doc-scripts %INPUT + +type Tag: enum { + SOMETHING +}; + +type R: record { + field1: set[Tag] &default=set(); +};