forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpo-11410: Standardize and use symbol visibility attributes across PO…
…SIX and Windows. (pythonGH-16347)
- Loading branch information
Showing
12 changed files
with
132 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef Py_EXPORTS_H | ||
#define Py_EXPORTS_H | ||
|
||
#if defined(_WIN32) || defined(__CYGWIN__) | ||
#define Py_IMPORTED_SYMBOL __declspec(dllimport) | ||
#define Py_EXPORTED_SYMBOL __declspec(dllexport) | ||
#define Py_LOCAL_SYMBOL | ||
#else | ||
/* | ||
* If we only ever used gcc >= 5, we could use __has_attribute(visibility) | ||
* as a cross-platform way to determine if visibility is supported. However, | ||
* we may still need to support gcc >= 4, as some Ubuntu LTS and Centos versions | ||
* have 4 < gcc < 5. | ||
*/ | ||
#ifndef __has_attribute | ||
#define __has_attribute(x) 0 // Compatibility with non-clang compilers. | ||
#endif | ||
#if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\ | ||
(defined(__clang__) && __has_attribute(visibility)) | ||
#define Py_IMPORTED_SYMBOL __attribute__ ((visibility ("default"))) | ||
#define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default"))) | ||
#define Py_LOCAL_SYMBOL __attribute__ ((visibility ("hidden"))) | ||
#else | ||
#define Py_IMPORTED_SYMBOL | ||
#define Py_EXPORTED_SYMBOL | ||
#define Py_LOCAL_SYMBOL | ||
#endif | ||
#endif | ||
|
||
#endif /* Py_EXPORTS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Core and Builtins/2019-09-24-05-32-27.bpo-11410.vS182p.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Better control over symbol visibility is provided through use of the | ||
visibility attributes available in gcc >= 4.0, provided in a uniform way | ||
across POSIX and Windows. The POSIX build files have been updated to compile | ||
with -fvisibility=hidden, minimising exported symbols. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters