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

Bug#220910: Please reopen



On Sat, Nov 15, 2003 at 05:13:33PM +0100, Erwan David wrote:
> 
> File :
> 
> 
> /****************************************************************************
>  * Includes.																*
>  ****************************************************************************/
> #include <stdlib.h>
> #include <stdio.h>
> #include <stdarg.h>
> #include <string.h>
> #include <unistd.h>
> 
> 
> /****************************************************************************
>  * Parse the command-line arguments and store the requested configuration.	*
>  ****************************************************************************/
> static int ParseArgs(int argc, char *argv[])
> {
> 	int		Option;
> 
> 	while((Option=getopt(argc,argv,"h:lw:"))!=-1)
> 		switch(Option)
> 		  {
> 		  }
> }
> 
> 
> compilation :
> 
> cc -g -ansi -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith
> -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings
> -Wconversion -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline
> -DNO_EXPOSE_COMPRESSION -I/usr/include/libart-2.0/libart_lgpl/
> -I/usr/include/libart-2.0/ -I/usr/include/gdk-pixbuf-1.0
> -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include
> -c -o main.o main.c
> main.c: In function `ParseArgs':
> main.c:19: warning: implicit declaration of function `getopt'
> main.c:23: warning: control reaches end of non-void function
> main.c: At top level:
> main.c:16: warning: `ParseArgs' defined but not used
> 
> 
> Why did getopt disappear ?

Because you used -ansi.  It's documented to turn off features that are
incompatible with ISO C90.  From man gcc-3.3:

           The macro "__STRICT_ANSI__" is predefined when the -ansi
           option is used.  Some header files may notice this macro and
           refrain from declaring certain functions or defining cer-
           tain macros that the ISO standard doesn't call for; this is
           to avoid interfering with any programs that might use these
           names for other things.

ISO C does not define getopt in unistd.h, so __STRICT_ANSI__ disables
the prototype of getopt.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: