aboutsummaryrefslogtreecommitdiff
path: root/internal/threadtest1
diff options
context:
space:
mode:
authorJan Mercl <0xjnml@gmail.com>2017-07-08 17:10:53 +0200
committerJan Mercl <0xjnml@gmail.com>2017-07-08 17:10:53 +0200
commit4becaacb9775939bdb8891d8c00e30d22b2ff447 (patch)
treef40dd34845a5d2486ea0ecd060f306e6d615ad60 /internal/threadtest1
parenta46bafc8c8bdbf52b6880b4183651971650d0881 (diff)
Regenerate Linux/amd64 using latest CCGO.
modified: generator.go modified: internal/bin/bin_linux_amd64.go modified: internal/mptest/mptest_linux_amd64.go modified: internal/threadtest1/threadtest1_linux_amd64.go modified: internal/threadtest2/threadtest2_linux_amd64.go modified: internal/threadtest3/threadtest3_linux_amd64.go modified: internal/threadtest4/threadtest4_linux_amd64.go
Diffstat (limited to 'internal/threadtest1')
-rw-r--r--internal/threadtest1/threadtest1_linux_amd64.go159
1 files changed, 90 insertions, 69 deletions
diff --git a/internal/threadtest1/threadtest1_linux_amd64.go b/internal/threadtest1/threadtest1_linux_amd64.go
index abd6721..5295cec 100644
--- a/internal/threadtest1/threadtest1_linux_amd64.go
+++ b/internal/threadtest1/threadtest1_linux_amd64.go
@@ -1,29 +1,29 @@
// Code generated by ccgo. DO NOT EDIT.
-// threadtest1.c
-
-// 2002 January 15
-//
-// The author disclaims copyright to this source code. In place of
-// a legal notice, here is a blessing:
-//
-// May you do good and not evil.
-// May you find forgiveness for yourself and forgive others.
-// May you share freely, never taking more than you give.
-//
-// *************************************************************************
-// This file implements a simple standalone program used to test whether
-// or not the SQLite library is threadsafe.
-//
-// Testing the thread safety of SQLite is difficult because there are very
-// few places in the code that are even potentially unsafe, and those
-// places execute for very short periods of time. So even if the library
-// is compiled with its mutexes disabled, it is likely to work correctly
-// in a multi-threaded program most of the time.
-//
-// This file is NOT part of the standard SQLite library. It is used for
-// testing only.
-
+// threadtest1
+// /*
+// ** 2002 January 15
+// **
+// ** The author disclaims copyright to this source code. In place of
+// ** a legal notice, here is a blessing:
+// **
+// ** May you do good and not evil.
+// ** May you find forgiveness for yourself and forgive others.
+// ** May you share freely, never taking more than you give.
+// **
+// *************************************************************************
+// ** This file implements a simple standalone program used to test whether
+// ** or not the SQLite library is threadsafe.
+// **
+// ** Testing the thread safety of SQLite is difficult because there are very
+// ** few places in the code that are even potentially unsafe, and those
+// ** places execute for very short periods of time. So even if the library
+// ** is compiled with its mutexes disabled, it is likely to work correctly
+// ** in a multi-threaded program most of the time.
+// **
+// ** This file is NOT part of the standard SQLite library. It is used for
+// ** testing only.
+// */
package main
import (
@@ -61,13 +61,13 @@ var X__stdfiles [3]unsafe.Pointer
var Xstdout unsafe.Pointer
func init() {
- Xstdout = (unsafe.Pointer)(uintptr(unsafe.Pointer(&X__stdfiles)) + 8)
+ Xstdout = unsafe.Pointer(uintptr(unsafe.Pointer(&X__stdfiles)) + 8)
}
var Xstderr unsafe.Pointer
func init() {
- Xstderr = (unsafe.Pointer)(uintptr(unsafe.Pointer(&X__stdfiles)) + 16)
+ Xstderr = unsafe.Pointer(uintptr(unsafe.Pointer(&X__stdfiles)) + 16)
}
func Xmain(tls *crt.TLS, _argc int32, _argv **int8) (r0 int32) {
@@ -76,13 +76,13 @@ func Xmain(tls *crt.TLS, _argc int32, _argv **int8) (r0 int32) {
var _zFile, _4_zDb, _4_zJournal *int8
var _2_zBuf, _6_zBuf [200]int8
r0 = i32(0)
- if (_argc > i32(2)) && (crt.Xstrcmp(tls, *(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_argv)) + 8*uintptr(i32(1)))), str(0)) == i32(0)) {
+ if (_argc > i32(2)) && (crt.Xstrcmp(tls, *(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv)) + 8*uintptr(i32(1)))), str(0)) == i32(0)) {
_verbose = i32(1)
bug20530(_verbose)
_argc -= 1
*(*uintptr)(unsafe.Pointer(&_argv)) += uintptr(8)
}
- if (_argc < i32(2)) || (store0(&_n, crt.Xatoi(tls, *(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_argv)) + 8*uintptr(i32(1)))))) < i32(1)) {
+ if (_argc < i32(2)) || (store0(&_n, crt.Xatoi(tls, *(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv)) + 8*uintptr(i32(1)))))) < i32(1)) {
_n = i32(10)
}
_i = i32(0)
@@ -102,13 +102,13 @@ _8:
}
_zFile = bin.Xsqlite3_mprintf(tls, str(13), (_i%i32(2))+i32(1), (_i+i32(2))/i32(2))
if (_i % i32(2)) == i32(0) {
- _4_zDb = (*int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_zFile)) + 1*uintptr(i32(2))))
+ _4_zDb = (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zFile)) + 1*uintptr(i32(2))))
_4_zJournal = bin.Xsqlite3_mprintf(tls, str(26), unsafe.Pointer(_4_zDb))
crt.Xunlink(tls, _4_zDb)
crt.Xunlink(tls, _4_zJournal)
- crt.Xfree(tls, (unsafe.Pointer)(_4_zJournal))
+ crt.Xfree(tls, unsafe.Pointer(_4_zJournal))
}
- crt.Xpthread_create(tls, &_id, nil, _worker_bee, (unsafe.Pointer)(_zFile))
+ crt.Xpthread_create(tls, &_id, nil, _worker_bee, unsafe.Pointer(_zFile))
crt.Xpthread_detach(tls, _id)
_i += 1
goto _8
@@ -157,12 +157,12 @@ _0:
if _cnt >= i32(10) {
goto _3
}
- bin.Xsqlite3_open(tls, (*int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_zFilename))+1*uintptr(i32(2)))), (**bin.Xsqlite3)(unsafe.Pointer(&_db)))
+ bin.Xsqlite3_open(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zFilename))+1*uintptr(i32(2)))), (**bin.Xsqlite3)(unsafe.Pointer(&_db)))
if _db == nil {
crt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(48), unsafe.Pointer(_zFilename))
_Exit(tls, i32(1))
}
- bin.Xsqlite3_busy_handler(tls, (*bin.Xsqlite3)(_db), _db_is_locked, (unsafe.Pointer)(_zFilename))
+ bin.Xsqlite3_busy_handler(tls, (*bin.Xsqlite3)(_db), _db_is_locked, unsafe.Pointer(_zFilename))
Xdb_execute(tls, _db, _zFilename, str(64), _t)
_i = i32(1)
_5:
@@ -217,12 +217,18 @@ var Xlock crt.Xpthread_mutex_t
var Xthread_cnt int32
-// Come here to die.
+// C comment
+// /*
+// ** Come here to die.
+// */
func _Exit(tls *crt.TLS, _rc int32) {
crt.Xexit(tls, _rc)
}
-// When a lock occurs, yield.
+// C comment
+// /*
+// ** When a lock occurs, yield.
+// */
func _db_is_locked(tls *crt.TLS, _NotUsed unsafe.Pointer, _iCount int32) (r0 int32) {
if _verbose != 0 {
crt.Xprintf(tls, str(305), unsafe.Pointer((*int8)(_NotUsed)), _iCount)
@@ -231,7 +237,10 @@ func _db_is_locked(tls *crt.TLS, _NotUsed unsafe.Pointer, _iCount int32) (r0 int
return bool2int(_iCount < i32(40000))
}
-// Execute an SQL statement.
+// C comment
+// /*
+// ** Execute an SQL statement.
+// */
func Xdb_execute(tls *crt.TLS, _db unsafe.Pointer, _zFile *int8, _zFormat *int8, args ...interface{}) {
var _rc int32
var _zSql, _zErrMsg *int8
@@ -253,15 +262,18 @@ _0:
}
if _zErrMsg != nil {
crt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(344), unsafe.Pointer(_zFile), unsafe.Pointer(_zSql), unsafe.Pointer(_zErrMsg))
- crt.Xfree(tls, (unsafe.Pointer)(_zErrMsg))
- bin.Xsqlite3_free(tls, (unsafe.Pointer)(_zSql))
+ crt.Xfree(tls, unsafe.Pointer(_zErrMsg))
+ bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
_Exit(tls, i32(1))
}
- bin.Xsqlite3_free(tls, (unsafe.Pointer)(_zSql))
+ bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
}
-// Execute a query against the database. NULL values are returned
-// as an empty string. The list is terminated by a single NULL pointer.
+// C comment
+// /*
+// ** Execute a query against the database. NULL values are returned
+// ** as an empty string. The list is terminated by a single NULL pointer.
+// */
func Xdb_query(tls *crt.TLS, _db unsafe.Pointer, _zFile *int8, _zFormat *int8, args ...interface{}) (r0 **int8) {
var _rc int32
var _zSql, _zErrMsg *int8
@@ -271,56 +283,59 @@ func Xdb_query(tls *crt.TLS, _db unsafe.Pointer, _zFile *int8, _zFormat *int8, a
_ap = args
_zSql = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
_ap = nil
- crt.Xmemset(tls, (unsafe.Pointer)(&_sResult), i32(0), u64(24))
- *(**int8)(unsafe.Pointer(&(_sResult.X0))) = _zFile
+ crt.Xmemset(tls, unsafe.Pointer(&_sResult), i32(0), u64(24))
+ *(**int8)(unsafe.Pointer(&_sResult.X0)) = _zFile
if _verbose != 0 {
crt.Xprintf(tls, str(373), unsafe.Pointer(_zFile), unsafe.Pointer(_zSql))
}
- _rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_db), _zSql, _db_query_callback, (unsafe.Pointer)(&_sResult), &_zErrMsg)
+ _rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_db), _zSql, _db_query_callback, unsafe.Pointer(&_sResult), &_zErrMsg)
if _rc != i32(17) {
goto _1
}
if _zErrMsg != nil {
- crt.Xfree(tls, (unsafe.Pointer)(_zErrMsg))
+ crt.Xfree(tls, unsafe.Pointer(_zErrMsg))
}
- _rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_db), _zSql, _db_query_callback, (unsafe.Pointer)(&_sResult), &_zErrMsg)
+ _rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_db), _zSql, _db_query_callback, unsafe.Pointer(&_sResult), &_zErrMsg)
_1:
if _verbose != 0 {
crt.Xprintf(tls, str(387), unsafe.Pointer(_zFile), unsafe.Pointer(_zSql))
}
if _zErrMsg != nil {
crt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(399), unsafe.Pointer(_zFile), unsafe.Pointer(_zSql), unsafe.Pointer(_zErrMsg))
- crt.Xfree(tls, (unsafe.Pointer)(_zErrMsg))
- crt.Xfree(tls, (unsafe.Pointer)(_zSql))
+ crt.Xfree(tls, unsafe.Pointer(_zErrMsg))
+ crt.Xfree(tls, unsafe.Pointer(_zSql))
_Exit(tls, i32(1))
}
- bin.Xsqlite3_free(tls, (unsafe.Pointer)(_zSql))
- if (_sResult.X3) == nil {
- _db_query_callback(tls, (unsafe.Pointer)(&_sResult), i32(0), nil, nil)
+ bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
+ if _sResult.X3 == nil {
+ _db_query_callback(tls, unsafe.Pointer(&_sResult), i32(0), nil, nil)
}
- *(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_sResult.X3)) + 8*uintptr(_sResult.X1))) = nil
+ *(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_sResult.X3)) + 8*uintptr(_sResult.X1))) = nil
return _sResult.X3
_ = _sResult
panic(0)
}
-// The callback function for db_query
+// C comment
+// /*
+// ** The callback function for db_query
+// */
func _db_query_callback(tls *crt.TLS, _pUser unsafe.Pointer, _nArg int32, _azArg **int8, _NotUsed **int8) (r0 int32) {
var _i int32
var _pResult *TQueryResult
_pResult = (*TQueryResult)(_pUser)
- if ((_pResult.X1) + _nArg) < (_pResult.X2) {
+ if (_pResult.X1 + _nArg) < _pResult.X2 {
goto _0
}
- if (_pResult.X2) == i32(0) {
- *(*int32)(unsafe.Pointer(&(_pResult.X2))) = _nArg + i32(1)
+ if _pResult.X2 == i32(0) {
+ *(*int32)(unsafe.Pointer(&_pResult.X2)) = _nArg + i32(1)
goto _2
}
- *(*int32)(unsafe.Pointer(&(_pResult.X2))) = (((_pResult.X2) * i32(2)) + _nArg) + i32(1)
+ *(*int32)(unsafe.Pointer(&_pResult.X2)) = ((_pResult.X2 * i32(2)) + _nArg) + i32(1)
_2:
- *(***int8)(unsafe.Pointer(&(_pResult.X3))) = (**int8)(crt.Xrealloc(tls, (unsafe.Pointer)(_pResult.X3), uint64(_pResult.X2)*u64(8)))
- if (_pResult.X3) == nil {
+ *(***int8)(unsafe.Pointer(&_pResult.X3)) = (**int8)(crt.Xrealloc(tls, unsafe.Pointer(_pResult.X3), uint64(_pResult.X2)*u64(8)))
+ if _pResult.X3 == nil {
crt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(426), unsafe.Pointer(_pResult.X0))
return i32(1)
}
@@ -333,9 +348,9 @@ _5:
if _i >= _nArg {
goto _8
}
- *(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_pResult.X3)) + 8*uintptr(postInc0((*int32)(unsafe.Pointer(&(_pResult.X1))), int32(1))))) = bin.Xsqlite3_mprintf(tls, str(445), unsafe.Pointer(func() *int8 {
- if (*(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_azArg)) + 8*uintptr(_i)))) != nil {
- return (*(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_azArg)) + 8*uintptr(_i))))
+ *(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_pResult.X3)) + 8*uintptr(postInc0((*int32)(unsafe.Pointer(&_pResult.X1)), 1)))) = bin.Xsqlite3_mprintf(tls, str(445), unsafe.Pointer(func() *int8 {
+ if (*(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_azArg)) + 8*uintptr(_i)))) != nil {
+ return (*(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_azArg)) + 8*uintptr(_i))))
}
return str(448)
}()))
@@ -345,7 +360,10 @@ _8:
return i32(0)
}
-// Check results
+// C comment
+// /*
+// ** Check results
+// */
func Xdb_check(tls *crt.TLS, _zFile *int8, _zMsg *int8, _az **int8, args ...interface{}) {
var _i int32
var _z *int8
@@ -356,8 +374,8 @@ _0:
if store1(&_z, (*int8)(crt.VAPointer(&_ap))) == nil {
goto _3
}
- if ((*(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_az)) + 8*uintptr(_i)))) == nil) || (crt.Xstrcmp(tls, *(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_az)) + 8*uintptr(_i))), _z) != i32(0)) {
- crt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(449), unsafe.Pointer(_zFile), unsafe.Pointer(_zMsg), _i+i32(1), unsafe.Pointer(*(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_az)) + 8*uintptr(_i)))))
+ if ((*(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_az)) + 8*uintptr(_i)))) == nil) || (crt.Xstrcmp(tls, *(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_az)) + 8*uintptr(_i))), _z) != i32(0)) {
+ crt.Xfprintf(tls, (*crt.XFILE)(Xstdout), str(449), unsafe.Pointer(_zFile), unsafe.Pointer(_zMsg), _i+i32(1), unsafe.Pointer(*(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_az)) + 8*uintptr(_i)))))
Xdb_query_free(tls, _az)
_Exit(tls, i32(1))
}
@@ -368,19 +386,22 @@ _3:
Xdb_query_free(tls, _az)
}
-// Free the results of a db_query() call.
+// C comment
+// /*
+// ** Free the results of a db_query() call.
+// */
func Xdb_query_free(tls *crt.TLS, _az **int8) {
var _i int32
_i = i32(0)
_0:
- if (*(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_az)) + 8*uintptr(_i)))) == nil {
+ if (*(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_az)) + 8*uintptr(_i)))) == nil {
goto _3
}
- bin.Xsqlite3_free(tls, (unsafe.Pointer)(*(**int8)(unsafe.Pointer(uintptr((unsafe.Pointer)(_az)) + 8*uintptr(_i)))))
+ bin.Xsqlite3_free(tls, unsafe.Pointer(*(**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_az)) + 8*uintptr(_i)))))
_i += 1
goto _0
_3:
- crt.Xfree(tls, (unsafe.Pointer)(_az))
+ crt.Xfree(tls, unsafe.Pointer(_az))
}
var Xsig crt.Xpthread_cond_t