This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix a MinGW warning in libiberty/strerror.c
- From: Eli Zaretskii <eliz at gnu dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 16 Jan 2015 13:18:21 +0200
- Subject: Re: Fix a MinGW warning in libiberty/strerror.c
- Authentication-results: sourceware.org; auth=none
- References: <831tndbgg8 dot fsf at gnu dot org>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
Ping!
> Date: Fri, 02 Jan 2015 12:54:47 +0200
> From: Eli Zaretskii <eliz@gnu.org>
>
> When compiling GDB 7.8.1, I get this warning in libiberty:
>
> gcc -c -DHAVE_CONFIG_H -O0 -g3 -D__USE_MINGW_ACCESS -I. -I./../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic ./strerror.c -o strerror.o
> ./strerror.c:472:12: warning: '_sys_nerr' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
> ./strerror.c:473:14: warning: '_sys_errlist' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
>
> This happens because the MinGW system headers have some special magic
> for these variables, which are imported from a system shared library.
>
> The solution I propose is to refrain from declaring variables that are
> actually macros, because this should be a sign that something tricky
> is going on:
>
> --- libiberty/strerror.c~0 2014-06-11 18:34:41 +0300
> +++ libiberty/strerror.c 2014-12-30 08:12:00 +0200
> @@ -469,8 +469,13 @@
>
> #else
>
> +
> +#ifndef sys_nerr
> extern int sys_nerr;
> +#endif
> +#ifndef sys_errlist
> extern char *sys_errlist[];
> +#endif
>
> #endif
>
>
> OK to commit this (with a suitable ChangeLog entry)?
>