[PATCH] libtracefs: Fix sometimes uninitialized warning.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The warning with clang looks like:

src/tracefs-sqlhist.c:1107:2: error: variable 'cmp' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
        default:
        ^~~~~~~
third_party/libtracefs/src/tracefs-sqlhist.c:1112:35: note: uninitialized use occurs here
                            filter->lval->field.field, cmp, val);
                                                       ^~~
third_party/libtracefs/src/tracefs-sqlhist.c:1033:2: note: variable 'cmp' is declared here
        enum tracefs_compare cmp;

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
 src/tracefs-sqlhist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index 6224677..f4dc004 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -1105,7 +1105,7 @@ static int build_filter(struct tep_handle *tep, struct sqlhist_bison *sb,
 	case FILTER_BIN_AND:	cmp = TRACEFS_COMPARE_AND; break;
 	case FILTER_STR_CMP:	cmp = TRACEFS_COMPARE_RE; break;
 	default:
-		break;
+		abort();
 	}
 
 	ret = append_filter(synth, TRACEFS_FILTER_COMPARE,
-- 
2.33.0.153.gba50c8fa24-goog




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux