bug-gnulib
[Top][All Lists]
Advanced

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

Re: [GNU Bison 2.4.2] testsuite: Failing tests of bison 2.4.2 on Solaris


From: Bruno Haible
Subject: Re: [GNU Bison 2.4.2] testsuite: Failing tests of bison 2.4.2 on Solaris 8+9 w/Sun Studio 11+12
Date: Mon, 26 Apr 2010 00:51:47 +0200
User-agent: KMail/1.9.9

To summarize so far:

- The problem arises in /opt/csw/include/getopt.h, which is non-standard
  on Solaris. Not a problem gnulib is to be blamed for.

- It arises in C++ mode only. In C mode the header file works fine.

- Joel Denny writes:
  > it starts to feel like /opt/csw/include/getopt.h's approach 
  > of quickly giving up on determining the best getopt argument list is 
  > easiest.  However, for C++, it can't give up because there's no such thing 
  > as an unspecified argument list.

- Dagobert wants a small modification of his CSWlibgnugetopt package and not
  a complete reimplementation.

So here's my suggestion. Change /opt/csw/include/getopt.h like this, and be
done with it. All the __STDC__ checks can be removed. No one uses K&R C
nowadays any more. Only ANSI/ISO C and C++ are relevant.


$ diff -u getopt.h.csw getopt.h
--- getopt.h.csw        Mon Jan 18 11:40:07 2010
+++ getopt.h    Mon Apr 26 00:48:56 2010
@@ -80,11 +80,7 @@
 
 struct option
 {
-#if defined (__STDC__) && __STDC__
   const char *name;
-#else
-  char *name;
-#endif
   /* has_arg can't be an enum because some compilers complain about
      type mismatches in all the code that assumes it is an int.  */
   int has_arg;
@@ -98,15 +94,14 @@
 #define required_argument      1
 #define optional_argument      2
 
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+#if defined __GNU_LIBRARY__ || defined __sun
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
-   errors, only prototype getopt for the GNU C library.  */
+   errors, only prototype getopt for the GNU C library and for Solaris.  */
 extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
+#else /* not __GNU_LIBRARY__ || __sun */
 extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
+#endif /* __GNU_LIBRARY__ || __sun */
 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
                        const struct option *longopts, int *longind);
 extern int getopt_long_only (int argc, char *const *argv,
@@ -118,14 +113,7 @@
                             const char *shortopts,
                             const struct option *longopts, int *longind,
                             int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
 
-extern int _getopt_internal ();
-#endif /* __STDC__ */
-
 #ifdef __cplusplus
 }
 #endif




reply via email to

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