Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion nala/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ def parse(self):
if self.functions:
return

# PATCH BEGIN
# It turns out that at least gcc 15.2 outputs typedefs using '__int128' during preproccesing
# step which is not parsable by pycparser. For this reason we simply removeall 128-bit typedefs here!
typedefs_code = []
for elem in self.typedefs_code:
if "__int128" in elem:
continue
typedefs_code.append(elem)
self.typedefs_code = typedefs_code
# PATCH END
code = '\n'.join(
self.typedefs_code + self.structs_code + self.func_signatures)
self.file_ast = self.cparser.parse(code)
Expand All @@ -374,7 +384,7 @@ def parse(self):
# not the AST list is searched for the first 'c_ast.FuncDecl' starting from the
# calculated `func_offset`. The index of the first detected 'c_ast.FuncDecl' is
# then used as new `func_offset`!
if not isinstance(self.file_ast.ext[func_offset].type, c_ast.FuncDecl):
if func_offset < len(self.file_ast.ext) and not isinstance(self.file_ast.ext[func_offset].type, c_ast.FuncDecl):
for i in range(func_offset, len(self.file_ast.ext)):
if isinstance(self.file_ast.ext[i].type, c_ast.FuncDecl):
func_offset = i
Expand Down
1 change: 1 addition & 0 deletions tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def remove_optput():
def pre_process_file(name):
command = [
'gcc',
'-std=c17', # this avoids gcc to use gnu extensions, which are not supported by pycparser
'-E',
'-I', 'nala/dist',
'-o', f'tests/files/{name}/test_tests.pp.c',
Expand Down
Loading