aboutsummaryrefslogtreecommitdiff
path: root/internal/crt2
diff options
context:
space:
mode:
Diffstat (limited to 'internal/crt2')
-rw-r--r--internal/crt2/Makefile68
-rw-r--r--internal/crt2/all_test.go56
-rw-r--r--internal/crt2/capi_linux_amd64.go23
-rw-r--r--internal/crt2/crt2.go130
4 files changed, 0 insertions, 277 deletions
diff --git a/internal/crt2/Makefile b/internal/crt2/Makefile
deleted file mode 100644
index a54e63b..0000000
--- a/internal/crt2/Makefile
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright 2019 The Sqlite Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-.PHONY: all clean cover cpu editor internalError later mem nuke todo edit
-
-grep=--include=*.go --include=*.l --include=*.y --include=*.yy
-ngrep='TODOOK\|internal\/bin'
-
-all: editor
- date
- go version 2>&1 | tee log
- gofmt -l -s -w *.go
- go test -i
- go test 2>&1 -timeout 1h | tee -a log
- #TODO GOOS=linux GOARCH=arm go build
- #TODO GOOS=linux GOARCH=arm64 go build
- #TODO GOOS=linux GOARCH=386 go build
- GOOS=linux GOARCH=amd64 go build
- #TODO GOOS=windows GOARCH=386 go build
- #TODO GOOS=windows GOARCH=amd64 go build
- go vet 2>&1 | grep -v $(ngrep) || true
- golint 2>&1 | grep -v $(ngrep) || true
- make todo
- misspell *.go
- staticcheck | grep -v 'lexer\.go\|parser\.go' || true
- maligned || true
- grep -n 'FAIL\|PASS' log
- go version
- date 2>&1 | tee -a log
-
-clean:
- go clean
- rm -f *~ *.test *.out test.db* tt4-test*.db* test_sv.* testdb-*
-
-cover:
- t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
-
-cpu: clean
- go test -run @ -bench . -cpuprofile cpu.out
- go tool pprof -lines *.test cpu.out
-
-edit:
- gvim -p Makefile *.go &
-
-editor:
- gofmt -l -s -w *.go
- go test 2>&1 | tee log
-
-internalError:
- egrep -ho '"internal error.*"' *.go | sort | cat -n
-
-later:
- @grep -n $(grep) LATER * || true
- @grep -n $(grep) MAYBE * || true
-
-mem: clean
- go test -run @ -bench . -memprofile mem.out
- go tool pprof -lines -web -alloc_space *.test mem.out
-
-nuke: clean
- go clean -i
-
-todo:
- @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
- @grep -nr $(grep) TODO * | grep -v $(ngrep) || true
- @grep -nr $(grep) BUG * | grep -v $(ngrep) || true
- @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
diff --git a/internal/crt2/all_test.go b/internal/crt2/all_test.go
deleted file mode 100644
index 8a63443..0000000
--- a/internal/crt2/all_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2019 The Sqlite Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package crt2 // import "modernc.org/sqlite/internal/crt2"
-
-import (
- "fmt"
- "os"
- "path"
- "runtime"
- "strings"
- "testing"
-)
-
-func caller(s string, va ...interface{}) {
- if s == "" {
- s = strings.Repeat("%v ", len(va))
- }
- _, fn, fl, _ := runtime.Caller(2)
- fmt.Fprintf(os.Stderr, "# caller: %s:%d: ", path.Base(fn), fl)
- fmt.Fprintf(os.Stderr, s, va...)
- fmt.Fprintln(os.Stderr)
- _, fn, fl, _ = runtime.Caller(1)
- fmt.Fprintf(os.Stderr, "# \tcallee: %s:%d: ", path.Base(fn), fl)
- fmt.Fprintln(os.Stderr)
- os.Stderr.Sync()
-}
-
-func dbg(s string, va ...interface{}) {
- if s == "" {
- s = strings.Repeat("%v ", len(va))
- }
- _, fn, fl, _ := runtime.Caller(1)
- fmt.Fprintf(os.Stderr, "# dbg %s:%d: ", path.Base(fn), fl)
- fmt.Fprintf(os.Stderr, s, va...)
- fmt.Fprintln(os.Stderr)
- os.Stderr.Sync()
-}
-
-func TODO(...interface{}) string { //TODOOK
- _, fn, fl, _ := runtime.Caller(1)
- return fmt.Sprintf("# TODO: %s:%d:\n", path.Base(fn), fl) //TODOOK
-}
-
-func use(...interface{}) {}
-
-func init() {
- use(caller, dbg, TODO) //TODOOK
-}
-
-// ============================================================================
-
-func Test(t *testing.T) {
- t.Log("TODO")
-}
diff --git a/internal/crt2/capi_linux_amd64.go b/internal/crt2/capi_linux_amd64.go
deleted file mode 100644
index 27b0039..0000000
--- a/internal/crt2/capi_linux_amd64.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2020 The Sqlite Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package crt2 // import "modernc.org/sqlite/internal/crt2"
-
-var CAPI = map[string]struct{}{
- "ferror": {},
- "fstat": {},
- "pthread_cond_broadcast": {},
- "pthread_cond_destroy": {},
- "pthread_cond_init": {},
- "pthread_cond_signal": {},
- "pthread_cond_wait": {},
- "pthread_create": {},
- "pthread_detach": {},
- "pthread_mutex_destroy": {},
- "pthread_mutex_init": {},
- "pthread_mutex_lock": {},
- "pthread_mutex_trylock": {},
- "pthread_mutex_unlock": {},
- "sched_yield": {},
-}
diff --git a/internal/crt2/crt2.go b/internal/crt2/crt2.go
deleted file mode 100644
index bffe76b..0000000
--- a/internal/crt2/crt2.go
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2020 The Sqlite Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package crt2 // import "modernc.org/sqlite/internal/crt2"
-
-import (
- "fmt"
- "os"
- "runtime"
- "strings"
-
- "modernc.org/crt/v3"
-)
-
-func todo(s string, args ...interface{}) string { //TODO-
- switch {
- case s == "":
- s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
- default:
- s = fmt.Sprintf(s, args...)
- }
- pc, fn, fl, _ := runtime.Caller(1)
- f := runtime.FuncForPC(pc)
- var fns string
- if f != nil {
- fns = f.Name()
- if x := strings.LastIndex(fns, "."); x > 0 {
- fns = fns[x+1:]
- }
- }
- r := fmt.Sprintf("%s:%d:%s: TODOTODO %s", fn, fl, fns, s) //TODOOK
- fmt.Fprintf(os.Stdout, "%s\n", r)
- os.Stdout.Sync()
- return r
-}
-
-func trc(s string, args ...interface{}) string { //TODO-
- switch {
- case s == "":
- s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
- default:
- s = fmt.Sprintf(s, args...)
- }
- _, fn, fl, _ := runtime.Caller(1)
- r := fmt.Sprintf("\n%s:%d: TRC %s", fn, fl, s)
- fmt.Fprintf(os.Stdout, "%s\n", r)
- os.Stdout.Sync()
- return r
-}
-
-// int sched_yield(void);
-func Xsched_yield(tls *crt.TLS) int32 {
- panic(todo(""))
-}
-
-// int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
-func Xpthread_create(tls *crt.TLS, thread, attr, start_routine, arg uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_detach(pthread_t thread);
-func Xpthread_detach(tls *crt.TLS, thread crt.Size_t) int32 {
- panic(todo(""))
-}
-
-// int ferror(FILE *stream);
-func Xferror(tls *crt.TLS, stream uintptr) int32 {
- panic(todo(""))
-}
-
-// int fstat(int fd, struct stat *statbuf);
-func Xfstat(tls *crt.TLS, fd int32, statbuf uintptr) int32 {
- panic(todo(""))
-}
-
-// // int rename(const char *oldpath, const char *newpath);
-// func Xrename(tls *crt.TLS, oldpath, newpath uintptr) int32 {
-// panic(todo(""))
-// }
-
-// int pthread_mutex_lock(pthread_mutex_t *mutex);
-func Xpthread_mutex_lock(tls *crt.TLS, mutex uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_cond_signal(pthread_cond_t *cond);
-func Xpthread_cond_signal(tls *crt.TLS, cond uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_mutex_unlock(pthread_mutex_t *mutex);
-func Xpthread_mutex_unlock(tls *crt.TLS, mutex uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
-func Xpthread_mutex_init(tls *crt.TLS, mutex, attr uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);
-func Xpthread_cond_init(tls *crt.TLS, cond, attr uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
-func Xpthread_cond_wait(tls *crt.TLS, cond, mutex uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_cond_destroy(pthread_cond_t *cond);
-func Xpthread_cond_destroy(tls *crt.TLS, cond uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_mutex_destroy(pthread_mutex_t *mutex);
-func Xpthread_mutex_destroy(tls *crt.TLS, mutex uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_mutex_trylock(pthread_mutex_t *mutex);
-func Xpthread_mutex_trylock(tls *crt.TLS, mutex uintptr) int32 {
- panic(todo(""))
-}
-
-// int pthread_cond_broadcast(pthread_cond_t *cond);
-func Xpthread_cond_broadcast(tls *crt.TLS, cond uintptr) int32 {
- panic(todo(""))
-}