Skip to content

Commit c23bc89

Browse files
committed
Clean all warnings in the non-generated C#
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 78ed7c7 commit c23bc89

File tree

4 files changed

+3
-24
lines changed

4 files changed

+3
-24
lines changed

src/Generator/Generators/C/CCodeGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public virtual string GetMethodIdentifier(Function function,
307307
if (method.OperatorKind == CXXOperatorKind.Star)
308308
{
309309
CTypePrinter.PushContext(TypePrinterContextKind.Native);
310-
var conversionType = method.ReturnType.Visit(CTypePrinter);
310+
method.ReturnType.Visit(CTypePrinter);
311311
CTypePrinter.PopContext();
312312
}
313313

src/Generator/Generators/C/CppHeaders.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ public override bool VisitFieldDecl(Field field)
419419

420420
GenerateDeclarationCommon(field);
421421

422-
var @class = field.Namespace as Class;
423422
var fieldType = field.Type.Visit(CTypePrinter);
424423
WriteLine($"{fieldType} {field.Name};");
425424

src/Generator/Generators/CLI/CLITemplate.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using CppSharp.AST;
43
using CppSharp.Generators.C;
@@ -12,34 +11,15 @@ namespace CppSharp.Generators.CLI
1211
/// </summary>
1312
public abstract class CLITemplate : CCodeGenerator
1413
{
15-
public ISet<CInclude> Includes;
16-
1714
protected CLITemplate(BindingContext context, IEnumerable<TranslationUnit> units)
18-
: base(context, units)
19-
{
20-
typePrinter = new CLITypePrinter(context);
21-
Includes = new HashSet<CInclude>();
22-
}
15+
: base(context, units) => typePrinter = new CLITypePrinter(context);
2316

2417
public abstract override string FileExtension { get; }
2518

2619
public abstract override void Process();
2720

2821
#region Helpers
2922

30-
public string QualifiedIdentifier(Declaration decl)
31-
{
32-
if (!string.IsNullOrEmpty(TranslationUnit.Module.OutputNamespace))
33-
{
34-
if (string.IsNullOrEmpty(decl.QualifiedName))
35-
return $"{decl.TranslationUnit.Module.OutputNamespace}";
36-
37-
return $"{decl.TranslationUnit.Module.OutputNamespace}::{decl.QualifiedName}";
38-
}
39-
40-
return decl.QualifiedName;
41-
}
42-
4323
public string GetMethodName(Method method)
4424
{
4525
if (method.OperatorKind == CXXOperatorKind.Conversion ||

tests/CSharp/CSharp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ where macroRegex.IsMatch(macro.Name)
5656
select macro.Name).ToList();
5757
var enumTest = ctx.GenerateEnumFromMacros("MyMacroTestEnum", list.ToArray());
5858

59-
var enumTest2 = ctx.GenerateEnumFromMacros("MyMacroTest2Enum", "MY_MACRO_TEST2_*");
59+
ctx.GenerateEnumFromMacros("MyMacroTest2Enum", "MY_MACRO_TEST2_*");
6060

6161
enumTest.Namespace = new Namespace()
6262
{

0 commit comments

Comments
 (0)