diff --git a/third_party/pcpp/recursion_fix.patch b/third_party/pcpp/recursion_fix.patch new file mode 100644 index 0000000..95ab923 --- /dev/null +++ b/third_party/pcpp/recursion_fix.patch @@ -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) diff --git a/third_party/pcpp/repository.bzl b/third_party/pcpp/repository.bzl index cfc2092..a7cc4e2 100644 --- a/third_party/pcpp/repository.bzl +++ b/third_party/pcpp/repository.bzl @@ -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"), + ], )