Did something happen with this? In the latest KDS its still not working...
I have some issues with my project using a struct that wont work correctly in release. I have done this, but I am not 100% sure its pushing an popping the optmizations... Anyone confirm if this is right, or, how I should do it knowing #pragma GCC pop_options is broken? I cannot get __attribute__((optimize("O0"))) to work, if someone can tell me how to add this attibute to a struct below that might help.
<HEADER FILE>
typedef struct
__attribute__((__packed__))
{
int value1;
unsigned long value2;
char string1;
}ramtable_s;
extern volatile ramtable_s RamTable;
<C FILE>
#pragma pack(push)
#pragma GCC optimize("O0")
volatile ramtable_s RamTable =
{
.value1 = 0;
.value2 = 10;
.string1 = "TEST";
};
#pragma pack(pop)
PS the #pragma GCC optimize("O0") is 100% working in this case, but, im worried its staying at level 0 for the rest of the code and I am not sure how to prove / disprove this.
#pragma GCC push_options #pragma GCC optimize("O2") void myFunc(){ blah } #pragma GCC pop_options |
#pragma GCC push_options #pragma GCC optimize("O2") void myFunc(){ blah } #pragma GCC pop_options |
#define OPTIMIZE(level) __attribute__((optimize(level)) OPTIMIZE("O2") myFunc() ... OPTIMIZE("O1") yourFunc() ... |
#pragma GCC optimize ("O2") |