Author Topic: struct within typedef'd struct  (Read 246 times)

joecar

  • Senior Community Member
  • Posts: 281
  • Hero Points: 9
  • engineer/gearhead
struct within typedef'd struct
« on: June 02, 2021, 09:55:34 pm »
Hi,

I'm seeing references to a struct within a typedef'd struct being marked as unknown symbol, see attached pic.

Code: [Select]
typedef struct lfs {
    lfs_cache_t rcache;
    lfs_cache_t pcache;

    struct lfs_mlist {
        struct lfs_mlist *next;
        uint16_t id;
        uint8_t type;
        lfs_mdir_t m;
    } *mlist;

    struct  {
        lfs_block_t off;
        lfs_block_t size;
        lfs_block_t i;
        lfs_block_t ack;
        uint32_t *buffer;
    } lfs_free;

    const struct lfs_config *cfg;
} lfs_t;

I'm using SE 25.0.2.

Thanks.
« Last Edit: June 02, 2021, 10:18:01 pm by joecar »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3276
  • Hero Points: 463
Re: struct within typedef'd struct
« Reply #1 on: June 03, 2021, 03:30:52 pm »
That is a difference between ANSI-C and C++ scoping.  You'll need to do a Document > Select Mode > ANSI-C for header files containing that sort of struct definition (then tickle the file and save it so it gets retagged).

joecar

  • Senior Community Member
  • Posts: 281
  • Hero Points: 9
  • engineer/gearhead
Re: struct within typedef'd struct
« Reply #2 on: June 04, 2021, 02:16:08 am »
Ok, thanks.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3276
  • Hero Points: 463
Re: struct within typedef'd struct
« Reply #3 on: June 11, 2021, 10:05:07 pm »
I found that there is also a problem with the ANSI-C parser with nested enums.

I am fixing that for the next release (v26), and also adding an option for the C/C++ tagging to treat nested structs and enums the way ANSI-C does.  That way, if you are working with mixed source, *and* you do not frequently nest structs/unions/enums within your C++ structs, you might be able to turn that option on and work fairly seamlessly, even if you have certain header files begin recognized in the wrong mode.

joecar

  • Senior Community Member
  • Posts: 281
  • Hero Points: 9
  • engineer/gearhead
Re: struct within typedef'd struct
« Reply #4 on: June 12, 2021, 01:27:28 am »
Thanks, that would help alot, I appreciate it.

  8)