How to turn off warnings?

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

How to turn off warnings?

Jump to solution
3,869 Views
gregoryberardi
Contributor II

The start08.c code for the MC9S08 generates two warnings.

 

Unused declaration of function '_COPY_L'

and

Unused declaration of function 'main'

 

Since this is an analysis warning, the #pragmas don't work? There is a comment above the _COPY_L warning that says

 

/*lint -esym(752,_COPY_L)  inhibit message on function declared, but not used (it is used in HLI) */

 

How do I use this?

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
2,295 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

We can use “#pragma OPTION: Additional Options” to "partial " of Compiler throughout code.

Syntax

#pragma OPTION ADD [<Handle>] "<Option>"

#pragma OPTION DEL <Handle>

#pragma OPTION DEL ALL

Description

Options are added inside of the source code while compiling a file.

The options given on the command line or in a configuration file cannot be changed in any way.

Additional options are added to the current ones with the ADD command. A handle may be given optionally.

The DEL command either removes all options with a specific handle. It also uses the ALL keyword to remove all added options regardless if they have a handle or not. Note that you only can remove options which were added previously with the OPTION ADD pragma.

All keywords and the handle are case-sensitive.

You can check more information in Compiler_HC12.pdf under your CW install. Search the document with keyword "pragma OPTION".

For example you want disable warning C4443 . you can use below for the section of code

#pragma OPTION ADD handle "-WmsgSd4443"

<.....your code...>

#pragma OPTION DEL ALL

Hope this helps!

View solution in original post

0 Kudos
Reply
9 Replies
2,296 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

We can use “#pragma OPTION: Additional Options” to "partial " of Compiler throughout code.

Syntax

#pragma OPTION ADD [<Handle>] "<Option>"

#pragma OPTION DEL <Handle>

#pragma OPTION DEL ALL

Description

Options are added inside of the source code while compiling a file.

The options given on the command line or in a configuration file cannot be changed in any way.

Additional options are added to the current ones with the ADD command. A handle may be given optionally.

The DEL command either removes all options with a specific handle. It also uses the ALL keyword to remove all added options regardless if they have a handle or not. Note that you only can remove options which were added previously with the OPTION ADD pragma.

All keywords and the handle are case-sensitive.

You can check more information in Compiler_HC12.pdf under your CW install. Search the document with keyword "pragma OPTION".

For example you want disable warning C4443 . you can use below for the section of code

#pragma OPTION ADD handle "-WmsgSd4443"

<.....your code...>

#pragma OPTION DEL ALL

Hope this helps!

0 Kudos
Reply
2,295 Views
gregoryberardi
Contributor II

Thank you for responding.

The start08.c code for the MC9S08 generates two warnings.

Unused declaration of function '_COPY_L'

and

Unused declaration of function 'main'

Those are the exact warnings and as you can see there is no CNUM. How do I add the exception for this?

0 Kudos
Reply
2,295 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

what's the warning message number? or can you please post a screenshot of it?

0 Kudos
Reply
2,295 Views
gregoryberardi
Contributor II

Start08_Error.png

As you can see. There are no "warning message numbers".

Here is the offending code

/*lint -esym(752,_COPY_L)  inhibit message on function declared, but not used (it is used in HLI) */

__EXTERN_C extern void _COPY_L(void);

As you can see there is a comment that says that you can "inhibit message" but I don't know how to add this to lint in codewarrior.

This is the other offending code

/*lint -esym(752, main) main is used in HLI */

__EXTERN_C extern void main(void); /* prototype of main function */

Anyone know how to configure lint in codewarrior?

0 Kudos
Reply
2,295 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

i can't reproduce your prolem as your screenshot shows. can you please upload your demo project so that we check see the problem directly? thanks!

0 Kudos
Reply
2,295 Views
gregoryberardi
Contributor II

I started a new project and copied the code over to it and the problem disappeared. Thank you for your help.

0 Kudos
Reply
2,295 Views
gregoryberardi
Contributor II

I don't want to do this globally. I just want the warnings from freescale's code to go away.

0 Kudos
Reply
2,295 Views
TICS_Fiona
NXP Employee
NXP Employee

The pragma in below could help to disable  a warning message. For details, please refer to Build Tools Reference Manual.

#pragma MESSAGE {(WARNING|ERROR| INFORMATION|DISABLE|DEFAULT){<CNUM>}}

2,295 Views
gregoryberardi
Contributor II

Thank you for your response.

The start08.c code for the MC9S08 generates two warnings.

Unused declaration of function '_COPY_L'

and

Unused declaration of function 'main'

Those are the exact warnings and as you can see there is no CNUM. How do I add the exception for this?

I tried

#pragma MESSAGE WARNING DISABLE

and it had no effect.

Any other ideas?

0 Kudos
Reply