Author Topic: C-parsing broken (works well in v22.0.2.1 + se2202_12)  (Read 482 times)

at5dapa1

  • Senior Community Member
  • Posts: 175
  • Hero Points: 18
C-parsing broken (works well in v22.0.2.1 + se2202_12)
« on: September 27, 2018, 05:44:11 am »
I have a code example (strange macros I agree, but they come like this from a library so we have to use what we've got).
SE auto-completion works fine in v22.0.2.1, but not in beta v23.0.0.5 (Win7x64).
Normally I define the PACKSTRUCT in the Workspace Properties -> C/C++ Preprocessing, but now I added it in the test example itself, just to prove the behavior.
Please let me know if you can confirm the issue and if you can find a quick fix. Thank you!

Here's the Ansi-C main.c file which I tested in both SE versions:
Code: [Select]
#define PACKSTRUCT( xx ) xx
//#define PACKSTRUCT( xx ) __packed xx
//#define PACKSTRUCT( xx ) xx __attribute__((__packed__,gcc_struct))
//#define PACKSTRUCT( xx ) xx __attribute__((__packed__))
//#define PACKSTRUCT( xx ) __packed xx
//#define PACKSTRUCT( xx ) __pragma( pack(push, 1) ) xx __pragma( pack(pop) )


typedef struct {
  unsigned char bytes[8];
} struct_of_bytes;


#if 1

PACKSTRUCT(
struct packed_struct_of_bytes { //  <-  placing the cursor on "packed_struct_of_bytes" doesn't show any definition
    struct_of_bytes nAddress; //  struct_of_bytes is still understood here
}
);

void main(void)
{
 struct packed_struct_of_bytes addr1;           //  <-  placing the cursor on "packed_struct_of_bytes" doesn't show any definition
//  like SE cannot parse PACKSTRUCT macro....

 addr1.                                         //  <-  no completion here in beta v23.0.0.5. But works fine v22.0.2.1

}

#else

// this works always:
// when I type "addr1." SE will complete with "nAddress" after another "." will again complete with "bytes"

struct packed_struct_of_bytes {
    struct_of_bytes nAddress;
};

void main(void)
{
 struct packed_struct_of_bytes addr1;
 // this works fine
 addr1.nAddress.bytes[0] = 0;

}

#endif

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4938
  • Hero Points: 404
Re: C-parsing broken (works well in v22.0.2.1 + se2202_12)
« Reply #1 on: September 27, 2018, 03:51:23 pm »
If you want #define's defined in the current file processed and expanded (this is only a partial preprocessing solution), turn on Tools>Options>Languages>C/C++>C/C++ Parsing Options>Dynamically expand local #defines. This option is off by default now because it can cause other problems due to incomplete and/or incorrect preprocessing.

You will need to restart SlickEdit after changing this option.