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

Fix compilation of sqlite3 with gcc 11. #502

Merged
merged 2 commits into from
Dec 29, 2021

Conversation

abeaumont
Copy link
Contributor

Well detailed description of the change :

Trying to build Dictu with the CMake instructions fails with GCC 11:

$ cmake --build ./build
[  1%] Building C object src/CMakeFiles/objlib.dir/cli/argparse.c.o
[  3%] Building C object src/CMakeFiles/objlib.dir/optionals/base64.c.o
[  5%] Building C object src/CMakeFiles/objlib.dir/optionals/base64/base64Lib.c.o
[  6%] Building C object src/CMakeFiles/objlib.dir/optionals/c.c.o
[  8%] Building C object src/CMakeFiles/objlib.dir/optionals/datetime.c.o
[ 10%] Building C object src/CMakeFiles/objlib.dir/optionals/env/env.c.o
[ 11%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib.c.o
[ 13%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib/bcrypt/bcrypt.c.o
[ 15%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib/bcrypt/blf.c.o
[ 16%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib/bcrypt/timingsafe_bcmp.c.o
[ 18%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib/hmac.c.o
[ 20%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib/sha256.c.o
[ 21%] Building C object src/CMakeFiles/objlib.dir/optionals/hashlib/utils.c.o
[ 23%] Building C object src/CMakeFiles/objlib.dir/optionals/http.c.o
[ 25%] Building C object src/CMakeFiles/objlib.dir/optionals/inspect.c.o
[ 26%] Building C object src/CMakeFiles/objlib.dir/optionals/json.c.o
[ 28%] Building C object src/CMakeFiles/objlib.dir/optionals/json/jsonBuilderLib.c.o
[ 30%] Building C object src/CMakeFiles/objlib.dir/optionals/json/jsonParseLib.c.o
[ 31%] Building C object src/CMakeFiles/objlib.dir/optionals/log.c.o
[ 33%] Building C object src/CMakeFiles/objlib.dir/optionals/math.c.o
[ 35%] Building C object src/CMakeFiles/objlib.dir/optionals/optionals.c.o
[ 36%] Building C object src/CMakeFiles/objlib.dir/optionals/path.c.o
[ 38%] Building C object src/CMakeFiles/objlib.dir/optionals/process.c.o
[ 40%] Building C object src/CMakeFiles/objlib.dir/optionals/random.c.o
[ 41%] Building C object src/CMakeFiles/objlib.dir/optionals/socket.c.o
[ 43%] Building C object src/CMakeFiles/objlib.dir/optionals/sqlite.c.o
[ 45%] Building C object src/CMakeFiles/objlib.dir/optionals/sqlite/sqlite3.c.o
/home/abeaumont/Dictu/src/optionals/sqlite/sqlite3.c: In function ‘sqlite3DefaultRowEst’:
/home/abeaumont/Dictu/src/optionals/sqlite/sqlite3.c:114502:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
114502 |   if( pIdx->pPartIdxWhere!=0 ) x -= 10;  assert( 10==sqlite3LogEst(2) );
|   ^~
In file included from /home/abeaumont/Dictu/src/optionals/sqlite/sqlite3.c:14138:
/home/abeaumont/Dictu/src/optionals/sqlite/sqlite3.c:114502:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
114502 |   if( pIdx->pPartIdxWhere!=0 ) x -= 10;  assert( 10==sqlite3LogEst(2) );
|                                          ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/objlib.dir/build.make:440: src/CMakeFiles/objlib.dir/optionals/sqlite/sqlite3.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:120: src/CMakeFiles/objlib.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
$ gcc --version
gcc (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Moving the assert statement to its own line fixes the problem and the build succeeds.

Type of change:

  • Bug fix

  • New feature

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Housekeeping

  • Tests have been updated to reflect the changes done within this PR (if applicable).

  • Documentation has been updated to reflect the changes done within this PR (if applicable).

Preview (Screenshots) :

@Jason2605 Jason2605 merged commit ef028c4 into dictu-lang:develop Dec 29, 2021
@Jason2605 Jason2605 mentioned this pull request Dec 29, 2021
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

Successfully merging this pull request may close these issues.

2 participants