Fix: liblttng-ust-fork Makefile flags mismatch
[lttng-ust.git] / tools / lttng-gen-tp
index 03a85fcb4e6a7cb63e8172cce6f6bc8f03db1d27..5937dfdfe1793f61b46c43e544d41f2b109d0674 100755 (executable)
@@ -31,12 +31,12 @@ class HeaderFile:
 #undef TRACEPOINT_PROVIDER
 #define TRACEPOINT_PROVIDER {providerName}
 
-#undef TRACEPOINT_INCLUDE_FILE
-#define TRACEPOINT_INCLUDE_FILE ./{headerFilename}
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./{headerFilename}"
 
 #ifdef __cplusplus
-#extern "C"{{
-#endif /*__cplusplus */
+extern "C"{{
+#endif /* __cplusplus */
 
 
 #if !defined({includeGuard}) || defined(TRACEPOINT_HEADER_MULTI_READ)
@@ -52,7 +52,7 @@ class HeaderFile:
 
 #ifdef __cplusplus
 }}
-#endif /*__cplusplus */
+#endif /* __cplusplus */
 
 """
     def __init__(self, filename, template):
@@ -61,7 +61,9 @@ class HeaderFile:
 
     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,
@@ -207,8 +209,6 @@ def main(argv=None):
             opts, args = getopt.gnu_getopt(argv[1:], "ho:a", ["help"])
         except getopt.error, msg:
              raise Usage(msg)
-        if len(args) == 0:
-            raise Usage("No template file given")
 
     except Usage, err:
         print >>sys.stderr, err.msg
@@ -224,6 +224,14 @@ def main(argv=None):
             outputNames.append(a)
         if o in ("-a",""):
             all = True
+    try:
+        if len(args) == 0:
+            raise Usage("No template file given")
+
+    except Usage, err:
+        print >>sys.stderr, err.msg
+        print >>sys.stderr, "for help use --help"
+        return 2
 
     doCFile = None
     doHeader = None
@@ -257,6 +265,9 @@ def main(argv=None):
 
     # process arguments
     for arg in args:
+        if arg[-3:] != ".tp":
+                print arg + " does not end in .tp. Skipping."
+                continue
 
         tpl = None
         try:
This page took 0.023742 seconds and 4 git commands to generate.