summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/ignore_warning.hpp
blob: d3d2a6e3d1eac6d11b0be8a7bd9f07ad9b66f2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef EOLIAN_CXX_IGNORE_WARNING_HH
#define EOLIAN_CXX_IGNORE_WARNING_HH

#include "grammar/generator.hpp"

namespace efl { namespace eolian { namespace grammar {

struct ignore_warning_begin_generator
{
   template <typename OutputIterator, typename Context>
   bool generate(OutputIterator sink, attributes::unused_type, Context const& context) const
   {
      return as_generator(
        "\n"
        "#pragma GCC diagnostic push\n"
        "#pragma GCC diagnostic ignored \"-Wignored-qualifiers\"\n"
        "\n"
      ).generate(sink, nullptr, context);
   }
};

struct ignore_warning_end_generator
{
   template <typename OutputIterator, typename Context>
   bool generate(OutputIterator sink, attributes::unused_type, Context const& context) const
   {
      return as_generator(
        "\n#pragma GCC diagnostic pop\n\n"
      ).generate(sink, nullptr, context);
   }
};

template <>
struct is_eager_generator<ignore_warning_begin_generator> : std::true_type {};
template <>
struct is_generator<ignore_warning_begin_generator> : std::true_type {};

template <>
struct is_eager_generator<ignore_warning_end_generator> : std::true_type {};
template <>
struct is_generator<ignore_warning_end_generator> : std::true_type {};

ignore_warning_begin_generator constexpr ignore_warning_begin = {};
ignore_warning_end_generator constexpr ignore_warning_end = {};

} } }

#endif