summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Autogen/MocPredefs-check.cxx
blob: 2b4791fc49e19adf1ce556f475191d5f1bc68a0d (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
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>

#include "check_predefs.h"

#define TO_STRING(x) TO_STRING0(x)
#define TO_STRING0(x) #x

int main()
{
  int ret = 0;
#if defined(__STRICT_ANSI__)
#  if !defined(CHECK___STRICT_ANSI__)
  std::cout << "__STRICT_ANSI__: Expected " << TO_STRING(__STRICT_ANSI__)
            << " but it is not defined.\n";
  ret = 1;
#  elif __STRICT_ANSI__ != CHECK___STRICT_ANSI__
  std::cout << "__STRICT_ANSI__: Expected " << TO_STRING(__STRICT_ANSI__)
            << " but got: " << TO_STRING(CHECK___STRICT_ANSI__) << "\n";
  ret = 1;
#  endif
#elif defined(CHECK___STRICT_ANSI__)
  std::cout << "__STRICT_ANSI__: Expected undefined but got: "
            << TO_STRING(CHECK___STRICT_ANSI__) << "\n";
  ret = 1;
#endif

#if defined(__cplusplus)
#  if !defined(CHECK___cplusplus)
  std::cout << "__cplusplus: Expected " << TO_STRING(__cplusplus)
            << " but it is not defined.\n";
  ret = 1;
#  elif __cplusplus != CHECK___cplusplus
  std::cout << "__cplusplus: Expected " << TO_STRING(__cplusplus)
            << " but got: " << TO_STRING(CHECK___cplusplus) << "\n";
  ret = 1;
#  endif
#elif defined(CHECK___cplusplus)
  std::cout << "__cplusplus: Expected undefined but got: "
            << TO_STRING(CHECK___cplusplus) << "\n";
  ret = 1;
#endif

#if defined(_MSVC_LANG)
#  if !defined(CHECK__MSVC_LANG)
  std::cout << "_MSVC_LANG: Expected " << TO_STRING(_MSVC_LANG)
            << " but it is not defined.\n";
  ret = 1;
#  elif _MSVC_LANG != CHECK__MSVC_LANG
  std::cout << "_MSVC_LANG: Expected " << TO_STRING(_MSVC_LANG)
            << " but got: " << TO_STRING(CHECK__MSVC_LANG) << "\n";
  ret = 1;
#  endif
#elif defined(CHECK__MSVC_LANG)
  std::cout << "_MSVC_LANG: Expected undefined but got: "
            << TO_STRING(CHECK__MSVC_LANG) << "\n";
  ret = 1;
#endif

  return ret;
}