Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Jonas Bülow
Dominique, what I said was that it is undefined behaviour in C++ to return a *value* in a void function. That is still true. On Mon, Feb 11, 2019 at 2:49 PM Dominique Devienne wrote: > On Mon, Feb 11, 2019 at 1:11 PM Clemens Ladisch > wrote: > > > Peter da Silva wrote: > > > I am pretty sure

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Dominique Devienne
On Mon, Feb 11, 2019 at 1:11 PM Clemens Ladisch wrote: > Peter da Silva wrote: > > I am pretty sure that the code is not legal C > > Indeed; C99 and C11 say in 6.3.2.2: > | The (nonexistent) value of a void expression (an expression that has > | type void) shall not be used in any way [...] >

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Clemens Ladisch
Peter da Silva wrote: > I am pretty sure that the code is not legal C Indeed; C99 and C11 say in 6.3.2.2: | The (nonexistent) value of a void expression (an expression that has | type void) shall not be used in any way [...] and in 6.8.6.4: | A return statement with an expression shall not appear

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Richard Damon
> On Feb 11, 2019, at 6:33 AM, Peter da Silva wrote: > > I am pretty sure that the code is not legal C because it's using the return > value of a void function, as well as returning a value from a void > function. Compilers that "do what I mean" and accept it are in error. It's > certainly

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Peter da Silva
I am pretty sure that the code is not legal C because it's using the return value of a void function, as well as returning a value from a void function. Compilers that "do what I mean" and accept it are in error. It's certainly possible that some obscure clause in some C standard blesses it but I

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Jonas Bülow
I'm using cl.exe v19.12. To summarize: SQLite 3.24 compiles fine with warning as error enabled with cl.exe v19.12 SQLite 3.27.1 does not compile with warning as error enabled with cl.exe v19.12. To me, it looks like a simple fix to avoid writing "return " in void functions even if is a void

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Dominique Devienne
On Mon, Feb 11, 2019 at 11:31 AM Jonas Bülow wrote: > Sorry, I missed some information. It is the MSVC v15.5 compiler that > complains: > > sqlite3.c(58167): error C2220: warning treated as error - no 'object' file > generated [c:\work\sqlite-amalgamation-3270100\sqlite3.vcxproj] >

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Jonas Bülow
Sorry, I missed some information. It is the MSVC v15.5 compiler that complains: sqlite3.c(58167): error C2220: warning treated as error - no 'object' file generated [c:\work\sqlite-amalgamation-3270100\sqlite3.vcxproj] sqlite3.c(58167): warning C4098: 'sqlite3PagerSnapshotUnlock': 'void' function

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Dominique Devienne
On Mon, Feb 11, 2019 at 11:16 AM Jonas Bülow wrote: > > Just tried to update my sqlite version from 3.24 to 3.27.1 and the > > compiler complained about a void function returning a value. I don't know > > about C, but in C++ this is undefined behaviour and the clang compiler > > sometimes

Re: [sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Jonas Bülow
The subject should say "3.27.1". Sorry! On Mon, Feb 11, 2019 at 11:14 AM Jonas Bülow wrote: > Just tried to update my sqlite version from 3.24 to 3.27.1 and the > compiler complained about a void function returning a value. I don't know > about C, but in C++ this is undefined behaviour and the

[sqlite] sqlite 3.37.1: void function returns value

2019-02-11 Thread Jonas Bülow
Just tried to update my sqlite version from 3.24 to 3.27.1 and the compiler complained about a void function returning a value. I don't know about C, but in C++ this is undefined behaviour and the clang compiler sometimes generate an ud2 instruction for such code. It's on line 58165 in