diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ae93ee4..79818c98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,9 +139,6 @@ if (NOT MSVC) f(void) {} int main(void) { return 0; } " HAVE_ATTRIBUTE_DESTRUCTOR) - if(HAVE_ATTRIBUTE_DESTRUCTOR) - set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))") - endif() check_include_files(arpa/inet.h HAVE_ARPA_INET_H) check_function_exists(class HAVE_CLASS) check_include_files(dlfcn.h HAVE_DLFCN_H) diff --git a/config.h.cmake.in b/config.h.cmake.in index f31fc3b0..e732540d 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -1,6 +1,3 @@ -/* A form that will not confuse apibuild.py */ -#cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@ - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ARPA_INET_H 1 diff --git a/configure.ac b/configure.ac index 65ed3c5e..badddcc2 100644 --- a/configure.ac +++ b/configure.ac @@ -355,7 +355,6 @@ void __attribute__((destructor)) f(void) {}], [], [ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_ATTRIBUTE_DESTRUCTOR], [1],[Define if __attribute__((destructor)) is accepted]) - AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [__attribute__((destructor))],[A form that will not confuse apibuild.py])],[ AC_MSG_RESULT(no)]) dnl diff --git a/libxml.h b/libxml.h index e1aa3ee4..64e140ad 100644 --- a/libxml.h +++ b/libxml.h @@ -53,6 +53,10 @@ #define ATTRIBUTE_UNUSED #endif +#ifdef HAVE_ATTRIBUTE_DESTRUCTOR + #define ATTRIBUTE_DESTRUCTOR __attribute__((destructor)) +#endif + #if defined(__clang__) || \ (defined(__GNUC__) && (__GNUC__ >= 8) && !defined(__EDG__)) #define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg))) diff --git a/meson.build b/meson.build index 3cab6916..8a81de5b 100644 --- a/meson.build +++ b/meson.build @@ -298,7 +298,6 @@ endif ### __attribute__((destructor)) if cc.has_function_attribute('destructor') config_h.set10('HAVE_ATTRIBUTE_DESTRUCTOR', true) - config_h.set('ATTRIBUTE_DESTRUCTOR', '__attribute__((destructor))') endif ### DSO support