damus

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

pdiagnostic.h (2614B)


      1  /* There is intentionally no include guard in this file. */
      2 
      3 
      4 /*
      5  * Usage: optionally disable any of these before including.
      6  *
      7  * #define PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION
      8  * #define PDIAGNOSTIC_IGNORE_UNUSED_VARIABLE
      9  * #define PDIAGNOSTIC_IGNORE_UNUSED_PARAMETER
     10  * #define PDIAGNOSTIC_IGNORE_UNUSED // all of the above
     11  *
     12  * #include "pdiagnostic.h"
     13  *
     14  * Alternatively use #include "pdiagnostic_push/pop.h"
     15  */
     16 
     17 #ifdef _MSC_VER
     18 #pragma warning(disable: 4668) /* preprocessor name not defined */
     19 #endif
     20 
     21 #if !defined(PDIAGNOSTIC_AWARE_MSVC) && defined(_MSC_VER)
     22 #define PDIAGNOSTIC_AWARE_MSVC 1
     23 #elif !defined(PDIAGNOSTIC_AWARE_MSVC)
     24 #define PDIAGNOSTIC_AWARE_MSVC 0
     25 #endif
     26 
     27 #if !defined(PDIAGNOSTIC_AWARE_CLANG) && defined(__clang__)
     28 #define PDIAGNOSTIC_AWARE_CLANG 1
     29 #elif !defined(PDIAGNOSTIC_AWARE_CLANG)
     30 #define PDIAGNOSTIC_AWARE_CLANG 0
     31 #endif
     32 
     33 #if !defined(PDIAGNOSTIC_AWARE_GCC) && defined(__GNUC__) && !defined(__clang__)
     34 /* Can disable some warnings even if push is not available (gcc-4.2 vs gcc-4.7) */
     35 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
     36 #define PDIAGNOSTIC_AWARE_GCC 1
     37 #endif
     38 #endif
     39 
     40 #if !defined(PDIAGNOSTIC_AWARE_GCC)
     41 #define PDIAGNOSTIC_AWARE_GCC 0
     42 #endif
     43 
     44 #if defined(PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION) || defined(PDIAGNOSTIC_IGNORE_UNUSED)
     45 #if PDIAGNOSTIC_AWARE_CLANG
     46 #pragma clang diagnostic ignored "-Wunused-function"
     47 #elif PDIAGNOSTIC_AWARE_GCC
     48 #pragma GCC diagnostic ignored "-Wunused-function"
     49 #endif
     50 #endif
     51 #undef PDIAGNOSTIC_IGNORE_UNUSED_FUNCTION
     52 
     53 #if defined(PDIAGNOSTIC_IGNORE_UNUSED_VARIABLE) || defined(PDIAGNOSTIC_IGNORE_UNUSED)
     54 #if PDIAGNOSTIC_AWARE_MSVC
     55 #pragma warning(disable: 4101) /* unused local variable */
     56 #elif PDIAGNOSTIC_AWARE_CLANG
     57 #pragma clang diagnostic ignored "-Wunused-variable"
     58 #elif PDIAGNOSTIC_AWARE_GCC
     59 #pragma GCC diagnostic ignored "-Wunused-variable"
     60 #endif
     61 #endif
     62 #undef PDIAGNOSTIC_IGNORE_UNUSED_VARIABLE
     63 
     64 #if defined(PDIAGNOSTIC_IGNORE_UNUSED_PARAMETER) || defined(PDIAGNOSTIC_IGNORE_UNUSED)
     65 #if PDIAGNOSTIC_AWARE_CLANG
     66 #pragma clang diagnostic ignored "-Wunused-parameter"
     67 #elif PDIAGNOSTIC_AWARE_GCC
     68 #pragma GCC diagnostic ignored "-Wunused-parameter"
     69 #endif
     70 #endif
     71 #undef PDIAGNOSTIC_IGNORE_UNUSED_PARAMETER
     72 
     73 #undef PDIAGNOSTIC_IGNORE_UNUSED
     74 
     75 #if defined (__cplusplus) && __cplusplus < 201103L
     76 #if PDIAGNOSTIC_AWARE_CLANG
     77 /* Needed for < C++11 clang C++ static_assert */
     78 #pragma clang diagnostic ignored "-Wc11-extensions"
     79 /* Needed for empty macro arguments. */
     80 #pragma clang diagnostic ignored "-Wc99-extensions"
     81 /* Needed for trailing commas. */
     82 #pragma clang diagnostic ignored "-Wc++11-extensions"
     83 #endif
     84 #endif
     85