(source: string)
| 2692 | */ |
| 2693 | const C_NAMED_VARIADIC_DEFINE_RE = /^([ \t]*#[ \t]*define[ \t]+[A-Za-z_]\w*\([^()\n]*?\b\w+)\.\.\./; |
| 2694 | export function blankCNamedVariadicDefineDots(source: string): string { |
| 2695 | if (source.indexOf('...') === -1) return source; |
| 2696 | const lines = source.split('\n'); |
| 2697 | let changed = false; |
| 2698 | for (let i = 0; i < lines.length; i++) { |
| 2699 | const line = lines[i] as string; |
| 2700 | const m = C_NAMED_VARIADIC_DEFINE_RE.exec(line); |
| 2701 | if (!m) continue; |
| 2702 | const keep = m[1] as string; |
| 2703 | lines[i] = keep + ' ' + line.slice(keep.length + 3); |
| 2704 | changed = true; |
| 2705 | } |
| 2706 | return changed ? lines.join('\n') : source; |
| 2707 | } |
| 2708 | |
| 2709 | /** C source pre-processing: neutralize `#ifdef __cplusplus` compat-guard |
| 2710 | * bodies (invisible to a C compiler; `extern "C" {` otherwise errors every |
no test coverage detected