bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] argp and MinGW


From: Bruno Haible
Subject: Re: [bug-gnulib] argp and MinGW
Date: Fri, 20 Oct 2006 15:46:34 +0200
User-agent: KMail/1.9.1

Daniel Martin wrote:

> 1.
> /bin/sh ../../libtool --tag=CC --mode=compile i386-mingw32-gcc 
> -DHAVE_CONFIG_H -I. -I../../../../gnulib/src -I../..     
> -I/usr/local/i386-mingw32/include -c -o argp-parse.lo 
> ../../../../gnulib/src/argp-parse.c
>  i386-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../../../gnulib/src -I../.. 
> -I/usr/local/i386-mingw32/include -c ../../../../gnulib/src/argp-parse.c  
> -DDLL_EXPORT -DPIC -o .libs/argp-parse.o
> ../../../../gnulib/src/argp-parse.c:872: error: conflicting types for 
> 'argp_parse'
> ../../../../gnulib/src/argp.h:413: error: previous declaration of 
> 'argp_parse' was here
> ../../../../gnulib/src/argp-parse.c:872: error: conflicting types for 
> 'argp_parse'
> ../../../../gnulib/src/argp.h:413: error: previous declaration of 
> 'argp_parse' was here
> make[4]: *** [argp-parse.lo] Error 1
> 
> I can work around this though but editing argp.h:410-413 and removing
> the names of the arguments. But of course this isn't really the
> _correct_ way to fix this problem.

The problem is that mingw has
    #define __argc (*__p___argc())
    #define __argv (*__p___argv())

But OTOH, glibc headers must be robust against user code that does
    #define argc some_weird_macro

Sergey, is this ok to commit?


2006-10-19  Bruno Haible  <address@hidden>

        * lib/argp.h (argp_parse, __argp_parse): Use _argc, _argv as argument
        names, not __argc, __argv. (The latter are defined as macros on mingw.)

*** gnulib-20061019/lib/argp.h  2006-09-19 00:51:15.000000000 +0200
--- gnulib-20061019-modified/lib/argp.h 2006-10-20 02:23:50.000000000 +0200
***************
*** 413,423 ****
     returned.  This function may also call exit unless the ARGP_NO_HELP flag
     is set.  INPUT is a pointer to a value to be passed in to the parser.  */
  extern error_t argp_parse (const struct argp *__restrict __argp,
!                          int __argc, char **__restrict __argv,
                           unsigned __flags, int *__restrict __arg_index,
                           void *__restrict __input);
  extern error_t __argp_parse (const struct argp *__restrict __argp,
!                            int __argc, char **__restrict __argv,
                             unsigned __flags, int *__restrict __arg_index,
                             void *__restrict __input);
   
--- 413,423 ----
     returned.  This function may also call exit unless the ARGP_NO_HELP flag
     is set.  INPUT is a pointer to a value to be passed in to the parser.  */
  extern error_t argp_parse (const struct argp *__restrict __argp,
!                          int _argc, char **__restrict _argv,
                           unsigned __flags, int *__restrict __arg_index,
                           void *__restrict __input);
  extern error_t __argp_parse (const struct argp *__restrict __argp,
!                            int _argc, char **__restrict _argv,
                             unsigned __flags, int *__restrict __arg_index,
                             void *__restrict __input);
   




reply via email to

[Prev in Thread] Current Thread [Next in Thread]