From c58df87c27e3689991e27ab64d09d6e55233705b Mon Sep 17 00:00:00 2001 From: Tracy Narine <76846523+tmnarine@users.noreply.github.com> Date: Tue, 24 Mar 2026 14:30:15 -0400 Subject: [PATCH] Fix MacOs lexer compile error (#7314) (#7315) --- docs/CONTRIBUTORS | 1 + src/flexfix | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index 1e1e2b3e5..ab4f4526b 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -256,6 +256,7 @@ Tom Manner Tomasz Gorochowik Topa Topino Toru Niina +Tracy Narine Trung Nguyen Tudor Timi Tymoteusz Blazejczyk diff --git a/src/flexfix b/src/flexfix index 3a4479bdd..307ddee3d 100755 --- a/src/flexfix +++ b/src/flexfix @@ -14,6 +14,7 @@ import re import sys +import platform for line in sys.stdin: # Fix flex 2.6.1 warning @@ -47,5 +48,14 @@ for line in sys.stdin: line = re.sub(r'(#line \d+ ".*)_pretmp', r'\1', line) # Fix 'register' storage class specifier is deprecated and incompatible with C++17 line = re.sub(r'register ', '', line) + # Change int to size_t on LexerInput/LexerOutput when using macOS Tahoe + if platform.system() == "Darwin": + try: + osv = platform.mac_ver()[0] # Example "26.2" + if len(osv) > 2 and osv[2] == "." and int(osv[:2]) >= 26: + if "::LexerInput(" in line or "::LexerOutput(" in line: + line = re.sub(r'int ', r'size_t ', line) + except IndexError as e: + print(f"Unexpected index error {e}") print(line, end='')