[issue33407] Implement Py_DEPRECATED() macro for Visual Studio

STINNER Victor report at bugs.python.org
Wed May 2 05:29:49 EDT 2018


New submission from STINNER Victor <vstinner at redhat.com>:

According to the following links, it would be possible to implement the Pc_DEPRECATED() macro for Visual Studio:

https://mail.python.org/pipermail/python-dev/2018-May/153299.html
https://stackoverflow.com/questions/295120/c-mark-as-deprecated/295229#295229

"""
#ifdef __GNUC__
#define DEPRECATED(func) func __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED(func) __declspec(deprecated) func
#else
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
#define DEPRECATED(func) func
#endif
"""

Moreover, is Py_DEPRECATED() defined on clang which also supports the deprecated function attribute?
https://clang.llvm.org/docs/AttributeReference.html#deprecated-gnu-deprecated

Current Include/pyport.h code:

#if defined(__GNUC__) \
    && ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
#else
#define Py_DEPRECATED(VERSION_UNUSED)
#endif

----------
components: Windows
messages: 316059
nosy: paul.moore, pitrou, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Implement Py_DEPRECATED() macro for Visual Studio
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33407>
_______________________________________


More information about the Python-bugs-list mailing list