1752815 Members
5899 Online
108789 Solutions
New Discussion юеВ

HPUX C Compiler Warnings

 
SOLVED
Go to solution
Malcolm Leckie_1
Occasional Advisor

HPUX C Compiler Warnings

Hi

Does anyone know if there is there anyway I can turn off the C compiler warnings/remarks that come from a specfic line in a source file? I could use the -Wargx option but this would switch it off for the entire file.

Thanks
5 REPLIES 5
Matti_Kurkela
Honored Contributor
Solution

Re: HPUX C Compiler Warnings

If the number of the warning you wish to suppress is above 2000, then you can use the diag_suppress #pragma directive.

For example, to disable warning 2345 for a specific line or block of lines:

#pragma diag_suppress 2345
/* do your naughty thing here */
#pragma diag_default 2345

All #pragma directives are compiler-specific and non-portable.

MK
MK
Dennis Handly
Acclaimed Contributor

Re: HPUX C Compiler Warnings

>I could use the -Wargx option

That's +W####,####.
What particular warning do you want to suppress?

>Matti: then you can use the diag_suppress #pragma directive.

Yes, for Integrity you can use:
http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/Online_Help/pragmas.htm#Diagnostic
Malcolm Leckie_1
Occasional Advisor

Re: HPUX C Compiler Warnings

Was wanting to suppress the memory leakage errors.

Using the #pragma works fine and will stop warnings where we know the code is safe - didn't like the idea of a blanket switch off.

Many thanks
Malcolm Leckie_1
Occasional Advisor

Re: HPUX C Compiler Warnings

thanks for the help.
Dennis Handly
Acclaimed Contributor

Re: HPUX C Compiler Warnings

>Was wanting to suppress the memory leakage errors.

You didn't want to fix the leak? :-)
It's small and only once?