Skip to content

Instantly share code, notes, and snippets.

@aaronpuchert
Created September 10, 2025 23:02
Show Gist options
  • Select an option

  • Save aaronpuchert/4ee3be792b692c78f0a3e28db398f130 to your computer and use it in GitHub Desktop.

Select an option

Save aaronpuchert/4ee3be792b692c78f0a3e28db398f130 to your computer and use it in GitHub Desktop.
Rudimentary script to find unbalanced warning pragmas in preprocessed source
#!/bin/bash
grep -n -E "#pragma $1 diagnostic (push|pop)" $2 | \
awk "BEGIN { FS = \":\" }
\$2 == \"#pragma $1 diagnostic push\" { ++level; print \$1, level}
\$2 == \"#pragma $1 diagnostic pop\" { --level; print \$1, level}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment