From: Yannick Brosseau Date: Mon, 17 Jun 2013 16:07:11 +0000 (-0400) Subject: lttng-gen-tp: Fix include guard name with file using non valid characters X-Git-Tag: v2.0.7~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=69f3425315c7b9485421499cc9e046a71b1126f3;p=lttng-ust.git lttng-gen-tp: Fix include guard name with file using non valid characters Now, the include guard will be generated with all the non alpha-numeric characters replace with an '_' Fixes #511 Signed-off-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- diff --git a/tools/lttng-gen-tp b/tools/lttng-gen-tp index 20756555..b560e535 100755 --- a/tools/lttng-gen-tp +++ b/tools/lttng-gen-tp @@ -61,7 +61,9 @@ extern "C"{{ def write(self): outputFile = open(self.outputFilename,"w") - includeGuard = self.outputFilename.upper().replace(".","_") + # Include guard macro will be created by uppercasing the filename and + # replacing all non alphanumeric characters with '_' + includeGuard = re.sub('[^0-9a-zA-Z]', '_', self.outputFilename.upper()) outputFile.write(HeaderFile.HEADER_TPL.format(providerName=self.template.domain, includeGuard = includeGuard,