Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove GCC warning on #pragma region?

How to remove GCC warning on #pragma region ? I added pragma region to easily look at code but it reports warnings on #pragma region. I am using Visual Studio 2010.

like image 424
Damir Avatar asked Oct 15 '12 11:10

Damir


People also ask

How do I turn off compiler warnings?

Turn off the warning in command-line builds To turn off the warning globally in command-line builds, use the /wd4996 command-line option.

How does GCC treat warning errors?

The warning is emitted only with --coverage enabled. By default, this warning is enabled and is treated as an error. -Wno-coverage-invalid-line-number can be used to disable the warning or -Wno-error=coverage-invalid-line-number can be used to disable the error.

How do I enable warnings in GCC?

To enable all warnings, use following list of warnings (probably some warnings are duplicated, because I didn't bother to filter warnings enabled by -Wall ). Show activity on this post. Someone has created a set of tools for determining the complete set of warnings for a given GCC or Clang version.

How do you turn off warnings in C++?

To disable a set of warnings for a given piece of code, you have to start with a “push” pre-processor instruction, then with a disabling instruction for each of the warning you want to suppress, and finish with a “pop” pre-processor instruction.


1 Answers

gcc has this warning flag:

-Wunknown-pragmas Warn when a #pragma directive is encountered which is not understood by GCC. If this command line option is used, warnings will even be issued for unknown pragmas in system header files. This is not the case if the warnings were only enabled by the -Wall command line option.

And as per usual you can negate it, meaning unknown pragmas will not be given a warning. That is, use -Wno-unknown-pragmas.

Note that -Wno-unknown-pragmas must come after any command line flags that turn on this warning, such as -Wall - this also disables warnings on all unknown pragmas, so use with care.

like image 94
nos Avatar answered Sep 20 '22 04:09

nos