[ET Trac] [Einstein Toolkit] #1089: Disable K&R getopt() prototype

Einstein Toolkit trac-noreply at einsteintoolkit.org
Thu Sep 13 10:46:16 CDT 2012


#1089: Disable K&R getopt() prototype
----------------------+-----------------------------------------------------
 Reporter:  eschnett  |       Owner:     
     Type:  defect    |      Status:  new
 Priority:  major     |   Milestone:     
Component:  Cactus    |     Version:     
 Keywords:            |  
----------------------+-----------------------------------------------------
 The file getopt.h, taken from glibc, defines a prototype for the function
 getopt() (which is not actually used in Cactus). Depending on the compiler
 used, this is either an ANSI prototype with arguments, or a K&R prototype
 without arguments.

 The IBM C++ compiler does not handle the K&R prototype well; it complains
 that it sees ANSI prototypes in stdio.h and stdlib.h, and aborts.

 Since we don't call getopt() in Cactus, I suggest to disable the K&R
 prototype:

 {{{
 Index: gnu/getopt.h
 ===================================================================
 --- gnu/getopt.h        (revision 4867)
 +++ gnu/getopt.h        (working copy)
 @@ -150,7 +150,9 @@
                              int __long_only);
  # endif
  #else /* not __STDC__ */
 -extern int getopt ();
 +/* The declaration below leads to a prototype mismatch with
 +   IBM XL C/C++ for AIX, V11.1 (5724-X13), Version: 11.01.0000.0005 */
 +/* extern int getopt (); */
  # ifndef __need_getopt
  extern int getopt_long ();
  extern int getopt_long_only ();
 }}}

 I also tried various options to disable the ANSI prototypes in the system
 libraries (didn't help), and tried updating getopt.h to a more recent
 version (didn't help either).

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1089>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list