#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).
#1089: Disable K&R getopt() prototype -----------------------+---------------------------------------------------- Reporter: eschnett | Owner: Type: defect | Status: review Priority: major | Milestone: Component: Cactus | Version: Resolution: | Keywords: -----------------------+---------------------------------------------------- Changes (by eschnett):
* status: new => review
#1089: Disable K&R getopt() prototype -----------------------+---------------------------------------------------- Reporter: eschnett | Owner: Type: defect | Status: review Priority: major | Milestone: Component: Cactus | Version: Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by knarf):
I don't see a problem removing it, as I also didn't find code in Cactus using it. However, would it be also possible to remove all getopt-related calls/files? (src/gnu/getopt*)
#1089: Disable K&R getopt() prototype -----------------------+---------------------------------------------------- Reporter: eschnett | Owner: Type: defect | Status: review Priority: major | Milestone: Component: Cactus | Version: Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by eschnett):
No; if the system does not provide getopt_long_only, Cactus would not build.
#1089: Disable K&R getopt() prototype -----------------------+---------------------------------------------------- Reporter: eschnett | Owner: Type: defect | Status: review Priority: major | Milestone: Component: Cactus | Version: Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by knarf):
Right, missed that. Please commit.
#1089: Disable K&R getopt() prototype -----------------------+---------------------------------------------------- Reporter: eschnett | Owner: Type: defect | Status: closed Priority: major | Milestone: Component: Cactus | Version: Resolution: fixed | Keywords: -----------------------+---------------------------------------------------- Changes (by eschnett):
* status: review => closed * resolution: => fixed
Comment:
Applied.
trac@lists.einsteintoolkit.org