Skip to content

Commit 92bb889

Browse files
committed
Don't index anything in DOC_DISABLE sections
Somewhat misleadingly, the DOC_DISABLE directive only disabled warnings. Now we really stop the documentation generator from indexing. This results in additional warnings for xmlThrDef* functions. This should be fixed by documenting or deprecating them.
1 parent 75b5bc2 commit 92bb889

File tree

4 files changed

+15
-27
lines changed

4 files changed

+15
-27
lines changed

doc/apibuild.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -577,23 +577,25 @@ def __init__(self, filename, idx = None):
577577
self.last_comment = ""
578578
self.comment = None
579579
self.collect_ref = 0
580-
self.no_error = 0
580+
self.doc_disable = 0
581581
self.conditionals = []
582582
self.defines = []
583583

584584
def collect_references(self):
585585
self.collect_ref = 1
586586

587-
def stop_error(self):
588-
self.no_error = 1
587+
def disable(self):
588+
self.doc_disable = 1
589589

590-
def start_error(self):
591-
self.no_error = 0
590+
def enable(self):
591+
self.doc_disable = 0
592592

593593
def lineno(self):
594594
return self.lexer.getlineno()
595595

596596
def index_add(self, name, module, static, type, info=None, extra = None):
597+
if self.doc_disable:
598+
return
597599
if self.is_header == 1:
598600
self.index.add(name, module, module, static, type, self.lineno(),
599601
info, extra, self.conditionals)
@@ -611,12 +613,12 @@ def index_add_ref(self, name, module, static, type, info=None,
611613
info, extra, self.conditionals)
612614

613615
def warning(self, msg):
614-
if self.no_error:
616+
if self.doc_disable:
615617
return
616618
print(msg)
617619

618620
def error(self, msg, token=-1):
619-
if self.no_error:
621+
if self.doc_disable:
620622
return
621623

622624
print("Parse Error: " + msg)
@@ -669,10 +671,10 @@ def parseComment(self, token):
669671
token = self.lexer.token()
670672

671673
if self.comment.find("DOC_DISABLE") != -1:
672-
self.stop_error()
674+
self.disable()
673675

674676
if self.comment.find("DOC_ENABLE") != -1:
675-
self.start_error()
677+
self.enable()
676678

677679
return token
678680

@@ -935,7 +937,7 @@ def parsePreproc(self, token):
935937
name = name.split('(') [0]
936938
except:
937939
pass
938-
info = self.parseMacroComment(name, not self.is_header)
940+
info = self.parseMacroComment(name, True)
939941
self.index_add(name, self.filename, not self.is_header,
940942
"macro", info)
941943
return token

doc/libxml2-api.xml

-12
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,6 @@
13871387
<author>Daniel Veillard </author>
13881388
<exports symbol='BASE_BUFFER_SIZE' type='macro'/>
13891389
<exports symbol='LIBXML2_NEW_BUFFER' type='macro'/>
1390-
<exports symbol='XML_DOCB_DOCUMENT_NODE' type='macro'/>
13911390
<exports symbol='XML_GET_CONTENT' type='macro'/>
13921391
<exports symbol='XML_GET_LINE' type='macro'/>
13931392
<exports symbol='XML_LOCAL_NAMESPACE' type='macro'/>
@@ -2763,7 +2762,6 @@
27632762
<file name='xmlexports'>
27642763
<summary>macros for marking symbols as exportable/importable.</summary>
27652764
<description>macros for marking symbols as exportable/importable. </description>
2766-
<exports symbol='LIBXML_DLL_IMPORT' type='macro'/>
27672765
<exports symbol='XMLCALL' type='macro'/>
27682766
<exports symbol='XMLCDECL' type='macro'/>
27692767
<exports symbol='XMLPUBFUN' type='macro'/>
@@ -3963,8 +3961,6 @@
39633961
<macro name='LIBXML_DEBUG_RUNTIME' file='xmlversion'>
39643962
<info>Whether the runtime debugging is configured in</info>
39653963
</macro>
3966-
<macro name='LIBXML_DLL_IMPORT' file='xmlexports'>
3967-
</macro>
39683964
<macro name='LIBXML_DOTTED_VERSION' file='xmlversion'>
39693965
<info>the version string like &quot;1.2.3&quot;</info>
39703966
</macro>
@@ -4158,8 +4154,6 @@
41584154
<macro name='XML_DETECT_IDS' file='parser'>
41594155
<info>Bit in the loadsubset context field to tell to do ID/REFs lookups. Use it to initialize xmlLoadExtDtdDefaultValue.</info>
41604156
</macro>
4161-
<macro name='XML_DOCB_DOCUMENT_NODE' file='tree'>
4162-
</macro>
41634157
<macro name='XML_GET_CONTENT' file='tree'>
41644158
<info>Macro to extract the content pointer of a node.</info>
41654159
</macro>
@@ -4466,12 +4460,6 @@
44664460
<macro name='XML_XPATH_NOVAR' file='xpath'>
44674461
<info>forbid variables in expression</info>
44684462
</macro>
4469-
<macro name='XPATH_LOCATIONSET' file='xpath'>
4470-
</macro>
4471-
<macro name='XPATH_POINT' file='xpath'>
4472-
</macro>
4473-
<macro name='XPATH_RANGE' file='xpath'>
4474-
</macro>
44754463
<macro name='XP_ERROR' file='xpathInternals'>
44764464
<info>Macro to raise an XPath error and return.</info>
44774465
<arg name='X' info='the error code'/>

globals.c

-4
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,6 @@ void xmlCleanupGlobals(void)
559559
__xmlGlobalInitMutexDestroy();
560560
}
561561

562-
/**
563-
* DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
564-
* those are really internal work
565-
*/
566562
void
567563
xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
568564
xmlMutexLock(xmlThrDefMutex);

include/libxml/globals.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
192192
xmlThrDefParserInputBufferCreateFilenameDefault(
193193
xmlParserInputBufferCreateFilenameFunc func);
194194

195-
/** DOC_DISABLE */
196195
/*
197196
* In general the memory allocation entry points are not kept
198197
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
@@ -204,6 +203,8 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
204203
*/
205204

206205
#ifdef LIBXML_THREAD_ALLOC_ENABLED
206+
/** DOC_DISABLE */
207+
207208
#ifdef LIBXML_THREAD_ENABLED
208209
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
209210
#define xmlMalloc \
@@ -244,6 +245,7 @@ XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
244245
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
245246
#endif
246247

248+
/** DOC_ENABLE */
247249
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
248250
XMLPUBVAR xmlMallocFunc xmlMalloc;
249251
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;

0 commit comments

Comments
 (0)