diff mbox

Compilation error in simple-object-elf.c

Message ID 83wots34c9.fsf@gnu.org
State New
Headers show

Commit Message

Eli Zaretskii July 18, 2018, 4:18 p.m. UTC
Hi,

I've built the pretest of GDB 8.2 with MinGW today, and bumped into a
compilation error in libiberty:

     if [ x"" != x ]; then \
       gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS  -I. -I./../include   -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE   ./simple-object-elf.c -o noasan/simple-object-elf.o; \
     else true; fi
     gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS  -I. -I./../include   -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE ./simple-object-elf.c -o simple-object-elf.o
     ./simple-object-elf.c: In function 'simple_object_elf_copy_lto_debug_sections':
     ./simple-object-elf.c:1284:14: error: 'ENOTSUP' undeclared (first use in this function)
	    *err = ENOTSUP;
		   ^~~~~~~
     ./simple-object-elf.c:1284:14: note: each undeclared identifier is reported only once for each function it appears in

Suggested fix:

2018-07-18  Eli Zaretskii  <eliz@gnu.org>

	* libiberty/simple-object-elf.c (ENOTSUP): If not defined by
          errno.h, redirect to ENOSYS.

Comments

Richard Biener July 19, 2018, 8:46 a.m. UTC | #1
On Wed, Jul 18, 2018 at 6:18 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> Hi,
>
> I've built the pretest of GDB 8.2 with MinGW today, and bumped into a
> compilation error in libiberty:
>
>      if [ x"" != x ]; then \
>        gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS  -I. -I./../include   -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE   ./simple-object-elf.c -o noasan/simple-object-elf.o; \
>      else true; fi
>      gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS  -I. -I./../include   -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE ./simple-object-elf.c -o simple-object-elf.o
>      ./simple-object-elf.c: In function 'simple_object_elf_copy_lto_debug_sections':
>      ./simple-object-elf.c:1284:14: error: 'ENOTSUP' undeclared (first use in this function)
>             *err = ENOTSUP;
>                    ^~~~~~~
>      ./simple-object-elf.c:1284:14: note: each undeclared identifier is reported only once for each function it appears in
>
> Suggested fix:

Works for me, thus OK.  I'm going to check it in to make 8.2.

Richard.

> 2018-07-18  Eli Zaretskii  <eliz@gnu.org>
>
>         * libiberty/simple-object-elf.c (ENOTSUP): If not defined by
>           errno.h, redirect to ENOSYS.
>
> --- libiberty/simple-object-elf.c~0     2018-07-04 18:41:59.000000000 +0300
> +++ libiberty/simple-object-elf.c       2018-07-18 18:19:39.286654700 +0300
> @@ -22,6 +22,10 @@ Boston, MA 02110-1301, USA.  */
>  #include "simple-object.h"
>
>  #include <errno.h>
> +/* mingw.org's MinGW doesn't have ENOTSUP.  */
> +#ifndef ENOTSUP
> +# define ENOTSUP ENOSYS
> +#endif
>  #include <stddef.h>
>
>  #ifdef HAVE_STDLIB_H
>
Eli Zaretskii July 19, 2018, 1:06 p.m. UTC | #2
> From: Richard Biener <richard.guenther@gmail.com>
> Date: Thu, 19 Jul 2018 10:46:01 +0200
> Cc: DJ Delorie <dj@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>, gdb-patches@sourceware.org
> 
> >             *err = ENOTSUP;
> >                    ^~~~~~~
> >      ./simple-object-elf.c:1284:14: note: each undeclared identifier is reported only once for each function it appears in
> >
> > Suggested fix:
> 
> Works for me, thus OK.  I'm going to check it in to make 8.2.

Thanks.

Joel/Pedro, is this okay for GDB's copy of libiberty, master and
branch?
Pedro Alves July 19, 2018, 1:41 p.m. UTC | #3
On 07/19/2018 02:06 PM, Eli Zaretskii wrote:
>> From: Richard Biener <richard.guenther@gmail.com>
>> Date: Thu, 19 Jul 2018 10:46:01 +0200
>> Cc: DJ Delorie <dj@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>, gdb-patches@sourceware.org
>>
>>>             *err = ENOTSUP;
>>>                    ^~~~~~~
>>>      ./simple-object-elf.c:1284:14: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> Suggested fix:
>>
>> Works for me, thus OK.  I'm going to check it in to make 8.2.
> 
> Thanks.
> 
> Joel/Pedro, is this okay for GDB's copy of libiberty, master and
> branch?

Yes.

Thanks,
Pedro Alves
Eli Zaretskii July 19, 2018, 2:02 p.m. UTC | #4
> Cc: dj@redhat.com, gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org
> From: Pedro Alves <palves@redhat.com>
> Date: Thu, 19 Jul 2018 14:41:13 +0100
> 
> On 07/19/2018 02:06 PM, Eli Zaretskii wrote:
> >> From: Richard Biener <richard.guenther@gmail.com>
> >> Date: Thu, 19 Jul 2018 10:46:01 +0200
> >> Cc: DJ Delorie <dj@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>, gdb-patches@sourceware.org
> >>
> >>>             *err = ENOTSUP;
> >>>                    ^~~~~~~
> >>>      ./simple-object-elf.c:1284:14: note: each undeclared identifier is reported only once for each function it appears in
> >>>
> >>> Suggested fix:
> >>
> >> Works for me, thus OK.  I'm going to check it in to make 8.2.
> > 
> > Thanks.
> > 
> > Joel/Pedro, is this okay for GDB's copy of libiberty, master and
> > branch?

Thanks, done.
diff mbox

Patch

--- libiberty/simple-object-elf.c~0	2018-07-04 18:41:59.000000000 +0300
+++ libiberty/simple-object-elf.c	2018-07-18 18:19:39.286654700 +0300
@@ -22,6 +22,10 @@  Boston, MA 02110-1301, USA.  */
 #include "simple-object.h"
 
 #include <errno.h>
+/* mingw.org's MinGW doesn't have ENOTSUP.  */
+#ifndef ENOTSUP
+# define ENOTSUP ENOSYS
+#endif
 #include <stddef.h>
 
 #ifdef HAVE_STDLIB_H