| 1 |
#ifndef PYI_SHARED_H |
| 2 |
#define PYI_SHARED_H |
| 3 |
|
| 4 |
#include <Python.h> |
| 5 |
#include <stdio.h> |
| 6 |
|
| 7 |
#ifndef __has_attribute |
| 8 |
# define __has_attribute(x) 0 // Compatibility with non-clang compilers. |
| 9 |
#endif |
| 10 |
|
| 11 |
|
| 12 |
#ifndef Py_EXPORTED_SYMBOL |
| 13 |
# if defined(_WIN32) || defined(__CYGWIN__) |
| 14 |
# define Py_EXPORTED_SYMBOL __declspec(dllexport) |
| 15 |
# elif (defined(__GNUC__) && (__GNUC__ >= 4)) ||\ |
| 16 |
(defined(__clang__) && __has_attribute(visibility)) |
| 17 |
# define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default"))) |
| 18 |
# else |
| 19 |
# define Py_EXPORTED_SYMBOL |
| 20 |
# endif |
| 21 |
#endif |
| 22 |
|
| 23 |
#define warn_once(msg) \ |
| 24 |
do { \ |
| 25 |
static int warned = 0; \ |
| 26 |
if (!warned) { \ |
| 27 |
fprintf(stderr, "pyinstrument: %s\n", msg); \ |
| 28 |
warned = 1; \ |
| 29 |
} \ |
| 30 |
} while (0) |
| 31 |
|
| 32 |
#endif |