[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 14a3331 10/10: Reuse recent so_attributes wor
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 14a3331 10/10: Reuse recent so_attributes work for wx_new [394] |
Date: |
Sat, 11 Mar 2017 17:24:21 -0500 (EST) |
branch: master
commit 14a33311acd58da2231e79290b8f61be3e9d9f51
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Reuse recent so_attributes work for wx_new [394]
---
wx_new.hpp | 52 ++++++++++++++++++++++++----------------------------
1 file changed, 24 insertions(+), 28 deletions(-)
diff --git a/wx_new.hpp b/wx_new.hpp
index b26492f..4b26b5a 100644
--- a/wx_new.hpp
+++ b/wx_new.hpp
@@ -24,43 +24,39 @@
#include "config.hpp"
-#include <cstddef> // std::size_t
+#include "so_attributes.hpp"
-// TODO ?? CALCULATION_SUMMARY Revise in light of this message:
-// http://lists.nongnu.org/archive/html/lmi/2006-10/msg00024.html
+#include <cstddef> // std::size_t
-#if defined UNIT_TESTING_WX_NEW
-// Don't use so attributes for unit test.
-# define LMI_WX_NEW_SO
-#elif defined HAVE_CONFIG_H
-// For msw, rely on the 'auto-import' kludge favored by autotools.
-# define LMI_WX_NEW_SO
-#elif defined LMI_MSW
+#if defined LMI_WX_NEW_USE_SO_ATTRIBUTES && !defined UNIT_TESTING_WX_NEW
+#
+# if defined LMI_WX_NEW_BUILD_SO && defined LMI_WX_NEW_USE_SO
+# error Both LMI_WX_NEW_BUILD_SO and LMI_WX_NEW_USE_SO defined.
+# endif // defined LMI_WX_NEW_BUILD_SO && defined LMI_WX_NEW_USE_SO
+#
# if defined LMI_WX_NEW_BUILD_SO
-# define LMI_WX_NEW_SO __declspec(dllexport)
+# define LMI_WX_NEW_SO LMI_EXPORT
# elif defined LMI_WX_NEW_USE_SO
-# define LMI_WX_NEW_SO __declspec(dllimport)
+# define LMI_WX_NEW_SO LMI_IMPORT
# else // !defined LMI_WX_NEW_BUILD_SO && !defined LMI_WX_NEW_USE_SO
-# error Either LMI_WX_NEW_BUILD_SO or LMI_WX_NEW_USE_SO must be defined.
+# error Neither LMI_WX_NEW_BUILD_SO nor LMI_WX_NEW_USE_SO defined.
# endif // !defined LMI_WX_NEW_BUILD_SO && !defined LMI_WX_NEW_USE_SO
-#else // !defined HAVE_CONFIG_H && !defined LMI_MSW
-# error Unknown platform and build system.
-#endif // !defined HAVE_CONFIG_H && !defined LMI_MSW
+#
+#else // !defined LMI_WX_NEW_USE_SO_ATTRIBUTES
+# define LMI_WX_NEW_SO
+#endif // !defined LMI_WX_NEW_USE_SO_ATTRIBUTES
/// When wx is used as an msw dll, memory is allocated and freed
-/// across dll boundaries, and that causes mpatrol to emit spurious
-/// diagnostics.
-///
-/// To work around this problem, build these functions as a separate
-/// dll, and use 'new(wx)' to allocate memory that will be freed by
-/// wx--for instance, a frame window that's created in an application
-/// but (unavoidably) freed by a wx dll. The sole purpose of this
-/// workaround is to avoid spurious diagnostics; it is not suggested
-/// that this is a good way to manage memory.
+/// across dll boundaries, and that caused mpatrol to emit spurious
+/// diagnostics. This facility was devised to work around that
+/// problem. It remains valuable although lmi no longer uses mpatrol,
+/// because it indicates memory allocations that must have no matching
+/// deallocations within lmi.
///
-/// It is assumed (but not known) that no such problem occurs on other
-/// platforms. Therefore, the macros above never use ELF visibility
-/// attributes.
+/// Build these functions as a separate shared library, and use
+/// 'new(wx)' to allocate memory that will be freed by wx--e.g., a
+/// frame window that's created in an application but (unavoidably)
+/// freed by a wx dll.
enum wx_allocator{wx};
- [lmi-commits] [lmi] master updated (e41c2a5 -> 14a3331), Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master 4d5ba79 03/10: Improve #error messages, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master a1d3016 01/10: Improve a MinGW conditional, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master cdd64d2 04/10: Remove a superannuated gcc conditional, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master 649d990 02/10: Improve documentation, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master d5d71f8 08/10: Refactor for simplicity, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master 58c9fdf 05/10: Make a precondition check unconditional, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master a4d4c24 06/10: Treat unknown platform as an error, uniformly, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master b1c6af9 07/10: Use similar logic for ELF and PE-COFF, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master b29be96 09/10: Extend in the spirit of ELF visibility, Greg Chicares, 2017/03/11
- [lmi-commits] [lmi] master 14a3331 10/10: Reuse recent so_attributes work for wx_new [394],
Greg Chicares <=