File: pyi_shared.h

package info (click to toggle)
python-pyinstrument 5.1.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,672 kB
  • sloc: python: 6,907; ansic: 897; makefile: 46; sh: 26; javascript: 18
file content (32 lines) | stat: -rw-r--r-- 888 bytes parent folder | download
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
#ifndef PYI_SHARED_H
#define PYI_SHARED_H

#include <Python.h>
#include <stdio.h>

#ifndef __has_attribute
#  define __has_attribute(x) 0  // Compatibility with non-clang compilers.
#endif

// Define Py_EXPORTED_SYMBOL to be the appropriate symbol for exporting, it's not set in Python 3.8.
#ifndef Py_EXPORTED_SYMBOL
#  if defined(_WIN32) || defined(__CYGWIN__)
#    define Py_EXPORTED_SYMBOL __declspec(dllexport)
#  elif (defined(__GNUC__) && (__GNUC__ >= 4)) ||\
        (defined(__clang__) && __has_attribute(visibility))
#    define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
#  else
#    define Py_EXPORTED_SYMBOL
#  endif
#endif

#define warn_once(msg) \
    do { \
        static int warned = 0; \
        if (!warned) { \
            fprintf(stderr, "pyinstrument: %s\n", msg); \
            warned = 1; \
        } \
    } while (0)

#endif /* PYI_SHARED_H */