Commit 5db304f
committed
Fix the non-debug build in Groovy Gorilla (gcc 10.2)
The release build has been failing with the following error:
```shell
FAILED: src/CMakeFiles/git2internal.dir/hash.c.o
/usr/bin/cc -DHAVE_QSORT_R_GNU -DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\" -DSHA1DC_NO_STANDARD_INCLUDES=1 -D_FILE_OFFSET_BITS=64 -Isrc -I../src -I../include -I../deps/pcre -I../deps/http-parser -D_GNU_SOURCE -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer -Werror -Wall -Wextra -fvisibility=
hidden -fPIC -Wno-documentation-deprecated-sync -Wno-missing-field-initializers -Wstrict-aliasing -Wstrict-prototypes -Wdeclaration-after-statement -Wshift-count-overflow -Wunused-const-variable -Wunused-function -Wint-conversion -Wformat -Wformat-security -Wmissing-declarations -g -D_DEBUG -O0 -std=gnu90 -MD -MT src/CMakeFiles/git2internal.dir/hash.c.o -MF s
rc/CMakeFiles/git2internal.dir/hash.c.o.d -o src/CMakeFiles/git2internal.dir/hash.c.o -c ../src/hash.c
../src/hash.c: In function ‘git_hash_init’:
../src/hash.c:47:1: error: control reaches end of non-void function [-Werror=return-type]
47 | }
| ^
../src/hash.c: In function ‘git_hash_update’:
../src/hash.c:58:1: error: control reaches end of non-void function [-Werror=return-type]
58 | }
| ^
../src/hash.c: In function ‘git_hash_final’:
../src/hash.c:68:1: error: control reaches end of non-void function [-Werror=return-type]
68 | }
| ^
../src/hash.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-documentation-deprecated-sync’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
[11/533] Building C object src/CMakeFiles/git2internal.dir/odb_pack.c.o
ninja: build stopped: subcommand failed.
```
The compiler _should_ be able to figure out that there is no way to reach the
end of the non-void function since `GIT_ASSERT(0)` expands to either `assert()`
or an unconditional `return -1;` (after doing constant folding and stuff,
depending on the debug level). But it's not doing so at the moment, so let's
help it.1 parent 4fadd59 commit 5db304f
1 file changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | | - | |
| 68 | + | |
65 | 69 | | |
| 70 | + | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| |||
0 commit comments