Browse Source

Clean up a bunch of build warnings.

pull/719/head
Joao Matos 9 years ago
parent
commit
2be56cbf0d
  1. 8
      src/CppParser/Parser.cpp
  2. 6
      tests/CSharp/CSharp.Tests.cs
  3. 7
      tests/CSharp/CSharp.cpp
  4. 4
      tests/CSharp/CSharp.h
  5. 6
      tests/Common/Common.Tests.cs
  6. 2
      tests/Common/Common.h

8
src/CppParser/Parser.cpp

@ -386,6 +386,8 @@ void Parser::SetupHeader() @@ -386,6 +386,8 @@ void Parser::SetupHeader()
case llvm::Triple::Linux:
TC = new clang::driver::toolchains::Linux(D, Target, Args);
break;
default:
break;
}
if (TC && !Opts->NoStandardIncludes) {
@ -2738,6 +2740,8 @@ static clang::TypeLoc DesugarTypeLoc(const clang::TypeLoc& Loc) @@ -2738,6 +2740,8 @@ static clang::TypeLoc DesugarTypeLoc(const clang::TypeLoc& Loc)
auto PTL = Loc.getAs<ParenTypeLoc>();
return PTL.getInnerLoc();
}
default:
break;
}
return Loc;
@ -3546,7 +3550,7 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D, @@ -3546,7 +3550,7 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D,
Typedef->QualifiedType = GetQualifiedType(TD->getUnderlyingType(), &TTL);
AST::TypedefDecl* Existing;
// if the typedef was added along the way, the just created one is useless, delete it
if (Existing = NS->FindTypedef(Name, /*Create=*/false))
if ((Existing = NS->FindTypedef(Name, /*Create=*/false)))
delete Typedef;
else
NS->Typedefs.push_back(Existing = Typedef);
@ -3570,7 +3574,7 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D, @@ -3570,7 +3574,7 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D,
// see above the case for "Typedef"
TypeAlias->QualifiedType = GetQualifiedType(TD->getUnderlyingType(), &TTL);
AST::TypeAlias* Existing;
if (Existing = NS->FindTypeAlias(Name, /*Create=*/false))
if ((Existing = NS->FindTypeAlias(Name, /*Create=*/false)))
delete TypeAlias;
else
NS->TypeAliases.push_back(Existing = TypeAlias);

6
tests/CSharp/CSharp.Tests.cs

@ -19,6 +19,9 @@ public unsafe class CSharpTests : GeneratorTestFixture @@ -19,6 +19,9 @@ public unsafe class CSharpTests : GeneratorTestFixture
[Test]
public void TestUncompilableCode()
{
#pragma warning disable 0168 // warning CS0168: The variable `foo' is declared but never used
#pragma warning disable 0219 // warning CS0219: The variable `foo' is assigned but its value is never used
ALLCAPS_UNDERSCORES a;
using (var testRenaming = new TestRenaming())
{
@ -63,6 +66,9 @@ public unsafe class CSharpTests : GeneratorTestFixture @@ -63,6 +66,9 @@ public unsafe class CSharpTests : GeneratorTestFixture
{
int i = typeMappedWithOperator | 5;
}
#pragma warning restore 0168
#pragma warning restore 0219
}
[Test]

7
tests/CSharp/CSharp.cpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
#include "CSharp.h"
Foo::Foo(char* name)
Foo::Foo(const char* name)
{
A = 10;
P = 50;
@ -264,7 +264,8 @@ long Proprietor::prop() @@ -264,7 +264,8 @@ long Proprietor::prop()
const Baz& Proprietor::covariant()
{
return Baz();
static Baz baz;
return baz;
}
Bar::Items Proprietor::items() const
@ -459,7 +460,7 @@ MethodsWithDefaultValues::QMargins::QMargins(int left, int top, int right, int b @@ -459,7 +460,7 @@ MethodsWithDefaultValues::QMargins::QMargins(int left, int top, int right, int b
{
}
char* MethodsWithDefaultValues::stringConstant = "test";
const char* MethodsWithDefaultValues::stringConstant = "test";
int MethodsWithDefaultValues::intConstant = 5;
MethodsWithDefaultValues::MethodsWithDefaultValues(Foo foo)

4
tests/CSharp/CSharp.h

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
class DLL_API Foo
{
public:
Foo(char* name = 0);
Foo(const char* name = 0);
Foo(int a, int p = 0);
int method();
int operator[](int i) const;
@ -382,7 +382,7 @@ public: @@ -382,7 +382,7 @@ public:
QMargins(int left, int top, int right, int bottom);
};
static char* stringConstant;
static const char* stringConstant;
static int intConstant;
MethodsWithDefaultValues(Foo foo = Foo());

6
tests/Common/Common.Tests.cs

@ -10,6 +10,9 @@ public class CommonTests : GeneratorTestFixture @@ -10,6 +10,9 @@ public class CommonTests : GeneratorTestFixture
[Test]
public void TestCodeGeneration()
{
#pragma warning disable 0168 // warning CS0168: The variable `foo' is declared but never used
#pragma warning disable 0219 // warning CS0219: The variable `foo' is assigned but its value is never used
Assert.That(new ChangedAccessOfInheritedProperty().property, Is.EqualTo(2));
Foo.NestedAbstract a;
var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;
@ -31,6 +34,9 @@ public class CommonTests : GeneratorTestFixture @@ -31,6 +34,9 @@ public class CommonTests : GeneratorTestFixture
using (var hasProtectedEnum = new HasProtectedEnum())
{
}
#pragma warning restore 0168
#pragma warning restore 0219
}
[Test]

2
tests/Common/Common.h

@ -1079,7 +1079,7 @@ public: @@ -1079,7 +1079,7 @@ public:
DerivedFromTemplateInstantiationWithVirtual();
};
typedef DLL_API union
typedef union
{
int c;
} union_t;

Loading…
Cancel
Save