choc_DisableAllWarnings.h (3855B)
1 // 2 // ██████ ██ ██ ██████ ██████ 3 // ██ ██ ██ ██ ██ ██ ** Classy Header-Only Classes ** 4 // ██ ███████ ██ ██ ██ 5 // ██ ██ ██ ██ ██ ██ https://github.com/Tracktion/choc 6 // ██████ ██ ██ ██████ ██████ 7 // 8 // CHOC is (C)2022 Tracktion Corporation, and is offered under the terms of 9 // the ISC license: 10 // 11 // Permission to use, copy, modify, and/or distribute this software for any 12 // purpose with or without fee is hereby granted, provided that the above 13 // copyright notice and this permission notice appear in all copies. THE 14 // SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 15 // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 16 // AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 17 // DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 18 // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 19 // CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 20 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 22 /* 23 Sometimes you inevitably have to include some 3rd-party headers in your 24 code, and it's depressing how often even the most widely-used libraries are 25 full of poorly-written code that triggers all kinds of compiler warnings. 26 27 Obviously you're a proper programmer who always has warnings turned up to 28 full, and "-Werror" enabled, so rather than having to compromise your own 29 standards to work around other people's laziness, this header provides an 30 easy way to locally disable warnings by sandwiching your 3rd-party headers 31 between includes of these two files, e.g: 32 33 #include "SloppilyWrittenButEssentialLibraryCode.h" 34 #include "choc_DisableAllWarnings.h" 35 #include "choc_ReenableAllWarnings.h" 36 */ 37 38 #if __clang__ 39 #pragma clang diagnostic push 40 #pragma clang diagnostic ignored "-Weverything" 41 #elif __GNUC__ 42 #pragma GCC diagnostic push 43 #pragma GCC diagnostic ignored "-Wall" 44 #pragma GCC diagnostic ignored "-Wpragmas" 45 #pragma GCC diagnostic ignored "-Wextra" 46 #pragma GCC diagnostic ignored "-Wshadow" 47 #pragma GCC diagnostic ignored "-Wunused-parameter" 48 #pragma GCC diagnostic ignored "-Wconversion" 49 #pragma GCC diagnostic ignored "-Wsign-conversion" 50 #pragma GCC diagnostic ignored "-Wsign-compare" 51 #pragma GCC diagnostic ignored "-Wfloat-conversion" 52 #pragma GCC diagnostic ignored "-Wswitch-enum" 53 #pragma GCC diagnostic ignored "-Wswitch" 54 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" 55 #pragma GCC diagnostic ignored "-Wunused-variable" 56 #pragma GCC diagnostic ignored "-Wredundant-decls" 57 #pragma GCC diagnostic ignored "-Wsubobject-linkage" 58 #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 59 #pragma GCC diagnostic ignored "-Wredundant-move" 60 #pragma GCC diagnostic ignored "-Wstrict-aliasing" 61 #pragma GCC diagnostic ignored "-Woverloaded-virtual" 62 #pragma GCC diagnostic ignored "-Wc99-extensions" 63 #pragma GCC diagnostic ignored "-Wmisleading-indentation" 64 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 65 #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" 66 #pragma GCC diagnostic ignored "-Wcast-function-type" 67 #pragma GCC diagnostic ignored "-Wunused-label" 68 #pragma GCC diagnostic ignored "-Wnarrowing" 69 #pragma GCC diagnostic ignored "-Wparentheses" 70 71 #ifndef __MINGW32__ 72 #pragma GCC diagnostic ignored "-Wredundant-move" 73 #endif 74 #else 75 #pragma warning(push, 0) 76 #pragma warning(disable : 4702) 77 #pragma warning(disable : 4706) 78 #endif