libctf: compilation failure on MinGW due to missing errno values
authorEli Zaretskii <eliz@gnu.org>
Sat, 1 Feb 2020 11:25:19 +0000 (15:25 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Sat, 1 Feb 2020 11:25:19 +0000 (15:25 +0400)
This commit fixes a compilation failure in a couple of libctf files
due to the use of EOVERFLOW and ENOTSUP, which are not defined
when compiling on MinGW.

libctf/ChangeLog:

PR binutils/25155:
* ctf-create.c (EOVERFLOW): If not defined by system header,
redirect to ERANGE as a poor man's substitute.
* ctf-subr.c (ENOTSUP): If not defined, use ENOSYS instead.

This one is how Eli implemented it. I think this implementation
has a weakness in the following sense: If other units in libctf
start using those constants, we'll get the same error again.
Also, I'm wondering whether their use is documented as part of
the official libtcf API or not -- users might be writing code
that tests for these, and if the system doesn't support them,
how would they know what errno code to use in its place. This
argues for a having that information in one of libctf's header
files. I think it would be nice to have those in ctf-decls.h,
but I think we'll need to include <errno.h> in ctf-decls.h if
we decide to define those macros there.

Rather than second-guess what the CTF developers would prefer,
I'm starting by sending Eli's patch, to see what you guys think.

Thanks,
--
Joel

libctf/ChangeLog
libctf/ctf-create.c
libctf/ctf-subr.c

index 5843cd92e1ebd700ad7a5fa89c15dfaf8ee8908d..940f4022e15c84c635446ba94d8632e32f31b6fe 100644 (file)
@@ -1,3 +1,10 @@
+2020-02-01  Eli Zaretskii  <eliz@gnu.org>
+
+       PR binutils/25155:
+       * ctf-create.c (EOVERFLOW): If not defined by system header,
+       redirect to ERANGE as a poor man's substitute.
+       * ctf-subr.c (ENOTSUP): If not defined, use ENOSYS instead.
+
 2020-01-05  Joel Brobecker  <brobecker@adacore.com>
 
        PR binutils/25155:
index fa40100c770114a0154ac7665bb6132ce6491cff..84aa4526a30ebea6f9b66be698c8cd7fc4162bd8 100644 (file)
 #include <string.h>
 #include <zlib.h>
 
+#ifndef EOVERFLOW
+#define EOVERFLOW ERANGE
+#endif
+
 #ifndef roundup
 #define roundup(x, y)  ((((x) + ((y) - 1)) / (y)) * (y))
 #endif
index 6bd7f10aeeac0dde395f57936742b637fcd2b3a5..cc275c507c9ed0893902427f93077abb5be5bc09 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
+#ifndef ENOTSUP
+#define ENOTSUP ENOSYS
+#endif
+
 int _libctf_version = CTF_VERSION;           /* Library client version.  */
 int _libctf_debug = 0;                       /* Debugging messages enabled.  */
 
This page took 0.025434 seconds and 4 git commands to generate.