damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

pwarnings.h (1645B)


      1 #ifndef PWARNINGS_H
      2 #define PWARNINGS_H
      3 
      4 #ifdef __cplusplus
      5 extern "C" {
      6 #endif
      7 
      8 /*
      9  * See also pdiagnostics.h headers for per file control of common
     10  * warnings.
     11  *
     12  * This file is intended for global disabling of warnings that shouldn't
     13  * be present in C11 or perhaps C99, or a generally just noise where
     14  * recent clang / gcc compile cleanly with high warning levels.
     15  */
     16 
     17 #if defined(_MSC_VER)
     18 /* Needed when flagging code in or out and more. */
     19 #pragma warning(disable: 4127) /* conditional expression is constant */
     20 /* happens also in MS's own headers. */
     21 #pragma warning(disable: 4668) /* preprocessor name not defined */
     22 /* MSVC does not respect double parenthesis for intent */
     23 #pragma warning(disable: 4706) /* assignment within conditional expression */
     24 /* `inline` only advisory anyway. */
     25 #pragma warning(disable: 4710) /* function not inlined */
     26 /* Well, we don't intend to add the padding manually. */
     27 #pragma warning(disable: 4820) /* x bytes padding added in struct */
     28 
     29 /*
     30  * Don't warn that fopen etc. are unsafe
     31  *
     32  * Define a compiler flag like `-D_CRT_SECURE_NO_WARNINGS` in the build.
     33  * For some reason it doesn't work when defined here.
     34  *
     35  *     #define _CRT_SECURE_NO_WARNINGS
     36  */
     37 
     38 /*
     39  * Anonymous union in struct is valid in C11 and has been supported in
     40  * GCC and Clang for a while, but it is not C99. MSVC also handles it,
     41  * but warns. Truly portable code should perhaps not use this feature,
     42  * but this is not the place to complain about it.
     43  */
     44 #pragma warning(disable: 4201) /* nonstandard extension used: nameless struct/union */
     45 
     46 #endif /* _MSV_VER */
     47 
     48 #ifdef __cplusplus
     49 }
     50 #endif
     51 
     52 #endif /* PWARNINGS_H */