This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: Prototype for getopt in system.h
- To: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Subject: PATCH: Prototype for getopt in system.h
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Sat, 18 Nov 2000 16:24:02 -0500 (EST)
The following error occurs building under vax ultrix 4.3:
stage1/xgcc -Bstage1/ -B/usr/local/vax-dec-ultrix4.3/bin/ -c -DIN_GCC -g -O3 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -DHAVE_CONFIG_H -I. -Ijava -I../../gcc -I../../gcc/java -I../../gcc/config -I../../gcc/../include ../../gcc/java/gjavah.c -o java/gjavah.o
../../include/getopt.h:111: conflicting types for `getopt'
../../gcc/system.h:360: previous declaration of `getopt'
The prototype for getopt in system.h is missing `const' from the declarations
for the second and third arguments. As a result, the two declarations are
inconsistent.
The base for this patch is system.h as patched in
<http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00620.html>. Unless the
prior patch is installed there will be a conflict.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2000-11-18 John David Anglin <dave@hiauly1.hia.nrc.ca>
* system.h: Correct prototype for getopt().
--- system.h.orig Fri Nov 10 15:47:35 2000
+++ system.h Sat Nov 18 15:57:01 2000
@@ -357,7 +357,7 @@
#endif
#if defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT
-extern int getopt PARAMS ((int, char **, char *));
+extern int getopt PARAMS ((int, char * const *, const char *));
#endif
#if defined (HAVE_DECL_PUTENV) && !HAVE_DECL_PUTENV