Handle warnings and/or messages.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Handle warnings and/or messages.

Jump to solution
2,809 Views
VianneyC
Contributor I

Hello,

 I am working with CodeWarrior 5 and a HCS08 microcontroller, porting some code from Cosmic.

I wonder how is it possible do handle - e.g. - a warning message during the compilation to avoid his appearence in the compilation tab.
For example :
I have this instruction : "time_ref_mng();" , that generate the "C4301: Inline expansion done for function call" message. I don't want to modify the code to cancel t...



Labels (1)
Tags (1)
0 Kudos
1 Solution
896 Views
BlackNight
NXP Employee
NXP Employee
Hello,
the #pragma MESSAGE is on a per function base, so it will be valid for the whole function. You would need to place it before/after the function:

#pragma MESSAGE DISABLE C4301
void myFunction(void) {
...
time_ref_mng();
...
}
#pragma MESSAGE DEFAULT C4301

Erich

View solution in original post

0 Kudos
8 Replies
897 Views
VianneyC
Contributor I

I decide to use this solution :

#pragma MESSAGE DISABLE C4301
    time_ref_mng();

But, is that possible to add this sentence after, #pragma MESSAGE DEFAULT, i.e :

#pragma MESSAGE DISABLE C4301
    time_ref_mng();
#pragma MESSAGE DEFAULT

I want to disable the message only for one instructions.


Vianney

0 Kudos
897 Views
BlackNight
NXP Employee
NXP Employee
Hello,
the #pragma MESSAGE is on a per function base, so it will be valid for the whole function. You would need to place it before/after the function:

#pragma MESSAGE DISABLE C4301
void myFunction(void) {
...
time_ref_mng();
...
}
#pragma MESSAGE DEFAULT C4301

Erich
0 Kudos
897 Views
VianneyC
Contributor I

Everything works well now, thanks.

Vianney

0 Kudos
897 Views
AnnaKoteswarara
Contributor I

Hi ,

 

I am also working on CW v 6.compiler for HCS08 family. I am also facing one error message that

C4301: Inline expansion done for function call. i am using a function which was INLINE.

I am using the option you have mentioned above.

But still facing the same error. but the error message still exists.

 

#pragma MESSAGE DISABLE C4301 

 Initialize_HWIO_APPLStack();
#pragma MESSAGE DEFAULT C4301   

But if i use the second option, the warning was gone. The second option is used  was -WmsgSd4301

 

Please let me know why i am not able to eliminate the warning with the 1st option.
Are there any settings do i need to set?

 

0 Kudos
897 Views
CrasyCat
Specialist III

Hello

 

The pragmas MESSAGE DISABLE and MESSAGE DEFAULT must be use prior and after the function, which invokes Initialize_HWIO_APPLStack.

Not around the prototype  for the function Initialize_HWIO_APPLStack

 

CrasyCat

0 Kudos
897 Views
AnnaKoteswarara
Contributor I

Hi

I am using befoere and after the inline function call where i am calling from the Main fucntion.

But even though i am seeing the warning

 

void Reset_Interrupt (void)
{

#pragma MESSAGE DISABLE C4301
   /* Initialize stack and Set Stack Pointer to start of stack area */
   Initialize_HWIO_APPLStack();
#pragma MESSAGE DEFAULT C4301
   /* Determine the cause of reset source */

}

 

0 Kudos
897 Views
AnnaKoteswarara
Contributor I

Thanks. I tried the below one and it works.

 

#pragma MESSAGE DISABLE C4301

void Reset_Interrupt (void)
{


   /* Initialize stack and Set Stack Pointer to start of stack area */
   Initialize_HWIO_APPLStack();

   /* Determine the cause of reset source */

}

#pragma MESSAGE DEFAULT C4301

0 Kudos
897 Views
BlackNight
NXP Employee
NXP Employee
Hello,
there are several ways, but probably you want to use the -Wmsg compiler option:
-WmsgSd4301
disables the message 4301.

See the -Wmsg option where you can move messages around (to disable, to warning, to error, etc).

Otherwise you could use the
#pragma MESSAGE DISABLE C4301
but for this you would have to put that into your sources where you want to disable the message.

Another way would be to put the above pragma into a header file (e.g. message.h) and then have it included for all your files you compile, using the -AddIncl compiler option:
-AddInclmessage.h

Erich