From 474a2edc98c4c1e3b30863c4936e660b9a7d0ff9 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 10 Dec 2021 09:27:21 -0800 Subject: [PATCH] fix for translating filenames beginning with numbers to C++ variable names --- src/script_opt/CPP/GenFunc.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/script_opt/CPP/GenFunc.cc b/src/script_opt/CPP/GenFunc.cc index 966e4212b2..673e6def4a 100644 --- a/src/script_opt/CPP/GenFunc.cc +++ b/src/script_opt/CPP/GenFunc.cc @@ -206,6 +206,10 @@ string CPPCompile::BodyName(const FuncInfo& func) string fns = fn; transform(fns.begin(), fns.end(), fns.begin(), canonicalize); + if ( ! isalpha(fns[0]) ) + // This can happen for filenames beginning with numbers. + fns = "_" + fns; + fname = fns + "__" + fname; }