Skip to content

Commit 3789230

Browse files
committed
Exclude some macros which shouldn't be part of the docs
1 parent 5788f1e commit 3789230

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

generate_docs.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,8 @@ def get_chunk_identifiers(chunk: str) -> List[str]:
286286
if chunk == 'EXTERN_C IMAGE_DOS_HEADER __ImageBase;':
287287
return ['__ImageBase']
288288

289-
if chunk.startswith('DEFINE_GUID'):
290-
if match := re.match(r'^DEFINE_GUID\(\s*(\w+),', chunk):
291-
return [match.group(1)]
292-
assert False, chunk
289+
if match := re.match(r'^DEFINE_GUID\(\s*(\w+),', chunk):
290+
return [match.group(1)]
293291

294292
if match := re.match(r'^EXTERN_C DECLSPEC_SELECTANY CONST GUID (\w+) =', chunk):
295293
return [match.group(1)]
@@ -300,6 +298,17 @@ def get_chunk_identifiers(chunk: str) -> List[str]:
300298
if match := re.match(r'^(?:enum|struct) (\w+);$', chunk):
301299
return [match.group(1)]
302300

301+
if match := re.match(r'^(DEFINE_ENUM_FLAG_OPERATORS|C_ASSERT)\s*\(', chunk):
302+
return []
303+
304+
if match := re.match(r'^\s*(\w+)\s*\(', chunk):
305+
assert match.group(1) in [
306+
'_At_',
307+
'_Post_satisfies_',
308+
'_Success_',
309+
'_When_',
310+
], chunk
311+
303312
# Functions.
304313
if ident := get_function_identifier(chunk):
305314
return [ident]
@@ -743,6 +752,9 @@ def organize_chunks_to_dir(chunks: List[Chunk], ident_to_id: Dict[str, str], ass
743752
id_to_body[id] = chunk.body
744753

745754
for id, html_contents in id_to_html_contents.items():
755+
if len(html_contents) > 4:
756+
print(f'Warning: Many elements for {id}: {len(html_contents)}')
757+
746758
if ids_pattern and not re.search(ids_pattern, id, flags=re.IGNORECASE):
747759
continue
748760

0 commit comments

Comments
 (0)