Add GCC compatible preprocessing function

This commit is contained in:
Dustin Spicuzza
2023-10-08 01:00:55 -04:00
parent 9dd573e433
commit 8f9e8626af
3 changed files with 116 additions and 8 deletions

View File

@@ -26,10 +26,17 @@ from cxxheaderparser.types import (
)
@pytest.fixture(params=["pcpp"])
@pytest.fixture(params=["gcc", "pcpp"])
def make_pp(request) -> typing.Callable[..., PreprocessorFunction]:
param = request.param
if param == "pcpp":
if param == "gcc":
gcc_path = shutil.which("g++")
if not gcc_path:
pytest.skip("g++ not found")
subprocess.run([gcc_path, "--version"])
return preprocessor.make_gcc_preprocessor
elif param == "pcpp":
if preprocessor.pcpp is None:
pytest.skip("pcpp not installed")
return preprocessor.make_pcpp_preprocessor