Arduino Helpers master
Utility library for Arduino
Warnings.hpp
Go to the documentation of this file.
1#pragma once
2
3#if defined(__GNUC__) && !defined(__clang__)
4
5#if __GNUC__ >= 11
6
7#define AH_DIAGNOSTIC_WERROR() \
8 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic error \"-Wall\"") \
9 _Pragma("GCC diagnostic error \"-Wextra\"") \
10 _Pragma("GCC diagnostic ignored \"-Wc++0x-compat\"") \
11 _Pragma("GCC diagnostic ignored \"-Wc++11-compat\"")
12#define AH_DIAGNOSTIC_POP() _Pragma("GCC diagnostic pop")
13#define AH_DIAGNOSTIC_EXTERNAL_HEADER() \
14 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wall\"") \
15 _Pragma("GCC diagnostic ignored \"-Wextra\"") \
16 _Pragma("GCC diagnostic ignored \"-Wsuggest-override\"") _Pragma( \
17 "GCC diagnostic ignored \"-Wunused-parameter\"") \
18 _Pragma("GCC diagnostic warning \"-Wcast-function-type\"") \
19 _Pragma("GCC diagnostic warning \"-Wdeprecated-copy\"")
20/* For the last two: see https://github.com/PaulStoffregen/cores/issues/660 */
21
22#elif __GNUC__ >= 5
23
24#define AH_DIAGNOSTIC_WERROR() \
25 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic error \"-Wall\"") \
26 _Pragma("GCC diagnostic error \"-Wextra\"") \
27 _Pragma("GCC diagnostic ignored \"-Wc++0x-compat\"")
28#define AH_DIAGNOSTIC_POP() _Pragma("GCC diagnostic pop")
29#define AH_DIAGNOSTIC_EXTERNAL_HEADER() \
30 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wall\"") \
31 _Pragma("GCC diagnostic ignored \"-Wextra\"") \
32 _Pragma("GCC diagnostic ignored \"-Wsuggest-override\"") \
33 _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
34
35#else // __GNUC__ < 5
36
37#define AH_DIAGNOSTIC_WERROR() \
38 _Pragma("GCC diagnostic push") \
39 _Pragma("GCC diagnostic ignored \"-Wattributes\"")
40#define AH_DIAGNOSTIC_POP() _Pragma("GCC diagnostic pop")
41#define AH_DIAGNOSTIC_EXTERNAL_HEADER() \
42 _Pragma("GCC diagnostic push") \
43 _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
44
45#endif
46
47#else
48
49#define AH_DIAGNOSTIC_WERROR()
50#define AH_DIAGNOSTIC_POP()
51#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
52
53#endif