build/buildutils/checkwarnings.py
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
--- a/build/buildutils/checkwarnings.py	Wed Sep 15 12:05:25 2010 +0300
+++ b/build/buildutils/checkwarnings.py	Wed Oct 13 14:23:59 2010 +0300
@@ -25,15 +25,17 @@
     # Counters for various warnings
     totalWarnings = 0
     badOnes = 0
-    pragmaWarnings = 0
+    deprecatedWarnings = 0
     compilerWarnings = 0
     linkerWarnings = 0
     postlinkerWarnings = 0
     flmWarnings = 0
 
-    # Constants for matching pragma generated warnings
-    pragmaStart = "warning: preprocessor #warning directive"
-    pragmaOptionalRest = "warning: "
+    # Constants for matching warnings related to deprecation
+    deprecatedStart = "warning: preprocessor #warning directive"
+    deprecatedSecondLine = "warning: #warning This header file"
+    deprecatedOptionalThirdLine = "warning: (included from:"
+    deprecatedOptionalRest = "warning:  "
 
     # This list includes strings from which the BAD warnings can be recognized.
     # Note that these must be in lower case!
@@ -59,7 +61,7 @@
         print ""
         print "Details:"
         print "  FLM warnings:            ", self.flmWarnings
-        print "  Pragma warnings:         ", self.pragmaWarnings
+        print "  Use of deprecated api:   ", self.deprecatedWarnings
         print "  Other compiler warnings: ", self.compilerWarnings
         print "  Linker warnings:         ", self.linkerWarnings
         print "  Post-linker warnings:    ", self.postlinkerWarnings
@@ -69,7 +71,7 @@
 class PrintSettings:
     """Class parsing and maintaining the printing settings related to warnings"""
   
-    printPragmaWarnings = False
+    printDeprecatedWarnings = False
     printCompilerWarnings = False
     printLinkerWarnings = False
     printFlmWarnings = False
@@ -85,8 +87,8 @@
             default=False, help="Prints compiler warnings")
         parser.add_option("--pl", dest="printlinkerwarnings", action="store_true", 
             default=False, help="Prints linker warnings")
-        parser.add_option("--pp", dest="printpragmawarnings", action="store_true", 
-            default=False, help="Prints pragma warnings")
+        parser.add_option("--pd", dest="printdeprecatedwarnings", action="store_true", 
+            default=False, help="Prints deprecation warnings")
         parser.add_option("--pf", dest="printflmwarnings", action="store_true", 
             default=False, help="Prints FLM warnings")
         (opts, args) = parser.parse_args()
@@ -96,12 +98,12 @@
             sys.exit(-1)
             
         if opts.printall:
-            self.printPragmaWarnings = True
+            self.printDeprecatedWarnings = True
             self.printCompilerWarnings = True
             self.printLinkerWarnings = True
             self.printFlmWarnings = True
         else:
-            self.printPragmaWarnings = opts.printpragmawarnings
+            self.printDeprecatedWarnings = opts.printdeprecatedwarnings
             self.printCompilerWarnings = opts.printcompilerwarnings
             self.printLinkerWarnings = opts.printlinkerwarnings
             self.printFlmWarnings = opts.printflmwarnings
@@ -117,7 +119,7 @@
 # should have always zero of them. The related log message strings are defined
 # in the variable badWarnings above.
 #
-# The warnings are further categorized as pragma warnings, compiler
+# The warnings are further categorized as deprecated API warnings, compiler
 # warnings, linker, and post-linker warnings.
 #
 def main():
@@ -166,12 +168,12 @@
     # Looking for any warning related to the current target
     if state == 1:
     
-        # Check first for the start of a multiline pragma warning
-        if wh.pragmaStart in line:
-            if settings.printPragmaWarnings:
+        # Check first for the start of a multiline deprecation warning
+        if wh.deprecatedStart in line:
+            if settings.printDeprecatedWarnings:
                 print underCompilation,
                 print line,
-            wh.pragmaWarnings += 1
+            wh.deprecatedWarnings += 1
             wh.totalWarnings += 1
             return 2
             
@@ -218,17 +220,37 @@
                     
             return 1
     
-    # Looking for the optional trailing lines of the multiline pragma warning
+    # Looking for the second line of the multiline deprecation warning
     if state == 2:
-        if wh.pragmaOptionalRest in line:
-            if settings.printPragmaWarnings:
+        if wh.deprecatedSecondLine in line:
+            if settings.printDeprecatedWarnings:
+                print line,
+            return 3
+        else:
+            print "Missing second line"
+            return 1           
+    
+    # Looking for the optional third line of the multiline deprecation warning
+    if state == 3:
+        if wh.deprecatedOptionalThirdLine in line:
+            if settings.printDeprecatedWarnings:
                 print line,
-            return 2
+            return 4
+        else:
+            # Hmm... went one line too far -> need to check the current line again
+            # but now in the state 1
+            return stateMachine(1, line, underCompilation, settings, wh)            
+
+    # Looking for the optional trailing lines of the multiline deprecation warning
+    if state == 4:
+        if wh.deprecatedOptionalRest in line:
+            if settings.printDeprecatedWarnings:
+                print line,
+            return 4
         else:
             # Hmm... went one line too far -> need to check the current line again
             # but now in the state 1           
             return stateMachine(1, line, underCompilation, settings, wh)
-
                     
     # Looking for MAKEDEF detailed information lines
     if state == 5: