This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR bootstrap/8351: Don't mis-prototype getopt in C++.
- From: Roger Sayle <roger at eyesopen dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 26 Oct 2002 17:38:25 -0600 (MDT)
- Subject: [PATCH] PR bootstrap/8351: Don't mis-prototype getopt in C++.
The following simple patch, suggested by DJ Delorie, fixes GNATS PR
bootstrap/8351, which currently prevents mainline from bootstraping
on cygwin. The solution is to prevent libiberty's getopt.h prototyping
getopt without any arguments when using C++. This is done by protecting
the empty prototype with #ifdef __cplusplus.
The following patch has been tested by bootstraping both i686-pc-linux-gnu
and i686-pc-cygwin. The later fails without this patch, but completes
fine with it, thereby resolving PR 8351.
Ok for mainline and to close PR bootstrap/8351?
2002-10-26 Roger Sayle <roger@eyesopen.com>
DJ Delorie <dj@redhat.com>
PR bootstrap/8351
* getopt.h: Avoid prototyping getopt with no arguments in C++.
Index: getopt.h
===================================================================
RCS file: /cvs/gcc/gcc/include/getopt.h,v
retrieving revision 1.8
diff -c -3 -p -r1.8 getopt.h
*** getopt.h 12 Oct 2002 04:01:04 -0000 1.8
--- getopt.h 26 Oct 2002 20:56:56 -0000
*************** struct option
*** 112,118 ****
--- 112,120 ----
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else
+ #ifndef __cplusplus
extern int getopt ();
+ #endif /* __cplusplus */
#endif
#endif /* !HAVE_DECL_GETOPT */
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833