Skip to content

Commit 8dadaaa

Browse files
committed
Fix (ignore non-G[rx]b enums)
1 parent 8b0427c commit 8dadaaa

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

suitesparse_graphblas/create_headers.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ def groupby(index, seq):
329329
"GxB_cuda_malloc",
330330
"GxB_cuda_free",
331331
}
332+
IGNORE_ENUMS = {
333+
"memory_order",
334+
}
332335

333336

334337
class VisitEnumTypedef(c_generator.CGenerator):
@@ -368,7 +371,7 @@ def get_groups(ast):
368371
groups["GB methods"] = sorted(vals, key=sort_key)
369372

370373
missing_methods = {x for x in lines if "extern GrB_Info " in x} - seen
371-
assert not missing_methods
374+
assert not missing_methods, ", ".join(sorted(missing_methods))
372375

373376
vals = {x for x in lines if "extern GrB" in x} - seen
374377
seen.update(vals)
@@ -387,7 +390,7 @@ def get_groups(ast):
387390
groups["GrB const"] = sorted(vals, key=sort_key)
388391

389392
missing_const = {x for x in lines if "extern const" in x} - seen
390-
assert not missing_const
393+
assert not missing_const, ", ".join(sorted(missing_const))
391394

392395
vals = {x for x in lines if "typedef" in x and "GxB" in x and "(" not in x} - seen
393396
seen.update(vals)
@@ -398,7 +401,7 @@ def get_groups(ast):
398401
groups["GrB typedef"] = sorted(vals, key=sort_key)
399402

400403
missing_typedefs = {x for x in lines if "typedef" in x and "GB" in x and "(" not in x} - seen
401-
assert not missing_typedefs
404+
assert not missing_typedefs, ", ".join(sorted(missing_typedefs))
402405
assert all(x.endswith(";") for x in seen) # sanity check
403406

404407
g = VisitEnumTypedef()
@@ -416,14 +419,15 @@ def get_groups(ast):
416419
groups["GxB typedef enums"] = sorted(vals, key=lambda x: sort_key(x.rsplit("}", 1)[-1]))
417420

418421
missing_enums = set(enums) - set(groups["GrB typedef enums"]) - set(groups["GxB typedef enums"])
419-
assert not missing_enums
422+
missing_enums = {x for x in missing_enums if not any(y in x for y in IGNORE_ENUMS)}
423+
assert not missing_enums, ", ".join(sorted(missing_enums))
420424

421425
vals = {x for x in lines if "typedef" in x and "GxB" in x} - seen
422426
seen.update(vals)
423427
groups["GxB typedef funcs"] = sorted(vals, key=sort_key)
424428

425429
vals = {x for x in lines if "typedef" in x and "GrB" in x} - seen
426-
assert not vals
430+
assert not vals, ", ".join(sorted(vals))
427431
groups["not seen"] = sorted(set(lines) - seen, key=sort_key)
428432
for group in groups["not seen"]:
429433
assert "extern" not in group, group

0 commit comments

Comments
 (0)