[ltt-dev] [PATCH] cleanup clang analyzer warnings in synchronization

Benjamin Poirier benjamin.poirier at polymtl.ca
Thu Mar 10 12:45:53 EST 2011


Let's get the ball rolling on those fixes!

(also bundle in a little bit of whitespace fix laying around in there)

Signed-off-by: Benjamin Poirier <benjamin.poirier at polymtl.ca>
---
 lttv/lttv/sync/event_analysis_linreg.c           |    5 +---
 lttv/lttv/sync/event_processing_lttng_standard.c |   24 +++++++++------------
 lttv/lttv/sync/graph_functions.c                 |    4 ++-
 lttv/lttv/sync/sync_chain_lttv.c                 |    3 +-
 lttv/modules/text/sync_chain_batch.c             |    3 +-
 5 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/lttv/lttv/sync/event_analysis_linreg.c b/lttv/lttv/sync/event_analysis_linreg.c
index 165f84e..fbfc052 100644
--- a/lttv/lttv/sync/event_analysis_linreg.c
+++ b/lttv/lttv/sync/event_analysis_linreg.c
@@ -152,7 +152,7 @@ static void destroyAnalysisLinReg(SyncState* const syncState)
 static void analyzeExchangeLinReg(SyncState* const syncState, Exchange* const exchange)
 {
 	unsigned int ni, nj;
-	double dji, eji;
+	double dji;
 	double timoy;
 	Fit* fit;
 	Message* ackedMessage;
@@ -170,9 +170,6 @@ static void analyzeExchangeLinReg(SyncState* const syncState, Exchange* const ex
 	dji= ((double) ackedMessage->inE->cpuTime - (double) ackedMessage->outE->cpuTime
 		+ (double) exchange->message->outE->cpuTime - (double)
 		exchange->message->inE->cpuTime) / 2;
-	eji= fabs((double) ackedMessage->inE->cpuTime - (double)
-		ackedMessage->outE->cpuTime - (double) exchange->message->outE->cpuTime +
-		(double) exchange->message->inE->cpuTime) / 2;
 	timoy= ((double) ackedMessage->outE->cpuTime + (double)
 		exchange->message->inE->cpuTime) / 2;
 	ni= ackedMessage->outE->traceNum;
diff --git a/lttv/lttv/sync/event_processing_lttng_standard.c b/lttv/lttv/sync/event_processing_lttng_standard.c
index 8cd4f83..a346508 100644
--- a/lttv/lttv/sync/event_processing_lttng_standard.c
+++ b/lttv/lttv/sync/event_processing_lttng_standard.c
@@ -169,10 +169,6 @@ static void initProcessingLTTVStandard(SyncState* const syncState, ...)
  */
 static AllFactors* finalizeProcessingLTTVStandard(SyncState* const syncState)
 {
-	ProcessingDataLTTVStandard* processingData;
-
-	processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
-
 	partialDestroyProcessingLTTVStandard(syncState);
 
 	return syncState->matchingModule->finalizeMatching(syncState);
@@ -639,11 +635,11 @@ static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState* const
 	syncState, const unsigned int i, const unsigned int j)
 {
 	fprintf(syncState->graphsStream,
-        "set key inside right bottom\n"
-        "set xlabel \"Clock %1$u\"\n"
-        "set xtics nomirror\n"
-        "set ylabel \"Clock %2$u\"\n"
-        "set ytics nomirror\n"
+		"set key inside right bottom\n"
+		"set xlabel \"Clock %1$u\"\n"
+		"set xtics nomirror\n"
+		"set ylabel \"Clock %2$u\"\n"
+		"set ytics nomirror\n"
 		"set x2label \"Clock %1$d (s)\"\n"
 		"set x2range [GPVAL_X_MIN / clock_freq_%1$u : GPVAL_X_MAX / clock_freq_%1$u]\n"
 		"set x2tics\n"
@@ -665,11 +661,11 @@ static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState* const
 	syncState, const unsigned int i, const unsigned int j)
 {
 	fprintf(syncState->graphsStream,
-        "set key inside right bottom\n"
-        "set xlabel \"Clock %1$u\"\n"
-        "set xtics nomirror\n"
-        "set ylabel \"time (s)\"\n"
-        "set ytics nomirror\n"
+		"set key inside right bottom\n"
+		"set xlabel \"Clock %1$u\"\n"
+		"set xtics nomirror\n"
+		"set ylabel \"time (s)\"\n"
+		"set ytics nomirror\n"
 		"set x2label \"Clock %1$d (s)\"\n"
 		"set x2range [GPVAL_X_MIN / clock_freq_%1$u : GPVAL_X_MAX / clock_freq_%1$u]\n"
 		"set x2tics\n", i);
diff --git a/lttv/lttv/sync/graph_functions.c b/lttv/lttv/sync/graph_functions.c
index 91feef0..5134cec 100644
--- a/lttv/lttv/sync/graph_functions.c
+++ b/lttv/lttv/sync/graph_functions.c
@@ -97,7 +97,7 @@ char* changeToGraphsDir(const char* const graphsDir)
 	{
 		g_error("%s", strerror(errno));
 	}
-	while ((retval= chdir(graphsDir)) != 0)
+	while (chdir(graphsDir) != 0)
 	{
 		if (errno == ENOENT)
 		{
@@ -106,11 +106,13 @@ char* changeToGraphsDir(const char* const graphsDir)
 			if (retval != 0)
 			{
 				g_error("%s", strerror(errno));
+				return cwd;
 			}
 		}
 		else
 		{
 			g_error("%s", strerror(errno));
+			return cwd;
 		}
 	}
 
diff --git a/lttv/lttv/sync/sync_chain_lttv.c b/lttv/lttv/sync/sync_chain_lttv.c
index bb49bbd..ecedd6f 100644
--- a/lttv/lttv/sync/sync_chain_lttv.c
+++ b/lttv/lttv/sync/sync_chain_lttv.c
@@ -217,7 +217,6 @@ bool syncTraceset(LttvTracesetContext* const traceSetContext)
 	GArray* factors;
 	double minOffset, minDrift;
 	unsigned int refFreqTrace;
-	int retval;
 
 	if (!optionSync.present)
 	{
@@ -430,7 +429,7 @@ bool syncTraceset(LttvTracesetContext* const traceSetContext)
 	if (optionSyncStats.present)
 	{
 		gettimeofday(&endTime, 0);
-		retval= getrusage(RUSAGE_SELF, &endUsage);
+		getrusage(RUSAGE_SELF, &endUsage);
 
 		timeDiff(&endTime, &startTime);
 		timeDiff(&endUsage.ru_utime, &startUsage.ru_utime);
diff --git a/lttv/modules/text/sync_chain_batch.c b/lttv/modules/text/sync_chain_batch.c
index 33b0176..97e77af 100644
--- a/lttv/modules/text/sync_chain_batch.c
+++ b/lttv/modules/text/sync_chain_batch.c
@@ -341,7 +341,6 @@ void teardownSyncChain(LttvTracesetContext* const traceSetContext)
 	SyncState* syncState;
 	struct timeval endTime;
 	struct rusage endUsage;
-	int retval;
 
 	tracesetChainState= g_hash_table_lookup(tracesetChainStates, traceSetContext);
 	syncState= tracesetChainState->syncState;
@@ -379,7 +378,7 @@ void teardownSyncChain(LttvTracesetContext* const traceSetContext)
 	free(syncState);
 
 	gettimeofday(&endTime, 0);
-	retval= getrusage(RUSAGE_SELF, &endUsage);
+	getrusage(RUSAGE_SELF, &endUsage);
 
 	timeDiff(&endTime, &tracesetChainState->startTime);
 	timeDiff(&endUsage.ru_utime, &tracesetChainState->startUsage.ru_utime);
-- 
1.7.2.3





More information about the lttng-dev mailing list