[yocto] [ptest-runner][PATCH 3/4] tests: fix clang warnings.

Randy MacLeod Randy.MacLeod at windriver.com
Wed Jul 17 11:35:29 PDT 2019


Make tests build using: clang -Weverything
There are a few warnings that remain that are not
variable casting or macro fixes.

Signed-off-by: Randy MacLeod <Randy.MacLeod at windriver.com>
---
 tests/main.c  |  5 +----
 tests/utils.c | 19 +++++++++----------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/tests/main.c b/tests/main.c
index c3b4da5..e1a8b69 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -62,13 +62,10 @@ main(int argc, char *argv[])
 				opts_directory = strdup(optarg);
 			break;
 			case 'h':
-				print_usage(stdout, argv[0]);
-				exit(0);
-			break;
+				/* fall though !! */
 			default:
 				print_usage(stdout, argv[0]);
 				exit(1);
-			break;
 		}
 	}
 
diff --git a/tests/utils.c b/tests/utils.c
index 3ba64d6..571d488 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -33,7 +33,6 @@
 #include "utils.h"
 
 #define PRINT_PTEST_BUF_SIZE 8192
-#define PRINT_PTEST_MAX_LINE 512
 
 extern char *opts_directory;
 
@@ -247,15 +246,15 @@ END_TEST
 static int
 filecmp(FILE *fp1, FILE *fp2)
 {
-    char f1, f2;
-    while (1) {
-			  int end = 0;
-        if ((f1 = getc(fp1)) == EOF) end++;
-        if ((f2 = getc(fp2)) == EOF) end++;
-
-				if (end == 2) return 0;
-				if (end == 1) return 1;
-        if (f1 != f2) return 2;
+	int f1, f2;
+	while (1) {
+		int end = 0;
+		if ((f1 = getc(fp1)) == EOF) end++;
+		if ((f2 = getc(fp2)) == EOF) end++;
+
+		if (end == 2) return 0;
+		if (end == 1) return 1;
+		if (f1 != f2) return 2;
     }
 }
 
-- 
2.17.0



More information about the yocto mailing list