Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically ignore warnings. #55

Open
Rapptz opened this issue Sep 29, 2014 · 6 comments
Open

Programmatically ignore warnings. #55

Rapptz opened this issue Sep 29, 2014 · 6 comments

Comments

@Rapptz
Copy link
Owner

Rapptz commented Sep 29, 2014

There are some warnings that cause issues w.r.t. compilation (mainly Clang). Through the use of #pragma and _Pragma you could programmatically disable some warnings that just make things a headache.

Example:

#define STRINGIZE_PRAGMA(x) _Pragma(#x)

#if defined(__clang__)
#define PRAGMA(x) STRINGIZE_PRAGMA (clang x)
#elif defined (__GNUC__)
#define PRAGMA(x) STRINGIZE_PRAGMA (GCC x)
#endif

PRAGMA(diagnostic push)
PRAGMA(diagnostic ignored "-Wwhatever")
// some code here
PRAGMA(diagnostic pop)

Some candidates for programmatic removal include:

  • '-Wno-unused-value'
  • '-Wno-constexpr-not-const'

Probably others as time goes on.

@Rapptz Rapptz added this to the v1.3.0 milestone Sep 29, 2014
@ThePhD
Copy link
Contributor

ThePhD commented Sep 30, 2014

Not a clue if there's an MSVC version of this. Will find out.

@Rapptz
Copy link
Owner Author

Rapptz commented Sep 30, 2014

MSVC is easier.

#pragma warning(disable : number)

To 'pop' you have to do

#pragma warning(default : number)

@ThePhD
Copy link
Contributor

ThePhD commented Sep 30, 2014

That's not a name though, is it?

@Rapptz
Copy link
Owner Author

Rapptz commented Sep 30, 2014

No, no names, just the warning number. e.g. C4244 will be 4244.

@ThePhD
Copy link
Contributor

ThePhD commented Oct 30, 2014

Is there a particular reason for mangling warnings? I was under the impression we had a warningless build.

@Rapptz
Copy link
Owner Author

Rapptz commented Oct 30, 2014

They're annoying. We have a warningless build because of the way the flags are set up.

@Rapptz Rapptz modified the milestones: v1.2.0, v2.0.0 Apr 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants