File: config_info.cpp

package info (click to toggle)
boost1.83 1.83.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 545,632 kB
  • sloc: cpp: 3,857,086; xml: 125,552; ansic: 34,414; python: 25,887; asm: 5,276; sh: 4,799; ada: 1,681; makefile: 1,629; perl: 1,212; pascal: 1,139; sql: 810; yacc: 478; ruby: 102; lisp: 24; csh: 6
file content (105 lines) | stat: -rw-r--r-- 2,753 bytes parent folder | download | duplicates (7)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# /* **************************************************************************
#  *                                                                          *
#  *     (C) Copyright Edward Diener 2014,2019.
#  *     Distributed under the Boost Software License, Version 1.0. (See
#  *     accompanying file LICENSE_1_0.txt or copy at
#  *     http://www.boost.org/LICENSE_1_0.txt)
#  *                                                                          *
#  ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
#include <iostream>
#include <iomanip>
#include <string.h>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/variadic/has_opt.hpp>

static unsigned int indent = 4;
static unsigned int width = 40;

using std::cout;
using std::istream;

void print_separator()
{
   std::cout <<
"\n\n*********************************************************************\n\n";
}

void print_macro(const char* name, const char* value)
{
   // if name == value+1 then then macro is not defined,
   // in which case we don't print anything:
   if(0 != strcmp(name, value+1))
   {
      for(unsigned i = 0; i < indent; ++i) std::cout.put(' ');
      std::cout << std::setw(width);
      cout.setf(istream::left, istream::adjustfield);
      std::cout << name;
      if(value[1])
      {
         // macro has a value:
         std::cout << value << "\n";
      }
      else
      {
         // macro is defined but has no value:
         std::cout << " [no value]\n";
      }
   }
}

#define PRINT_MACRO(X) print_macro(#X, BOOST_PP_STRINGIZE(=X))

void print_macros()
{
  
  print_separator();
  
  PRINT_MACRO(__GCCXML__);
  PRINT_MACRO(__WAVE__);
  PRINT_MACRO(__MWERKS__);
  PRINT_MACRO(__EDG__);
  PRINT_MACRO(_MSC_VER);
  PRINT_MACRO(__clang__);
  PRINT_MACRO(__DMC__);
  PRINT_MACRO(__BORLANDC__);
  PRINT_MACRO(__IBMC__);
  PRINT_MACRO(__IBMCPP__);
  PRINT_MACRO(__SUNPRO_CC);
  PRINT_MACRO(__CUDACC__);
  PRINT_MACRO(__PATHSCALE__);
  PRINT_MACRO(__CODEGEARC__);
  PRINT_MACRO(__HP_aCC);
  PRINT_MACRO(__SC__);
  PRINT_MACRO(__MRC__);
  PRINT_MACRO(__PGI);
  PRINT_MACRO(__INTEL_COMPILER);
  PRINT_MACRO(__GNUC__);
  PRINT_MACRO(__GXX_EXPERIMENTAL_CXX0X__);
  
  print_separator();
  
  PRINT_MACRO(__cplusplus);
  PRINT_MACRO(__STDC_VERSION__);
  PRINT_MACRO(__EDG_VERSION__);
  PRINT_MACRO(__INTELLISENSE__);
  PRINT_MACRO(__WAVE_HAS_VARIADICS__);
  
  print_separator();
  
  PRINT_MACRO(BOOST_PP_CONFIG_ERRORS);
  PRINT_MACRO(BOOST_PP_CONFIG_EXTENDED_LINE_INFO);
  PRINT_MACRO(BOOST_PP_CONFIG_FLAGS());
  PRINT_MACRO(BOOST_PP_VARIADICS_MSVC);
  PRINT_MACRO(BOOST_PP_VARIADIC_HAS_OPT());
}

int main()
{

  print_macros();

  return 0;
}