Skip to content

Comment lines placed after the last 'struct' field (in schema file) appear outside generated C language 'struct' definition #336

@o2cheretnyi

Description

@o2cheretnyi

Recently I've noticed that comments started with /// and placed in the end of struct definition (right after the last field of the struct and before closing } brace) appear outside C language struct definition after the schema file's been processed by flatcc. Please check following code snippets with reference example mymonster (file src/monster.fbs):

  ...

  struct Vec3 {
     /// Comment A
     x:float;
     /// Comment B
     y:float;
     /// Comment C
     z:float;
     /// Comment D
     /// Comment D1
  }

  ...

So, when flatcc processes mentioned schema file the following generated header file looses Comment D as well as Comment D1 in the struct definition. Lost comments can be found far outside the struct definition unfortunately:

...

struct MyGame_Sample_Vec3 {
    /**  Comment A */
    alignas(4) float x;
    /**  Comment B */
    alignas(4) float y;
    /**  Comment C */
    alignas(4) float z;
};
static_assert(sizeof(MyGame_Sample_Vec3_t) == 12, "struct size mismatch");
...
...
/**  Comment D
 *  Comment D1 */
struct MyGame_Sample_Monster_table { uint8_t unused__; };
...

Please help to fix this issue if it is not expected behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions