mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
genbindings: Lint cleanup
This commit is contained in:
parent
4669ec0632
commit
a067210548
@ -890,10 +890,7 @@ func parseSingleTypeString(p string) CppParameter {
|
||||
}
|
||||
}
|
||||
insert.ParameterType = strings.TrimSpace(insert.ParameterType)
|
||||
|
||||
if strings.HasPrefix(insert.ParameterType, `::`) {
|
||||
insert.ParameterType = insert.ParameterType[2:]
|
||||
}
|
||||
insert.ParameterType = strings.TrimPrefix(insert.ParameterType, "::")
|
||||
|
||||
return insert
|
||||
}
|
||||
|
@ -42,11 +42,7 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
func(fullpath string) bool {
|
||||
// Only include the same json, xml, cbor files excluded above
|
||||
fname := filepath.Base(fullpath)
|
||||
if strings.HasPrefix(fname, "qcbor") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return strings.HasPrefix(fname, "qcbor")
|
||||
},
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt5Core"),
|
||||
@ -156,11 +152,7 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
func(fullpath string) bool {
|
||||
// Only include the same json, xml, cbor files excluded above
|
||||
fname := filepath.Base(fullpath)
|
||||
if strings.HasPrefix(fname, "qcbor") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return strings.HasPrefix(fname, "qcbor")
|
||||
},
|
||||
clangBin,
|
||||
pkgConfigCflags("Qt6Core"),
|
||||
@ -189,10 +181,7 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
},
|
||||
func(fullpath string) bool {
|
||||
fname := filepath.Base(fullpath)
|
||||
if fname == "qtnetwork-config.h" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return fname != "qtnetwork-config.h"
|
||||
},
|
||||
clangBin,
|
||||
"--std=c++17 "+pkgConfigCflags("Qt6Network"),
|
||||
|
@ -839,7 +839,7 @@ import "C"
|
||||
// Fixup imports
|
||||
if len(gfs.imports) > 0 {
|
||||
allImports := make([]string, 0, len(gfs.imports))
|
||||
for k, _ := range gfs.imports {
|
||||
for k := range gfs.imports {
|
||||
if k == "libmiqt" {
|
||||
allImports = append(allImports, `"`+BaseModule+`/libmiqt"`)
|
||||
} else {
|
||||
|
@ -307,13 +307,8 @@ func (nm CppMethod) IsReceiverMethod() bool {
|
||||
}
|
||||
|
||||
func (nm CppMethod) SafeMethodName() string {
|
||||
|
||||
tmp := nm.MethodName
|
||||
|
||||
// Strip redundant Qt prefix, we know these are all Qt functions
|
||||
if strings.HasPrefix(tmp, "qt_") {
|
||||
tmp = tmp[3:]
|
||||
}
|
||||
tmp := strings.TrimPrefix(nm.MethodName, "qt_")
|
||||
|
||||
// Operator-overload methods have names not representable in binding
|
||||
// languages. Replace more specific cases first
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
@ -133,7 +132,7 @@ func generate(packageName string, srcDirs []string, allowHeaderFn func(string) b
|
||||
|
||||
cacheFile := cacheFilePath(inputHeader)
|
||||
|
||||
astJson, err := ioutil.ReadFile(cacheFile)
|
||||
astJson, err := os.ReadFile(cacheFile)
|
||||
if err != nil {
|
||||
panic("Expected cache to be created for " + inputHeader + ", but got error " + err.Error())
|
||||
}
|
||||
@ -197,7 +196,7 @@ func generate(packageName string, srcDirs []string, allowHeaderFn func(string) b
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(cacheFilePath(parsed.Filename)+".ours.json", jb, 0644)
|
||||
err = os.WriteFile(cacheFilePath(parsed.Filename)+".ours.json", jb, 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -236,7 +235,7 @@ func generate(packageName string, srcDirs []string, allowHeaderFn func(string) b
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(outputName+".go", []byte(goSrc), 0644)
|
||||
err = os.WriteFile(outputName+".go", []byte(goSrc), 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -246,7 +245,7 @@ func generate(packageName string, srcDirs []string, allowHeaderFn func(string) b
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(outputName+".cpp", []byte(bindingCppSrc), 0644)
|
||||
err = os.WriteFile(outputName+".cpp", []byte(bindingCppSrc), 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -256,7 +255,7 @@ func generate(packageName string, srcDirs []string, allowHeaderFn func(string) b
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(outputName+".h", []byte(bindingHSrc), 0644)
|
||||
err = os.WriteFile(outputName+".h", []byte(bindingHSrc), 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -270,7 +269,7 @@ func generate(packageName string, srcDirs []string, allowHeaderFn func(string) b
|
||||
|
||||
func generateClangCaches(includeFiles []string, clangBin string, cflags []string, matcher ClangMatcher) {
|
||||
|
||||
var clangChan = make(chan string, 0)
|
||||
var clangChan = make(chan string)
|
||||
var clangWg sync.WaitGroup
|
||||
ctx := context.Background()
|
||||
|
||||
@ -298,7 +297,7 @@ func generateClangCaches(includeFiles []string, clangBin string, cflags []string
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(cacheFilePath(inputHeader), jb, 0644)
|
||||
err = os.WriteFile(cacheFilePath(inputHeader), jb, 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user