lttng-gen-tp: Fix include guard name with file using non valid characters
authorYannick Brosseau <yannick.brosseau@gmail.com>
Mon, 17 Jun 2013 16:07:11 +0000 (12:07 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Jun 2013 16:07:31 +0000 (12:07 -0400)
Now, the include guard will be generated with all the non
alpha-numeric characters replace with an '_'

Fixes #511

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tools/lttng-gen-tp

index 2f468cbb79abde4fbf580208cc4728df91af548a..5937dfdfe1793f61b46c43e544d41f2b109d0674 100755 (executable)
@@ -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,
This page took 0.024971 seconds and 4 git commands to generate.