Skip to content

Commit

Permalink
fix(aspect): Patch RecursionError in pcpp
Browse files Browse the repository at this point in the history
Fixes: #300
  • Loading branch information
martis42 committed Dec 18, 2024
1 parent 059f395 commit 1be0d89
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions third_party/pcpp/recursion_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- pcpp/preprocessor.py
+++ pcpp/preprocessor.py
@@ -558,6 +558,8 @@ class Preprocessor(PreprocessorHooks):
for tok in tokens:
if not hasattr(tok, 'expanded_from'):
tok.expanded_from = []
+ if len(expanding_from) == 1 and tok.value == expanding_from[0]:
+ return tokens
i = 0
#print("*** EXPAND MACROS in", "".join([t.value for t in tokens]), "expanding_from=", expanding_from)
#print(tokens)
7 changes: 7 additions & 0 deletions third_party/pcpp/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ def pcpp():
urls = [
"https://files.pythonhosted.org/packages/41/07/876153f611f2c610bdb8f706a5ab560d888c938ea9ea65ed18c374a9014a/pcpp-1.30.tar.gz",
],
patches = [
# Tested for 'cuda.h' by reporter of https://github.com/martis42/depend_on_what_you_use/issues/300
# Corresponding pcpp issue: https://github.com/ned14/pcpp/issues/72
# We tested that this patch resolves pcpp issue #72 and all pcpp unit test remain green.
# pcpp will hopefully see development again in 2025 and then we should be able to drop this patch.
Label("//third_party/pcpp:recursion_fix.patch"),
],
)

0 comments on commit 1be0d89

Please sign in to comment.