ocaml-opam / ocaml-mccs

Stripped-down version of mccs with OCaml bindings
Other
22 stars 13 forks source link

build regression in 1.1+12 #32

Closed olafhering closed 3 years ago

olafhering commented 3 years ago
[   40s] Command [36] exited with code 1:
[   40s] $ (cd _build/default/src/glpk && /usr/bin/gcc-7 -O2 -fno-strict-aliasing -fwrapv -Werror=implicit-function-declaration -Werror=return-type -Wno-deprecated-declarations -ffat-lto-objects -fPIC -pipe -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O2 -fno-strict-aliasing -fwrapv -Werror=implicit-function-declaration -Werror=return-type -Wno-deprecated-declarations -ffat-lto-objects -fPIC -pipe -Wno-parentheses -Wno-stringop-overflow -g -I /usr/lib64/ocaml -o glpios01.o -c glpios01.c)
[   40s] src/glpk/draft/glpios01.c: In function '_glp_ios_find_row':
[   40s] src/glpk/draft/glpios01.c:1494:1: error: control reaches end of non-void function [-Werror=return-type]

triggered by commit c9ee786333b004cc298f17944c0ef53e4d33000c

dra27 commented 3 years ago

Environment information would be helpful - you appear to be using a version of OCaml packaged with a lot of extra C flags.

olafhering commented 3 years ago

Yes, I added them to the SUSE ocaml rpm, just to catch errors in C bindings. See, it just found one.

There should also be -Werror=discarded-qualifiers in the list, but today that would break too many packages...

olafhering commented 3 years ago

I added this patch to my pkg to deal with the error:

--- a/src/glpk/draft/glpios01.c
+++ b/src/glpk/draft/glpios01.c
@@ -1490,7 +1490,7 @@ int ios_add_row(glp_tree *tree, IOSPOOL
 #ifdef NEW_LOCAL /* 02/II-2018 */
 IOSCUT *ios_find_row(IOSPOOL *pool, int i)
 {     /* find row (constraint) in the cut pool */
-      xassert(0);
+      xassert(0); return NULL;
 }
 #else
 IOSCUT *ios_find_row(IOSPOOL *pool, int i)
dra27 commented 3 years ago

I'm not entirely sure about changing code to force an error and then claiming that error is a regression. Regardless, it's not found a bug, at best it's pedantically found a missing noreturn attribute (xassert(0) doesn't, or certainly shouldn't, return). The code's also part of glpk, not ocaml-mccs.

If this is for part of an distro-specific package, can I suggest using the distro's libglpk package and using that for ocaml-mccs (cf. https://salsa.debian.org/ocaml-team/ocaml-mccs/-/blob/debian/sid/debian/rules#L13)

olafhering commented 3 years ago

There is indeed an external glpk pkg. I will see if this can be used, otherwise I will just carry the patch above.