Skip to content

feat: warn when loaded file contains no geometry#307

Merged
spe-ciellt merged 2 commits intogerbv:developfrom
SourceParts:feat/warn-empty-files
Mar 7, 2026
Merged

feat: warn when loaded file contains no geometry#307
spe-ciellt merged 2 commits intogerbv:developfrom
SourceParts:feat/warn-empty-files

Conversation

@rampageservices
Copy link
Copy Markdown
Contributor

Summary

Closes #259.

  • Adds a post-parse emptiness check in gerbv_open_image() that emits a GERBV_MESSAGE_WARNING when a file parses successfully but contains no actual geometry (the net list has only the sentinel node, no real entries)
  • Drill files get: File "..." contains no drill hits or routes (via drill_stats->error_list)
  • Gerber files get: File "..." contains no drawing elements (via gerbv_stats->error_list)
  • Single insertion point in src/gerbv.c, no changes to parsers

Test plan

  • cmake --build build — clean build, zero new warnings
  • ctest — 94/104 pass (10 pre-existing image mismatches, unchanged)
  • test/inputs/empty.xnc (existing empty drill file) produces the drill warning
  • Minimal empty Gerber file (headers + M02, no draws) produces the Gerber warning
  • Non-empty files produce no false positive warnings

Add post-parse emptiness check in gerbv_open_image() that emits a
WARNING into the image's error list when a Gerber or drill file parses
successfully but defines no actual geometry (netlist contains only the
sentinel node). This surfaces empty files that some CAD tools generate
by mistake, rather than silently loading a blank layer.
Copy link
Copy Markdown
Contributor

@spe-ciellt spe-ciellt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one thing but in several places.

Address review feedback: wrap individual comparisons in parentheses
when combined with && or || operators, per project style preference.
@rampageservices
Copy link
Copy Markdown
Contributor Author

@spe-ciellt Added parentheses around comparisons in boolean expressions as requested — see latest commit 391db5a.

@spe-ciellt spe-ciellt merged commit ff86b35 into gerbv:develop Mar 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature request: report / indicate empty gerber files

2 participants