Code::Blocks Forums

User forums => Help => Topic started by: scopaev on September 26, 2023, 05:02:07 pm

Title: Smartsense issue with bitwise struct pointing to a HW address
Post by: scopaev on September 26, 2023, 05:02:07 pm
Hi folks,
I was hoping someone could guide me in the direction of a solution.

When I assign hardware register addresses through a struct, CB is not sensing the new structure.  See example below.

Example:
  typedef struct FooStruct
  {
    uint8
      B0: 1,
      B1: 1,
      B2: 1,
      B3: 1,
      B4: 1,
      B5: 1,
      B6: 1,
      B7: 1;
  } foo_bits_t;
 
  foo_bits_t Var1;
  Var1.                                                                          // POPUP shows up with B0-B7  :D!                 

  foo_bits_t Var2 __attribute__((address(0x123)));
  Var2.                                                                          // NO POPUP  :(

 The extra stuff "__attribute__((address(0x123)))" seems to be causing issues with smartsense (I think that is what CB calls the awesome popup?).
Title: Re: Smartsense issue with bitwise struct pointing to a HW address
Post by: scopaev on September 27, 2023, 03:59:47 pm
I found another variance that is interesting.

foo_bits_t Var3[1] __attribute__((address(0x123)));
  Var3.                                                                              Works

So a plain variable confuses it, but an array is OK.
Title: Re: Smartsense issue with bitwise struct pointing to a HW address
Post by: stahta01 on September 27, 2023, 11:52:50 pm
Without the basic information you are not likely to get any help.

Code::Blocks version?

Which Code Completion (CC) are you using the old CC or the new clang CC?

What operating System (OS) are you using?

Note: I do not use CC; so, I cannot help anymore.

Tim S.
Title: Re: Smartsense issue with bitwise struct pointing to a HW address
Post by: scopaev on September 28, 2023, 05:45:07 am
Hi Tim, thanks for the reply.

CB 20.03
Code Completion 1.0 (Installed by default)
Windows 11

Does the CC have a way to add delimiters (looks like code completion is looking for "[ or ;"  after the variable name)?  In my case I would want to use a space " ".
How do I enable the new clang CC to see if it works?

Thanks for any guidance.