[Libreoffice-commits] core.git: compilerplugins/clang

Noel Grandin noel at peralex.com
Mon Jul 25 11:23:57 UTC 2016


 compilerplugins/clang/constantparam.cxx       |    4 ++--
 compilerplugins/clang/constantparam.py        |    4 ++--
 compilerplugins/clang/mergeclasses.cxx        |    4 ++--
 compilerplugins/clang/mergeclasses.py         |    5 +++--
 compilerplugins/clang/singlevalfields.cxx     |    2 +-
 compilerplugins/clang/singlevalfields.py      |    4 ++--
 compilerplugins/clang/unuseddefaultparams.cxx |    4 ++--
 compilerplugins/clang/unuseddefaultparams.py  |    4 ++--
 compilerplugins/clang/unusedfields.cxx        |    4 ++--
 compilerplugins/clang/unusedfields.py         |    6 +++---
 compilerplugins/clang/unusedmethods.cxx       |    4 ++--
 compilerplugins/clang/unusedmethods.py        |    8 ++++----
 12 files changed, 27 insertions(+), 26 deletions(-)

New commits:
commit 98c90acdfc9813ad8789974df1705e0a240194fd
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 25 13:22:38 2016 +0200

    loplugins: more consistent naming of output files
    
    Change-Id: Ia26f697cb16078f235c94e4cff449a60c1bbd74e

diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx
index 88d0ec0..2a44939 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -21,7 +21,7 @@
  The process goes something like this:
   $ make check
   $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='constantparam' check
