Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unions nested inside structures are not parsed #37

Open
Labels
bugSomething isn't working
@RduMarais

Description

Hello everyone!
Thank you for maintaining this library, and fixing various bugs with the original library.
I am trying to parse headers with a anonymous union defined inside a struct :

typedef struct
{
 volatile union
 {
 volatile uint8_t u8;
 volatile uint16_t u16;
 volatile uint32_t u32;
 } PORT [32];
 uint32_t RESERVED0[864];
 volatile uint32_t TER;
 .....
} ITM_Type;

However, this union is not parsed as such, and i have no way of isolating the data allocated inside the union from the rest of the structure.
Output, printed as another C header gives :

typedef struct ITM_Type
{
 volatile uint8_t u8;
 volatile uint16_t u16;
 volatile uint32_t u32;
 PORT ;
 uint32_t RESERVED0;
 volatile uint32_t TER;
 .....
} ITM_Type;

As you can see the resulting memory allocated is not correct.

The output in json is :

{
 "headerFileName": "report_issue/input_union.h",
 "curClass": "",
 "classes": {
 "ITM_Type": {
 "nested_classes": [],
 "abstract": false,
 "final": false,
 "namespace": "",
 "using": {},
 "name": "ITM_Type",
 "bare_name": "<anon-struct-1>",
 "inherits": [],
 "filename": "report_issue/input_union.h",
 "line_number": 2,
 "methods": {
 "public": [],
 "protected": [],
 "private": []
 },
 "properties": {
 "public": [
 {
 "extern": false,
 "array": 0,
 "filename": "report_issue/input_union.h",
 "line_number": 6,
 "function_pointer": 0,
 "type": "volatile uint8_t",
 "name": "u8",
 "aliases": [
 "volatile"
 ],
 "typedef": null,
 "constant": 0,
 "constexpr": 0,
 "reference": 0,
 "pointer": 0,
 "static": 0,
 "typedefs": 0,
 "class": 0,
 "fundamental": 0,
 "unresolved": true,
 "namespace": "",
 "property_of_class": "<anon-struct-1>",
 "mutable": false,
 "raw_type": "volatile uint8_t"
 },
 {
 "extern": false,
 "array": 0,
 "filename": "report_issue/input_union.h",
 "line_number": 7,
 "function_pointer": 0,
 "type": "volatile uint16_t",
 "name": "u16",
 "aliases": [
 "volatile"
 ],
 "typedef": null,
 "constant": 0,
 "constexpr": 0,
 "reference": 0,
 "pointer": 0,
 "static": 0,
 "typedefs": 0,
 "class": 0,
 "fundamental": 0,
 "unresolved": true,
 "namespace": "",
 "property_of_class": "<anon-struct-1>",
 "mutable": false,
 "raw_type": "volatile uint16_t"
 },
 {
 "extern": false,
 "array": 0,
 "filename": "report_issue/input_union.h",
 "line_number": 8,
 "function_pointer": 0,
 "type": "volatile uint32_t",
 "name": "u32",
 "aliases": [
 "volatile"
 ],
 "typedef": null,
 "constant": 0,
 "constexpr": 0,
 "reference": 0,
 "pointer": 0,
 "static": 0,
 "typedefs": 0,
 "class": 0,
 "fundamental": 0,
 "unresolved": true,
 "namespace": "",
 "property_of_class": "<anon-struct-1>",
 "mutable": false,
 "raw_type": "volatile uint32_t"
 },
 {
 "extern": false,
 "array_size": "32",
 "array": 1,
 "filename": "report_issue/input_union.h",
 "line_number": 9,
 "function_pointer": 0,
 "type": "PORT",
 "name": "",
 "aliases": [
 "PORT"
 ],
 "typedef": null,
 "constant": 0,
 "constexpr": 0,
 "reference": 0,
 "pointer": 0,
 "static": 0,
 "typedefs": 0,
 "class": 0,
 "fundamental": 0,
 "unresolved": true,
 "namespace": "",
 "property_of_class": "<anon-struct-1>",
 "mutable": false,
 "raw_type": "PORT"
 },
 {
 "extern": false,
 "array_size": "864",
 "array": 1,
 "filename": "report_issue/input_union.h",
 "line_number": 10,
 "function_pointer": 0,
 "type": "uint32_t",
 "name": "RESERVED0",
 "aliases": [
 "uint32_t"
 ],
 "typedef": null,
 "constant": 0,
 "constexpr": 0,
 "reference": 0,
 "pointer": 0,
 "static": 0,
 "typedefs": 0,
 "class": 0,
 "fundamental": 0,
 "unresolved": true,
 "namespace": "",
 "property_of_class": "<anon-struct-1>",
 "mutable": false,
 "raw_type": "uint32_t"
 },
 {
 "extern": false,
 "array": 0,
 "filename": "report_issue/input_union.h",
 "line_number": 11,
 "function_pointer": 0,
 "type": "volatile uint32_t",
 "name": "TER",
 "aliases": [
 "volatile"
 ],
 "typedef": null,
 "constant": 0,
 "constexpr": 0,
 "reference": 0,
 "pointer": 0,
 "static": 0,
 "typedefs": 0,
 "class": 0,
 "fundamental": 0,
 "unresolved": true,
 "namespace": "",
 "property_of_class": "<anon-struct-1>",
 "mutable": false,
 "raw_type": "volatile uint32_t"
 },
 ],
 "protected": [],
 "private": []
 },
 "enums": {
 "public": [],
 "protected": [],
 "private": []
 },
 "typedefs": {
 "public": [],
 "protected": [],
 "private": []
 },
 "forward_declares": {
 "public": [],
 "protected": [],
 "private": []
 },
 "declaration_method": "struct"
 }
 },
 "functions": [],
 "pragmas": [],
 "defines": [],
 "includes": [],
 "headerFileNames": [
 "report_issue/input_union.h"
 ],
 "enums": [],
 "variables": [],
 "global_enums": {},
 "typedefs": {},
 "namespaces": [],
 "using": {}
}

Thanks in advance for any help

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /