SunStudio C ++ compiler editor to disable warnings?

The STLport associated with SunStudio11 generates many warnings. I believe most compilers have a way to disable warnings from specific source files, for example:

Sun c

#pragma error_messages off

#include <header.h>
// ...

#pragma error_messages on

NKU

#pragma warning(push, 0)        

#include <header.h>
// ...

#pragma warning(pop)

How do you do this in a SunStudio C ++ compiler? (btw, sunstudio C pragmas do not work in sunstudio C ++)

+3
source share
4 answers

In SunStudio 12 #pragma error_messages work as described in the C user manual.

You can see the tags with the -errtags = yes parameter and use it as follows:

// Disable badargtypel2w:
//     String literal converted to char* in formal argument
#pragma error_messages (off, badargtypel2w )

and then compile with CC (C ++ compiler).

+6
source

, #pragmas, , -erroff=%all on your compile line.

-erroff =% tag

, -rtags . , , -erroff, .

. http://docs.oracle.com/cd/E19205-01/820-7599/bkapa/index.html.

, Sun Studio 12 1, SS12u1 .

+1

It is impossible to turn off warnings, but when I looked at SunStudio for the last time, it came with two STLs - older ones for backward compatibility with earlier versions of the compiler and STLport. It might be worth checking to see if you are using STLport before trying to disable warnings.

0
source

add -w to your CC or whatever you use.

0
source

Source: https://habr.com/ru/post/1703043/


All Articles