Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WARNING] sqlite3-binding.c: In function ‘sqlite3SelectNew’ #822

Open
vzool opened this issue Jun 7, 2020 · 4 comments
Open

[WARNING] sqlite3-binding.c: In function ‘sqlite3SelectNew’ #822

vzool opened this issue Jun 7, 2020 · 4 comments

Comments

@vzool
Copy link

vzool commented Jun 7, 2020

Hi, while I'm developing an appliation using gorm I noticed new messages shown in my terminal and said there is an issues in this package:

# github.com/mattn/go-sqlite3
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:128049:10: warning: function may return address of local variable [-Wreturn-local-addr]
128049 |   return pNew;
       |          ^~~~
sqlite3-binding.c:128009:10: note: declared here
128009 |   Select standin;
       |          ^~~~~~~

I hope this message helps you out to fix the issue. Thanks

@vzool
Copy link
Author

vzool commented Jun 7, 2020

#803

@miguelmota
Copy link
Sponsor

miguelmota commented Jul 4, 2020

Anyone know of an alternative way to fix the warning messages that doesn't require env vars?

Using these cgo flags mentioned in #803 does work to silence the warnings but it's not ideal:

CGO_CFLAGS="-g -O2 -Wno-return-local-addr" go run main.go

@rittneje
Copy link
Collaborator

rittneje commented Jul 5, 2020

@miguelmota That depends what you consider to be a fix. As mentioned in the linked issue, this warning is a false positive that could be addressed by changing how SQLite itself is implemented, but it is unclear whether such a change will be made. Alternatively, that flag could be added to this wrapper library so you don't need to manually set an environment variable.

go-sqlite3/sqlite3.go

Lines 12 to 24 in aa77c03

#cgo CFLAGS: -std=gnu99
#cgo CFLAGS: -DSQLITE_ENABLE_RTREE
#cgo CFLAGS: -DSQLITE_THREADSAFE=1
#cgo CFLAGS: -DHAVE_USLEEP=1
#cgo CFLAGS: -DSQLITE_ENABLE_FTS3
#cgo CFLAGS: -DSQLITE_ENABLE_FTS3_PARENTHESIS
#cgo CFLAGS: -DSQLITE_ENABLE_FTS4_UNICODE61
#cgo CFLAGS: -DSQLITE_TRACE_SIZE_LIMIT=15
#cgo CFLAGS: -DSQLITE_OMIT_DEPRECATED
#cgo CFLAGS: -DSQLITE_DISABLE_INTRINSIC
#cgo CFLAGS: -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
#cgo CFLAGS: -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
#cgo CFLAGS: -Wno-deprecated-declarations

#cgo CFLAGS: -Wno-return-local-addr

@miguelmota
Copy link
Sponsor

@rittneje that worked perfectly, thanks!

tie added a commit to tie/PufferPanel that referenced this issue Mar 9, 2023
This change bumps go-sqlite3 version in go.mod. Note that go-sqlite3 is
actually at v1 version, the v2 is an accident as written in README.

>Latest stable version is v1.14 or later, not v2.
>
>NOTE: The increase to v2 was an accident. There were no major changes or
>features.

This change fixes mattn/go-sqlite3#822

As a side effect, we also upgrade gin-contrib/sessions to the latest
commit for gin-contrib/sessions#187
There were no major changes since v0.0.5 release aside from minor
dependency version bumps.
gin-contrib/sessions@v0.0.5...189b96f
LordRalex pushed a commit to pufferpanel/pufferpanel that referenced this issue Apr 9, 2023
This change bumps go-sqlite3 version in go.mod. Note that go-sqlite3 is
actually at v1 version, the v2 is an accident as written in README.

>Latest stable version is v1.14 or later, not v2.
>
>NOTE: The increase to v2 was an accident. There were no major changes or
>features.

This change fixes mattn/go-sqlite3#822

As a side effect, we also upgrade gin-contrib/sessions to the latest
commit for gin-contrib/sessions#187
There were no major changes since v0.0.5 release aside from minor
dependency version bumps.
gin-contrib/sessions@v0.0.5...189b96f
kyeap-vmware added a commit to kyeap-vmware/gpbackup that referenced this issue Dec 23, 2023
Our dependency go-sqlite3 has a false positive warning being triggered
as it compiles. This is showing up in the tests and build and pollutes
output quite a bit. Add a flag to supress the warning.

Track the issue here:
mattn/go-sqlite3#822
kyeap-vmware added a commit to kyeap-vmware/gpbackup that referenced this issue Dec 27, 2023
Our dependency go-sqlite3 has a false positive warning being triggered
as it compiles. This is showing up in the tests and build and pollutes
output quite a bit. Add a flag to supress the warning.

Without this the following warning may continually pop up when tests are
running
```
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:128049:10: warning: function may return address of local variable [-Wreturn-local-addr]
128049 |   return pNew;
       |          ^~~~
sqlite3-binding.c:128009:10: note: declared here
128009 |   Select standin;
       |          ^~~~~~~
```

Track the issue here:
mattn/go-sqlite3#822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants