AnsweredAssumed Answered

Enabling warning for incorrect enum assignment

Question asked by Santhosh Ramani on Dec 1, 2016
Latest reply on Dec 6, 2016 by Santhosh Ramani

Hello,

 

I'd like to know how I can enable warnings for incorrect enum assignment or being passed as function parameter. Here is an example

 

typedef enum

{

   TEST_1A = 0,

   TEST_2A = 1

} test_1_t;

 

typedef enum

{

   TEST_1B = 0,

   TEST_2B = 1

} test_2_t;

 

If I declare you variables, 

test_1_t Var1;

test_2_t Var2;

 

Var2 = TEST_1A;         // this line should cause a warning.

 

Can someone please let me know if how to enable this? I've already enabled -Wall but that doesn't seem to work.

 

Thank you

Regards

 

Santhosh

 

michaelsteffenfae

Outcomes