bug-gnulib
[Top][All Lists]
Advanced

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

getopt broken


From: Sergey Poznyakoff
Subject: getopt broken
Date: Sun, 27 Sep 2009 00:24:28 +0300

Hello,

The latest changes to getopt (commit 6471b462, "getopt: fix inclusion
guards for cygwin") break compilation of getopt1.c on GNU/Linux:

GEN    configmake.h
CC     getopt1.o
getopt1.c:42: error: syntax error before '*' token
getopt1.c: In function `getopt_long':
getopt1.c:44: error: number of arguments doesn't match prototype
/usr/include/getopt.h:162: error: prototype declaration

The reason is that the declarations of getopt_long and getopt_long_r
both use __getopt_argv_const, which is normally defined in getopt.h.
However, if the system already has getopt.h, it gets included and
further contents of the gnulib's getopt.h is ignored.

Attempts to define __getopt_argv_const in getopt1.c won't fix the bug,
since it is not known whether to define it to empty string or to const
(see comment at getopt.in.h:39). Actually, it is impossible to include
system's getopt.h and to ensure its declarations of getopt_long (et al.)
match those in gnulib's getopt1.c.

Any ideas how to fix it?

Regards,
Sergey




reply via email to

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