[libxml2] Fix rebuilding docs, by hiding __attribute__((...)) behind a macro.



commit 43a8836cdef344018d9a2bc3caa0f8a3a666efbd
Author: Martin Vidner <martin vidner net>
Date:   Sun May 31 18:46:21 2020 +0200

    Fix rebuilding docs, by hiding __attribute__((...)) behind a macro.
    
    When enabled via `./configure --enable-rebuild-docs`,
    `make -C doc libxml2-api.xml` will invoke apibuild.py
    to rebuild libxml2-api.xml from the sources.
    But the code added in
    9fa3200cb366c726f7c8ef234282603bb9e8816d made it error out with
    
    ```
    Parsing ../parser.c
    Parse Error: parsing type : expecting a name
    ('Got token ', ('sep', '('))
    ('Last token: ', ('sep', '('))
    ('Token queue: ', [('name', 'destructor'), ('sep', ')'), ('sep', ')')])
    ('Line 14689 end: ', '')
    ```

 configure.ac    | 3 ++-
 doc/apibuild.py | 1 +
 parser.c        | 4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3a3d91d3..32c47ac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -647,7 +647,8 @@ AC_TRY_COMPILE2([
 void __attribute__((destructor))
 f(void) {}], [], [
   AC_MSG_RESULT(yes)
-  AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [1],[Define if __attribute__((destructor)) is accepted])],[
+  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)])
 
 
diff --git a/doc/apibuild.py b/doc/apibuild.py
index bf90e0ad..18e8a9d3 100755
--- a/doc/apibuild.py
+++ b/doc/apibuild.py
@@ -74,6 +74,7 @@ ignored_words = {
   "__declspec": (3, "Windows keyword"),
   "__stdcall": (0, "Windows keyword"),
   "ATTRIBUTE_UNUSED": (0, "macro keyword"),
+  "ATTRIBUTE_DESTRUCTOR": (0, "macro keyword"),
   "LIBEXSLT_PUBLIC": (0, "macro keyword"),
   "X_IN_Y": (5, "macro function builder"),
   "ATTRIBUTE_ALLOC_SIZE": (3, "macro for gcc checking extension"),
diff --git a/parser.c b/parser.c
index 3559aaae..1932e57a 100644
--- a/parser.c
+++ b/parser.c
@@ -14691,10 +14691,10 @@ xmlCleanupParser(void) {
     xmlParserInitialized = 0;
 }
 
-#if defined(ATTRIBUTE_DESTRUCTOR) && !defined(LIBXML_STATIC) && \
+#if defined(HAVE_ATTRIBUTE_DESTRUCTOR) && !defined(LIBXML_STATIC) && \
     !defined(_WIN32)
 static void
-__attribute__((destructor))
+ATTRIBUTE_DESTRUCTOR
 xmlDestructor(void) {
     xmlCleanupParser();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]