MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / try_replace

Function try_replace

tools/project.py:1704–1727  ·  view source on GitHub ↗
(flag: str)

Source from the content-addressed store, hash-verified

1702
1703 # Attempts replacement for the given flag.
1704 def try_replace(flag: str) -> bool:
1705 replacement = CFLAG_REPLACE.get(flag)
1706 if replacement is not None:
1707 cflags.append(replacement)
1708 return True
1709
1710 for prefix, replacement in CFLAG_REPLACE_PREFIX:
1711 if flag.startswith(prefix):
1712 cflags.append(flag.replace(prefix, replacement, 1))
1713 return True
1714
1715 for prefix, options in CFLAG_REPLACE_OPTIONS:
1716 if not flag.startswith(prefix):
1717 continue
1718
1719 # "-lang c99" and "-lang=c99" are both generally valid option forms
1720 option = flag.removeprefix(prefix).removeprefix("=").lstrip()
1721 replacements = options.get(option)
1722 if replacements is not None:
1723 cflags.extend(replacements)
1724
1725 return True
1726
1727 return False
1728
1729 for flag in flags:
1730 # Ignore flags first

Callers 1

append_cflagsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected