Skip to content

C/C++ preprocessor library for deactivating compiler warnings for external libraries

License

Notifications You must be signed in to change notification settings

cwecht/warning_guards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning Guards

Usually compiler warnings are considered useful. If one uses a high warning level, it might happen, that the following situation occurs. There might be a library, which has a header-file lib.h like this.

int f(double x) {
  return (int)x;
}

If -Wold-style-cast is enabled, this header-file will lead to a warning in every translation unit, in which it is included. In combination with -Werror this becomes critical.

This library tries to solve this issue. It defines the macros THIRD_PARTY_HEADERS_BEGIN and THIRD_PARTY_HEADERS_END. Between these two macros, (almost) every warning is disabled.

#include "warning_guards/warning_guards.h"

THIRD_PARTY_HEADERS_BEGIN
#include "lib.h"
THIRD_PARTY_HEADERS_END

Supported Compilers

Currently these compilers/versions are supported:

  • GCC 4.9, 5, 6, 7, 8
  • Clang 4, 5, 6, 7, 8

If used with newer compilers, this library will still work, but warnings introduced with newer compiler versions are not deactivated.

About

C/C++ preprocessor library for deactivating compiler warnings for external libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published