static_assert warning

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaGa_1759861
Level 2
Level 2
First solution authored 5 replies posted 5 questions asked

Using PSOC Creator 4.2.0.64 for PSOC5.

ARM GCC 5.4-2016-q2-update.

The static_assert macro appears to work however the IDE reports a warning of an implicit declaration. This does not occur in other tool chains, the Keil IDE editor actually evaluates the assert and generates an error warning during edit if something is changed that causes the static_assert to fail. Is there a way to at least turn off all warnings from static_assert?

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi MaGa_1759861

Adding the following line to your program before using the static_assert macro should solve your issue -

#define static_assert _Static_assert

You can also directly use _Static_assert as shown -

_Static_assert( false, "Error 1");

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

3 Replies
PSBU_2325551
Level 4
Level 4
First like received

Hi,

Please check this KBA available at this link:

GCC Warnings Diagnostic in PSoC Creator - KBA225431

It will be useful.

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi MaGa_1759861

Adding the following line to your program before using the static_assert macro should solve your issue -

#define static_assert _Static_assert

You can also directly use _Static_assert as shown -

_Static_assert( false, "Error 1");

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

Great, that fixed it perfectly, thanks!

0 Likes