lemon: Make it build with __clang_analyzer__ defined
authorStig Bjørlykke <stig@bjorlykke.org>
Wed, 6 Jun 2018 11:46:50 +0000 (13:46 +0200)
committerAnders Broman <a.broman58@gmail.com>
Thu, 7 Jun 2018 03:58:04 +0000 (03:58 +0000)
The static function handleswitch() is not compiled with __clang_analyzer__
defined, but it's used in OptInit() without any checks. Change to have
an empty implementation for __clang_analyzer__.

Change-Id: I73da2042ec64fdfa6910c02c059d36db491dc538
Reviewed-on: https://code.wireshark.org/review/28059
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
tools/lemon/lemon.c

index 35ffe8ce91ee646c9a6e9cfae0a10275b506229a..faa85308706493934aaa058e79af94835b18c4c4 100644 (file)
@@ -2058,18 +2058,18 @@ static int handleflags(int i, FILE *err)
     return errcnt;
 }
 
-#ifndef __clang_analyzer__
 /*
 ** Process a command line switch which has an argument.
 */
 static int handleswitch(int i, FILE *err)
 {
+  int errcnt = 0;
+#ifndef __clang_analyzer__
   int lv = 0;
   double dv = 0.0;
   char *sv = 0, *end;
   char *cp;
   int j;
-  int errcnt = 0;
   cp = strchr(argv[i],'=');
   assert( cp!=0 );
   *cp = 0;
@@ -2146,9 +2146,9 @@ static int handleswitch(int i, FILE *err)
           break;
     }
   }
+#endif
   return errcnt;
 }
-#endif
 
 int OptInit(char **a, struct s_options *o, FILE *err)
 {