diff options
author | Carlo Bertolli <cbertol@us.ibm.com> | 2015-05-20 23:15:01 -0400 |
---|---|---|
committer | Craig Griffiths <craig.griffiths@codethink.co.uk> | 2015-08-14 10:38:27 +0100 |
commit | 5497a24ee481bcb51877d226d51d0e85bffcc6d0 (patch) | |
tree | 09aa5c266c9ddb55edd57c7b8af27c4edfbaea73 | |
parent | de4492dde2e9dba97df190311a4978a62922e1b0 (diff) | |
download | flang-5497a24ee481bcb51877d226d51d0e85bffcc6d0.tar.gz |
Fix some trivial warnings
-rw-r--r-- | include/flang/AST/Decl.h | 4 | ||||
-rw-r--r-- | include/flang/AST/Expr.h | 3 | ||||
-rw-r--r-- | include/flang/AST/Stmt.h | 9 | ||||
-rw-r--r-- | include/flang/Basic/Diagnostic.h | 2 | ||||
-rw-r--r-- | include/flang/Basic/Token.h | 2 | ||||
-rw-r--r-- | include/flang/Basic/TokenKinds.def | 2 | ||||
-rw-r--r-- | lib/AST/Stmt.cpp | 16 | ||||
-rw-r--r-- | lib/Frontend/TextDiagnosticPrinter.cpp | 27 |
8 files changed, 35 insertions, 30 deletions
diff --git a/include/flang/AST/Decl.h b/include/flang/AST/Decl.h index 230968542a..9cd5442a82 100644 --- a/include/flang/AST/Decl.h +++ b/include/flang/AST/Decl.h @@ -598,7 +598,7 @@ public: return IsSequence; } - bool setIsSequence(bool V) { IsSequence = V; } + void setIsSequence(bool V) { IsSequence = V; } static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const RecordDecl *D) { return true; } @@ -741,7 +741,7 @@ private: int Attr) : DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T), DeclContext(DK), ArgumentCount(0), Arguments(nullptr), - Body((Stmt*)nullptr), Result(nullptr) { + Result(nullptr), Body((Stmt*)nullptr) { CustomBoolAttr1 = (Attr & Recursive) != 0; SubDeclKind = FK; } diff --git a/include/flang/AST/Expr.h b/include/flang/AST/Expr.h index d7ceae4227..bd8249dac3 100644 --- a/include/flang/AST/Expr.h +++ b/include/flang/AST/Expr.h @@ -58,6 +58,7 @@ protected: Expr(ExprClass ET, QualType T, SourceLocation L) : ExprID(ET), Loc(L) { setType(T); } + public: QualType getType() const { return Ty; } void setType(QualType T) { Ty = T; } @@ -119,7 +120,7 @@ class ConstantExpr : public Expr { SourceLocation MaxLoc; protected: ConstantExpr(ExprClass Ty, QualType T, SourceLocation Loc, SourceLocation MLoc) - : Expr(Ty, T, Loc), MaxLoc(MLoc), Kind(0) {} + : Expr(Ty, T, Loc), Kind(0), MaxLoc(MLoc) {} public: Expr *getKindSelector() const { return Kind; } void setKindSelector(Expr *K) { Kind = K; } diff --git a/include/flang/AST/Stmt.h b/include/flang/AST/Stmt.h index fd415c54ef..b67845bc4b 100644 --- a/include/flang/AST/Stmt.h +++ b/include/flang/AST/Stmt.h @@ -66,10 +66,11 @@ protected: } Stmt(StmtClass ID, SourceLocation L, Expr *SLT) - : StmtID(ID), Loc(L), StmtLabel(SLT), + : StmtID(ID), IsStmtLabelUsed(0), IsStmtLabelUsedAsGotoTarget(0), - IsStmtLabelUsedAsAssignTarget(0) {} + IsStmtLabelUsedAsAssignTarget(0), + Loc(L), StmtLabel(SLT) {} public: virtual ~Stmt(); @@ -603,7 +604,9 @@ class DataStmt : public Stmt { unsigned NumNames; unsigned NumValues; Expr **NameList, **ValueList; - Stmt *Body; + + // Body is not used: comment out for now to avoid warnings + //Stmt *Body; DataStmt(ASTContext &C, SourceLocation Loc, ArrayRef<Expr*> Objects, diff --git a/include/flang/Basic/Diagnostic.h b/include/flang/Basic/Diagnostic.h index 597fc0784b..48af292adc 100644 --- a/include/flang/Basic/Diagnostic.h +++ b/include/flang/Basic/Diagnostic.h @@ -208,7 +208,7 @@ public: DiagnosticsEngine(const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &D, llvm::SourceMgr *SM, DiagnosticClient *DC, bool ShouldOwnClient = true) - : Diags(D), Client(DC), OwnsDiagClient(ShouldOwnClient), SrcMgr(SM) + : Client(DC), OwnsDiagClient(ShouldOwnClient), SrcMgr(SM), Diags(D) { Reset(); } const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const { diff --git a/include/flang/Basic/Token.h b/include/flang/Basic/Token.h index 8b474a3368..585a45211a 100644 --- a/include/flang/Basic/Token.h +++ b/include/flang/Basic/Token.h @@ -130,7 +130,7 @@ public: } void setLiteralData(const char *Ptr) { assert(isLiteral() && "Cannot set literal data of non-literal"); - PtrData = (void*)Ptr; + PtrData = const_cast<char*>(Ptr); } /// setFlag - Set the specified flag. diff --git a/include/flang/Basic/TokenKinds.def b/include/flang/Basic/TokenKinds.def index ea32a81e3e..ac70f7cdad 100644 --- a/include/flang/Basic/TokenKinds.def +++ b/include/flang/Basic/TokenKinds.def @@ -23,7 +23,7 @@ #ifndef FORMAT_SPEC #define FORMAT_SPEC(X, Y) TOK(fs_ ## X) #endif -#ifndef OPERATOR(X,Y) +#ifndef OPERATOR #define OPERATOR(X,Y) TOK(kw_ ## X) #endif diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index bc294d731b..8c942ee7ef 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -146,15 +146,15 @@ ParameterStmt *ParameterStmt::Create(ASTContext &C, SourceLocation Loc, //===----------------------------------------------------------------------===// ImplicitStmt::ImplicitStmt(SourceLocation Loc, Expr *StmtLabel) - : Stmt(ImplicitStmtClass, Loc, StmtLabel), None(true), - LetterSpec(LetterSpecTy(nullptr,nullptr)) { + : Stmt(ImplicitStmtClass, Loc, StmtLabel), + LetterSpec(LetterSpecTy(nullptr,nullptr)), None(true) { } ImplicitStmt::ImplicitStmt(SourceLocation Loc, QualType T, LetterSpecTy Spec, Expr *StmtLabel) - : Stmt(ImplicitStmtClass, Loc, StmtLabel), Ty(T), None(false), - LetterSpec(Spec) {} + : Stmt(ImplicitStmtClass, Loc, StmtLabel), Ty(T), LetterSpec(Spec), + None(false) {} ImplicitStmt *ImplicitStmt::Create(ASTContext &C, SourceLocation Loc, Expr *StmtLabel) { @@ -303,8 +303,8 @@ EquivalenceSet *EquivalenceSet::Create(ASTContext &C, ArrayRef<Object> Objects) //===----------------------------------------------------------------------===// CommonBlockSet::CommonBlockSet(CommonBlockDecl *CBDecl) - : StorageSet(CommonBlockSetClass), Decl(CBDecl), - ObjectCount(0) { } + : StorageSet(CommonBlockSetClass), ObjectCount(0), + Decl(CBDecl) { } CommonBlockSet *CommonBlockSet::Create(ASTContext &C, CommonBlockDecl *CBDecl) { return new(C) CommonBlockSet(CBDecl); @@ -531,7 +531,7 @@ DoWhileStmt *DoWhileStmt::Create(ASTContext &C, SourceLocation Loc, //===----------------------------------------------------------------------===// CycleStmt::CycleStmt(SourceLocation Loc, Expr *StmtLabel, Stmt *loop, ConstructName loopName) - : Stmt(CycleStmtClass, Loc, StmtLabel), Loop(loop), LoopName(loopName) {} + : Stmt(CycleStmtClass, Loc, StmtLabel), LoopName(loopName), Loop(loop) {} CycleStmt *CycleStmt::Create(ASTContext &C, SourceLocation Loc, Stmt *Loop, Expr *StmtLabel, ConstructName LoopName) { @@ -557,7 +557,7 @@ ExitStmt *ExitStmt::Create(ASTContext &C, SourceLocation Loc, Stmt *Loop, SelectCaseStmt::SelectCaseStmt(SourceLocation Loc, Expr *Operand, Expr *StmtLabel, ConstructName Name) : CFBlockStmt(SelectCaseStmtClass, Loc, StmtLabel, Name), - E(Operand), FirstCase(nullptr), DefaultCase(nullptr) {} + FirstCase(nullptr), DefaultCase(nullptr), E(Operand) {} SelectCaseStmt *SelectCaseStmt::Create(ASTContext &C, SourceLocation Loc, Expr *Operand, Expr *StmtLabel, diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 51943aa8d2..8caaa90981 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -22,19 +22,20 @@ namespace flang { -static const enum llvm::raw_ostream::Colors noteColor = - llvm::raw_ostream::BLACK; -static const enum llvm::raw_ostream::Colors fixitColor = - llvm::raw_ostream::GREEN; -static const enum llvm::raw_ostream::Colors caretColor = - llvm::raw_ostream::GREEN; -static const enum llvm::raw_ostream::Colors warningColor = - llvm::raw_ostream::MAGENTA; -static const enum llvm::raw_ostream::Colors errorColor = llvm::raw_ostream::RED; -static const enum llvm::raw_ostream::Colors fatalColor = llvm::raw_ostream::RED; -// Used for changing only the bold attribute. -static const enum llvm::raw_ostream::Colors savedColor = - llvm::raw_ostream::SAVEDCOLOR; +// These declarations are not currently used and will provoke warnings +//static const enum llvm::raw_ostream::Colors noteColor = +// llvm::raw_ostream::BLACK; +//static const enum llvm::raw_ostream::Colors fixitColor = +// llvm::raw_ostream::GREEN; +//static const enum llvm::raw_ostream::Colors caretColor = +// llvm::raw_ostream::GREEN; +//static const enum llvm::raw_ostream::Colors warningColor = +// llvm::raw_ostream::MAGENTA; +//static const enum llvm::raw_ostream::Colors errorColor = llvm::raw_ostream::RED; +//static const enum llvm::raw_ostream::Colors fatalColor = llvm::raw_ostream::RED; +//// Used for changing only the bold attribute. +//static const enum llvm::raw_ostream::Colors savedColor = +// llvm::raw_ostream::SAVEDCOLOR; /// \brief Number of spaces to indent when word-wrapping. const unsigned WordWrapIndentation = 6; |