Merge branch 'tmp-fix-16159' into 'master'

parser: fix parser2tree memory leak (and parsing error)

See merge request gnutls/libtasn1!67
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 787c304..3c5353e 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -162,7 +162,7 @@
 		MANS="$$MANS\ngdoc_MANS += man/$$i.3"; \
 		TEXINFOS="$$TEXINFOS\ngdoc_TEXINFOS += texi/$$i.texi"; \
 	done; \
-	grep -v -e '^gdoc_MANS += ' -e '^gdoc_TEXINFOS += ' Makefile.am | \
+	grep -v -e '^gdoc_MANS += ' -e '^gdoc_TEXINFOS += ' $(srcdir)/Makefile.am | \
 		perl -p -e "s,^gdoc_MANS =,gdoc_MANS =$$MANS,;" | \
 		perl -p -e "s,^gdoc_TEXINFOS =,gdoc_TEXINFOS =$$TEXINFOS,;" \
 		> tmp-$@;
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index ef6bf98..3b65776 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -42,14 +42,14 @@
 # gtk-doc will search all .c and .h files beneath these paths
 # for inline comments documenting functions and macros.
 # e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk
-DOC_SOURCE_DIR=$(top_srcdir)/lib
+DOC_SOURCE_DIR=$(top_srcdir)/lib $(top_builddir)/lib
 
 # Extra options to pass to gtkdoc-scangobj. Normally not needed.
 SCANGOBJ_OPTIONS=
 
 # Extra options to supply to gtkdoc-scan.
 # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
-SCAN_OPTIONS=--ignore-decorators=ASN1_API
+SCAN_OPTIONS=--ignore-decorators=ASN1_API --deprecated-guards="ASN1_DISABLE_DEPRECATED"
 
 # Extra options to supply to gtkdoc-mkdb
 # e.g. MKDB_OPTIONS=--xml-mode --output-format=xml
@@ -65,7 +65,7 @@
 # Used for dependencies. The docs will be rebuilt if any of these change.
 # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
 # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
-HFILE_GLOB=$(top_srcdir)/lib/*.h
+HFILE_GLOB=$(top_srcdir)/lib/*.h $(top_builddir)/lib/includes/libtasn1.h
 CFILE_GLOB=$(top_srcdir)/lib/*.c
 
 # Extra header to include when scanning, which are not under DOC_SOURCE_DIR
@@ -74,7 +74,7 @@
 
 # Header files or dirs to ignore when scanning. Use base file/dir names
 # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
-IGNORE_HFILES=element.h gstr.h int.h parser_aux.h structure.h gllib
+IGNORE_HFILES=element.h gstr.h int.h parser_aux.h structure.h gl
 
 # Images to copy into HTML directory.
 # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
diff --git a/lib/includes/libtasn1.h.in b/lib/includes/libtasn1.h.in
index fa10718..f2bc106 100644
--- a/lib/includes/libtasn1.h.in
+++ b/lib/includes/libtasn1.h.in
@@ -21,12 +21,8 @@
  */
 
 /**
- * libtasn1:Short_Description:
- *
- * GNU ASN.1 library
- */
-/**
- * libtasn1:Long_Description:
+ * SECTION:libtasn1
+ * @short_description: GNU ASN.1 library
  *
  * The Libtasn1 library provides Abstract Syntax Notation One (ASN.1, as
  * specified by the X.680 ITU-T recommendation) parsing and structures
@@ -207,13 +203,12 @@
  *
  * For the on-disk format of ASN.1 trees, created by asn1_parser2array().
  */
-struct asn1_static_node_st
+typedef struct asn1_static_node_st
 {
   const char *name;		/* Node name */
   unsigned int type;		/* Node type */
   const void *value;		/* Node value */
-};
-typedef struct asn1_static_node_st asn1_static_node;
+} asn1_static_node;
 
 /* List of constants for field type of node_asn  */
 #define ASN1_ETYPE_INVALID        0
@@ -507,11 +502,13 @@
  *
  * Deprecated: 3.0: Use #asn1_node instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define node_asn_struct _Pragma ("GCC warning \"'node_asn_struct' macro is deprecated, use 'asn1_node' instead.\"") asn1_node_st
 #else
 #define node_asn_struct asn1_node_st
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * node_asn:
@@ -520,11 +517,13 @@
  *
  * Deprecated: 3.0: Use #asn1_node instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define node_asn _Pragma ("GCC warning \"'node_asn' macro is deprecated, use 'asn1_node' instead.\"") asn1_node_st
 #else
 #define node_asn asn1_node_st
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * ASN1_TYPE:
@@ -533,11 +532,13 @@
  *
  * Deprecated: 3.0: Use #asn1_node instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define ASN1_TYPE _Pragma ("GCC warning \"'ASN1_TYPE' macro is deprecated, use 'asn1_node' instead.\"") asn1_node
 #else
 #define ASN1_TYPE asn1_node
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * ASN1_TYPE_EMPTY:
@@ -546,11 +547,13 @@
  *
  * Deprecated: 3.0: Use NULL instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define ASN1_TYPE_EMPTY _Pragma ("GCC warning \"'ASN1_TYPE_EMPTY' macro is deprecated, use 'NULL' instead.\"") NULL
 #else
 #define ASN1_TYPE_EMPTY NULL
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * static_struct_asn:
@@ -559,11 +562,13 @@
  *
  * Deprecated: 3.0: Use #asn1_static_node instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define static_struct_asn _Pragma ("GCC warning \"'static_struct_asn' macro is deprecated, use 'asn1_static_node_st' instead.\"") asn1_static_node_st
 #else
 #define static_struct_asn asn1_static_node_st
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * ASN1_ARRAY_TYPE:
@@ -572,11 +577,13 @@
  *
  * Deprecated: 3.0: Use #asn1_static_node instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define ASN1_ARRAY_TYPE _Pragma ("GCC warning \"'ASN1_ARRAY_TYPE' macro is deprecated, use 'asn1_static_node' instead.\"") asn1_static_node
 #else
 #define ASN1_ARRAY_TYPE asn1_static_node
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * asn1_static_node_t:
@@ -585,11 +592,13 @@
  *
  * Deprecated: 3.0: Use #asn1_static_node instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define asn1_static_node_t _Pragma ("GCC warning \"'asn1_static_node_t' macro is deprecated, use 'asn1_static_node' instead.\"") asn1_static_node
 #else
 #define asn1_static_node_t asn1_static_node
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * node_data_struct:
@@ -598,11 +607,13 @@
  *
  * Deprecated: 3.0: Use #asn1_data_node_st instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define node_data_struct _Pragma ("GCC warning \"'node_data_struct' macro is deprecated, use 'asn1_data_node_st' instead.\"") asn1_data_node_st
 #else
 #define node_data_struct asn1_data_node_st
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 /**
  * ASN1_DATA_NODE:
@@ -611,11 +622,13 @@
  *
  * Deprecated: 3.0: Use #asn1_data_node_st instead.
  */
+#ifndef ASN1_DISABLE_DEPRECATED
 #if _ASN1_GCC_VERSION >= 30100
 #define ASN1_DATA_NODE _Pragma ("GCC warning \"'asn1_static_node_t' macro is deprecated, use 'asn1_static_node' instead.\"") asn1_data_node_st
 #else
 #define ASN1_DATA_NODE asn1_data_node_st
 #endif
+#endif /* !ASN1_DISABLE_DEPRECATED */
 
 #ifdef __cplusplus
 }