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

6
tests/CSharp/CSharp.Tests.cs

@ -19,6 +19,9 @@ public unsafe class CSharpTests : GeneratorTestFixture
[Test] [Test]
public void TestUncompilableCode() 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; ALLCAPS_UNDERSCORES a;
using (var testRenaming = new TestRenaming()) using (var testRenaming = new TestRenaming())
{ {
@ -63,6 +66,9 @@ public unsafe class CSharpTests : GeneratorTestFixture
{ {
int i = typeMappedWithOperator | 5; int i = typeMappedWithOperator | 5;
} }
#pragma warning restore 0168
#pragma warning restore 0219
} }
[Test] [Test]

7
tests/CSharp/CSharp.cpp

@ -1,6 +1,6 @@
#include "CSharp.h" #include "CSharp.h"
Foo::Foo(char* name) Foo::Foo(const char* name)
{ {
A = 10; A = 10;
P = 50; P = 50;
@ -264,7 +264,8 @@ long Proprietor::prop()
const Baz& Proprietor::covariant() const Baz& Proprietor::covariant()
{ {
return Baz(); static Baz baz;
return baz;
} }
Bar::Items Proprietor::items() const Bar::Items Proprietor::items() const
@ -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; int MethodsWithDefaultValues::intConstant = 5;
MethodsWithDefaultValues::MethodsWithDefaultValues(Foo foo) MethodsWithDefaultValues::MethodsWithDefaultValues(Foo foo)

4
tests/CSharp/CSharp.h

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

6
tests/Common/Common.Tests.cs

@ -10,6 +10,9 @@ public class CommonTests : GeneratorTestFixture
[Test] [Test]
public void TestCodeGeneration() 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)); Assert.That(new ChangedAccessOfInheritedProperty().property, Is.EqualTo(2));
Foo.NestedAbstract a; Foo.NestedAbstract a;
var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1; var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;
@ -31,6 +34,9 @@ public class CommonTests : GeneratorTestFixture
using (var hasProtectedEnum = new HasProtectedEnum()) using (var hasProtectedEnum = new HasProtectedEnum())
{ {
} }
#pragma warning restore 0168
#pragma warning restore 0219
} }
[Test] [Test]

2
tests/Common/Common.h

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

Loading…
Cancel
Save