[PATCH] Fixing warnings revealed by gcc release build
Edwin Vane
edwin.vane at intel.com
Tue Jan 29 06:19:27 PST 2013
Hi gribozavr,
Fixed used-uninitialized and set-but-not-used warnings.
http://llvm-reviews.chandlerc.com/D342
Files:
lib/AST/ASTDiagnostic.cpp
lib/AST/CommentParser.cpp
lib/AST/Decl.cpp
lib/Basic/LangOptions.cpp
lib/CodeGen/CGObjCGNU.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaLambda.cpp
lib/StaticAnalyzer/Core/SymbolManager.cpp
Index: lib/AST/ASTDiagnostic.cpp
===================================================================
--- lib/AST/ASTDiagnostic.cpp
+++ lib/AST/ASTDiagnostic.cpp
@@ -846,7 +846,7 @@
// Handle Expressions
if (NonTypeTemplateParmDecl *DefaultNTTPD =
dyn_cast<NonTypeTemplateParmDecl>(ParamND)) {
- Expr *FromExpr, *ToExpr;
+ Expr *FromExpr = 0, *ToExpr = 0;
llvm::APSInt FromInt, ToInt;
unsigned ParamWidth = 128; // Safe default
if (DefaultNTTPD->getType()->isIntegralOrEnumerationType())
Index: lib/AST/CommentParser.cpp
===================================================================
--- lib/AST/CommentParser.cpp
+++ lib/AST/CommentParser.cpp
@@ -306,9 +306,9 @@
BlockCommandComment *Parser::parseBlockCommand() {
assert(Tok.is(tok::command));
- ParamCommandComment *PC;
- TParamCommandComment *TPC;
- BlockCommandComment *BC;
+ ParamCommandComment *PC = 0;
+ TParamCommandComment *TPC = 0;
+ BlockCommandComment *BC = 0;
bool IsParam = false;
bool IsTParam = false;
const CommandInfo *Info = Traits.getCommandInfo(Tok.getCommandID());
Index: lib/AST/Decl.cpp
===================================================================
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -665,6 +665,7 @@
break;
}
}
+ (void)D;
assert(!D || D->CachedLinkage == CachedLinkage);
}
Index: lib/Basic/LangOptions.cpp
===================================================================
--- lib/Basic/LangOptions.cpp
+++ lib/Basic/LangOptions.cpp
@@ -14,7 +14,11 @@
using namespace clang;
-const SanitizerOptions SanitizerOptions::Disabled = {};
+const SanitizerOptions SanitizerOptions::Disabled = {
+#define SANITIZER(NAME, ID) 0,
+#include "clang/Basic/Sanitizers.def"
+};
+
LangOptions::LangOptions() {
#define LANGOPT(Name, Bits, Default, Description) Name = Default;
Index: lib/CodeGen/CGObjCGNU.cpp
===================================================================
--- lib/CodeGen/CGObjCGNU.cpp
+++ lib/CodeGen/CGObjCGNU.cpp
@@ -1353,7 +1353,7 @@
MessageSendInfo MSI = getMessageSendInfo(Method, ResultType, ActualArgs);
// Get the IMP to call
- llvm::Value *imp;
+ llvm::Value *imp = 0;
// If we have non-legacy dispatch specified, we try using the objc_msgSend()
// functions. These are not supported on all platforms (or all runtimes on a
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -6727,7 +6727,7 @@
// Variable declaration that has type_tag_for_datatype attribute.
const ValueDecl *VD = NULL;
- uint64_t MagicValue;
+ uint64_t MagicValue = 0;
if (!FindTypeTagExpr(TypeExpr, Ctx, &VD, &MagicValue))
return false;
Index: lib/Sema/SemaLambda.cpp
===================================================================
--- lib/Sema/SemaLambda.cpp
+++ lib/Sema/SemaLambda.cpp
@@ -736,7 +736,7 @@
// Collect information from the lambda scope.
SmallVector<LambdaExpr::Capture, 4> Captures;
SmallVector<Expr *, 4> CaptureInits;
- LambdaCaptureDefault CaptureDefault;
+ LambdaCaptureDefault CaptureDefault = LCD_None;
CXXRecordDecl *Class;
CXXMethodDecl *CallOperator;
SourceRange IntroducerRange;
Index: lib/StaticAnalyzer/Core/SymbolManager.cpp
===================================================================
--- lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -464,7 +464,7 @@
return true;
}
- bool KnownLive;
+ bool KnownLive = false;
switch (sym->getKind()) {
case SymExpr::RegionValueKind:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D342.1.patch
Type: text/x-patch
Size: 3652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130129/4b75dd69/attachment.bin>
More information about the cfe-commits
mailing list