-  $ ./compilerplugins/clang/constantparam.py constantparam.log
+  $ ./compilerplugins/clang/constantparam.py
 */
 
 namespace {
@@ -84,7 +84,7 @@ public:
             output += s.returnType + "\t" + s.nameAndParams + "\t" + s.sourceLocation + "\t"
                         + s.paramName + "\t" + s.callValue + "\n";
         ofstream myfile;
-        myfile.open( SRCDIR "/constantparam.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.constantparam.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/constantparam.py b/compilerplugins/clang/constantparam.py
index 49f2f9d..300f3b8 100755
--- a/compilerplugins/clang/constantparam.py
+++ b/compilerplugins/clang/constantparam.py
@@ -15,7 +15,7 @@ def normalizeTypeParams( line ):
     return normalizeTypeParamsRegex.sub("type-parameter-?-?", line)
 
 # reading as binary (since we known it is pure ascii) is much faster than reading as unicode
-with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
+with io.open("loplugin.constantparam.log", "rb", buffering=1024*1024) as txt:
     for line in txt:
         idx1 = line.find("\t")
         idx2 = line.find("\t",idx1+1)
@@ -57,7 +57,7 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
 tmp1list.sort(key=lambda v: natural_sort_key(v[2]))
 
 # print out the results
-with open("unused.constantparams", "wt") as f:
+with open("loplugin.constantparams.report", "wt") as f:
     for v in tmp1list:
         f.write(v[2] + "\n")
         f.write("    " + v[0] + "\n")
diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx
index 652e253..20f3dc2 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -32,7 +32,7 @@ Then
 The process goes something like this:
   $ make check
   $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='mergeclasses' check
-  $ ./compilerplugins/clang/mergeclasses.py > mergeclasses.results
+  $ ./compilerplugins/clang/mergeclasses.py
 
 FIXME exclude 'static-only' classes, which some people may use/have used instead of a namespace to tie together a bunch of functions
 
@@ -65,7 +65,7 @@ public:
         for (const std::pair<std::string,std::string> & s : definitionMap)
             output += "definition:\t" + s.first + "\t" + s.second + "\n";
         ofstream myfile;
-        myfile.open( SRCDIR "/mergeclasses.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.mergeclasses.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/mergeclasses.py b/compilerplugins/clang/mergeclasses.py
index 58a65c5..23a15f62 100755
--- a/compilerplugins/clang/mergeclasses.py
+++ b/compilerplugins/clang/mergeclasses.py
@@ -7,7 +7,7 @@ definitionSet = set()
 parentChildDict = {}
 definitionToFileDict = {}
 
-with open("mergeclasses.log") as txt:
+with open("loplugin.mergeclasses.log") as txt:
     for line in txt:
     
         if line.startswith("instantiated:\t"):
@@ -54,6 +54,7 @@ def extractModuleName(clazz):
     idx = filename.find("/")
     return filename[:idx]
 
+with open("loplugin.mergeclasses.report", "wt") as f:
 for clazz in sorted(definitionSet - instantiatedSet):
     # find uninstantiated classes without any subclasses
     if (not(clazz in parentChildDict)) or (len(parentChildDict[clazz]) != 1):
@@ -70,5 +71,5 @@ for clazz in sorted(definitionSet - instantiatedSet):
     # exclude combinations that span modules because we often use those to make cross-module dependencies more manageable.
     if extractModuleName(clazz) != extractModuleName(otherclazz):
         continue
-    print "merge", clazz, "with", otherclazz
+    f.write( "merge" + clazz + "with" + otherclazz + "\n" )
 
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx
index a75b529..699daaa 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -85,7 +85,7 @@ public:
         for (const MyFieldInfo & s : definitionSet)
             output += "defn:\t" + s.parentClass + "\t" + s.fieldName + "\t" + s.sourceLocation + "\n";
         ofstream myfile;
-        myfile.open( SRCDIR "/singlevalfields.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.singlevalfields.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/singlevalfields.py b/compilerplugins/clang/singlevalfields.py
index f4eb399..f3d9c70a 100755
--- a/compilerplugins/clang/singlevalfields.py
+++ b/compilerplugins/clang/singlevalfields.py
@@ -14,7 +14,7 @@ def normalizeTypeParams( line ):
     return normalizeTypeParamsRegex.sub("type-parameter-?-?", line)
 
 # reading as binary (since we known it is pure ascii) is much faster than reading as unicode
-with io.open("singlevalfields.log", "rb", buffering=1024*1024) as txt:
+with io.open("loplugin.singlevalfields.log", "rb", buffering=1024*1024) as txt:
     for line in txt:
         if line.startswith("defn:\t"):
             idx1 = line.find("\t")
@@ -67,7 +67,7 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
 tmp1list.sort(key=lambda v: natural_sort_key(v[2]))
 
 # print out the results
-with open("loplugin.singlevalfields", "wt") as f:
+with open("loplugin.singlevalfields.report", "wt") as f:
     for v in tmp1list:
         f.write(v[2] + "\n")
         f.write("    " + v[0] + "\n")
diff --git a/compilerplugins/clang/unuseddefaultparams.cxx b/compilerplugins/clang/unuseddefaultparams.cxx
index db58824..11cd37d 100644
--- a/compilerplugins/clang/unuseddefaultparams.cxx
+++ b/compilerplugins/clang/unuseddefaultparams.cxx
@@ -24,7 +24,7 @@
  The process goes something like this:
   $ make check
   $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unuseddefaultparams' check
-  $ ./compilerplugins/clang/unuseddefaultparams.py unuseddefaultparams.log
+  $ ./compilerplugins/clang/unuseddefaultparams.py
 */
 
 namespace {
@@ -66,7 +66,7 @@ public:
         for (const MyFuncInfo & s : callSet)
             output += "call:\t" + s.returnType + "\t" + s.nameAndParams + "\n";
         ofstream myfile;
-        myfile.open( SRCDIR "/unuseddefaultparams.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.unuseddefaultparams.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/unuseddefaultparams.py b/compilerplugins/clang/unuseddefaultparams.py
index 0390821..c0c6c61 100755
--- a/compilerplugins/clang/unuseddefaultparams.py
+++ b/compilerplugins/clang/unuseddefaultparams.py
@@ -22,7 +22,7 @@ def normalizeTypeParams( line ):
 
 # The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
 # I have not yet found a way of suppressing the gbuild output.
-with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
+with io.open("loplugin.unuseddefaultparams.log", "rb", buffering=1024*1024) as txt:
     for line in txt:
         if line.startswith("defn:\t"):
             idx1 = line.find("\t",6)
@@ -72,7 +72,7 @@ def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
 tmp1list = sorted(tmp1set, key=lambda v: natural_sort_key(v[1]))
 
 # print out the results
-with open("unused.defaultparams", "wt") as f:
+with open("loplugin.unuseddefaultparams.report", "wt") as f:
     for t in tmp1list:
         f.write(t[1] + "\n")
         f.write("    " + t[0] + "\n")
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 03bd3db..41fab03 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -28,7 +28,7 @@ Be warned that it produces around 5G of log file.
 The process goes something like this:
   $ make check
   $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedfields' check
-  $ ./compilerplugins/clang/unusedfields.py unusedfields.log
+  $ ./compilerplugins/clang/unusedfields.py
 
 and then
   $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='unusedfieldsremove' $dir; done
@@ -83,7 +83,7 @@ public:
             output += "definition:\t" + s.parentClass + "\t" + s.fieldName + "\t" + s.fieldType + "\t" + s.sourceLocation + "\n";
         }
         ofstream myfile;
-        myfile.open( SRCDIR "/unusedfields.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.unusedfields.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py
index 763a117..055fd37 100755
--- a/compilerplugins/clang/unusedfields.py
+++ b/compilerplugins/clang/unusedfields.py
@@ -23,7 +23,7 @@ def normalizeTypeParams( line ):
 
 # The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
 # I have not yet found a way of suppressing the gbuild output.
-with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
+with io.open("loplugin.unusedfields.log", "rb", buffering=1024*1024) as txt:
     for line in txt:
         if line.startswith("definition:\t"):
             idx1 = line.find("\t",12)
@@ -141,11 +141,11 @@ tmp1list = sorted(untouchedSet, key=lambda v: natural_sort_key(v[1]))
 tmp2list = sorted(writeonlySet, key=lambda v: natural_sort_key(v[1]))
 
 # print out the results
-with open("unusedfields.untouched", "wt") as f:
+with open("loplugin.unusedfields.report-untouched", "wt") as f:
     for t in tmp1list:
         f.write( t[1] + "\n" )
         f.write( "    " + t[0] + "\n" )
-with open("unusedfields.writeonly", "wt") as f:
+with open("loplugin.unusedfields.report-writeonly", "wt") as f:
     for t in tmp2list:
         f.write( t[1] + "\n" )
         f.write( "    " + t[0] + "\n" )
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index 0ff053a..a8a94a7 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -33,7 +33,7 @@ Be warned that it produces around 15G of log file.
 The process goes something like this:
   $ make check
   $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unusedmethods' check
-  $ ./compilerplugins/clang/unusedmethods.py unusedmethods.log
+  $ ./compilerplugins/clang/unusedmethods.py
 
 and then
   $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='unusedmethodsremove' $dir; done
@@ -100,7 +100,7 @@ public:
         for (const MyFuncInfo & s : calledFromOutsideSet)
             output += "outside:\t" + s.returnType + "\t" + s.nameAndParams + "\n";
         ofstream myfile;
-        myfile.open( SRCDIR "/unusedmethods.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.unusedmethods.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py
index 64b8298..3d3ffb1 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -133,7 +133,7 @@ def normalizeTypeParams( line ):
 
 # The parsing here is designed to avoid grabbing stuff which is mixed in from gbuild.
 # I have not yet found a way of suppressing the gbuild output.
-with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
+with io.open("loplugin.unusedmethods.log", "rb", buffering=1024*1024) as txt:
     for line in txt:
         if line.startswith("definition:\t"):
             idx1 = line.find("\t",12)
@@ -278,7 +278,7 @@ for d in definitionSet:
     tmp1set.add((method, definitionToSourceLocationMap[d]))
 
 # print out the results, sorted by name and line number
-with open("unused.methods", "wt") as f:
+with open("loplugin.unusedmethods.report-methods", "wt") as f:
     for t in sort_set_by_natural_key(tmp1set):
         f.write(t[1] + "\n")
         f.write("    " + t[0] + "\n")
@@ -323,7 +323,7 @@ for d in definitionSet:
     tmp2set.add((method, definitionToSourceLocationMap[d]))
 
 # print output, sorted by name and line number
-with open("unused.returns", "wt") as f:
+with open("loplugin.unusedmethods.report-returns", "wt") as f:
     for t in sort_set_by_natural_key(tmp2set):
         f.write(t[1] + "\n")
         f.write("    " +  t[0] + "\n")
@@ -346,7 +346,7 @@ for d in publicDefinitionSet:
     tmp3set.add((method, definitionToSourceLocationMap[d]))
 
 # print output, sorted by name and line number
-with open("unused.public", "wt") as f:
+with open("loplugin.unusedmethods.report-public", "wt") as f:
     for t in sort_set_by_natural_key(tmp3set):
         f.write(t[1] + "\n")
         f.write("    " + t[0] + "\n")


More information about the Libreoffice-commits mailing list