Skip to content

Commit

Permalink
Add comments and clean up whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Aug 31, 2021
1 parent b1dbdc5 commit 0e4f8ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_c_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def test_to_type_with_cpp(self):
memmgr_path = self._find_file('memmgr.h')

ast2 = parse_file(memmgr_path, use_cpp=True,
cpp_path = cpp_path(), cpp_args = cpp_args())
cpp_path=cpp_path(), cpp_args=cpp_args())
void_ptr_type = ast2.ext[-3].type.type
void_type = void_ptr_type.type
self.assertEqual(generator.visit(c_ast.Cast(void_ptr_type, test_fun)),
Expand Down
15 changes: 15 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
#------------------------------------------------------------------------------
# pycparser: test_util.py
#
# Utility code for tests.
#
# Eli Bendersky [https://eli.thegreenplace.net/]
# This file contributed by [email protected]
# License: BSD
#------------------------------------------------------------------------------
import platform


def cpp_supported():
"""Is cpp (the C preprocessor) supported as a native command?"""
return platform.system() == 'Linux' or platform.system() == 'Darwin'


def cpp_path():
"""Path to cpp command."""
if platform.system() == 'Darwin':
return 'gcc'
return 'cpp'


def cpp_args(args=[]):
"""Turn args into a suitable format for passing to cpp."""
if isinstance(args, str):
args = [args]
if platform.system() == 'Darwin':
Expand Down

0 comments on commit 0e4f8ae

Please sign in to comment.