1#include <cstdio>
2#include <cstdlib>
3
4// This file is instantiated by CMake.
5// DEFINITIONS below is replaced with a set of lines like so:
6//   #ifdef __SSE2__
7//     "SSE2",
8//   #endif
9//
10// This allows for introspection of compiler definitions.
11// The output of the program is a single line of semi colon separated feature
12// names.
13
14// MSVC is using a different set of preprocessor definitions for
15// SSE and SSE2, see _M_IX86_FP in
16// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
17
18int main(int, char **) {
19  const char *strings[] = {
20      @DEFINITIONS@
21      // If DEFINITIONS turns out to be empty, we don't want to list
22      // an empty array. So, we add an end of list marker.
23      "<end_of_feature_list>"
24  };
25  const size_t size = sizeof(strings) / sizeof(strings[0]);
26  for (size_t i = 0; i < size; ++i) {
27    if (i)
28      putchar(';');
29    fputs(strings[i], stdout);
30  }
31  return EXIT_SUCCESS;
32}
33