From bdfb51006347f38ceebf47b653d40c151c8e66c3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 29 Nov 2003 13:37:46 +0000 Subject: [PATCH] argp update from libc --- lib/ChangeLog | 4 ++++ lib/argp-help.c | 18 +++++++----------- lib/argp-namefrob.h | 5 +++++ lib/argp-parse.c | 17 ++++++++++++++++- lib/argp.h | 12 ++++++++++++ 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 2d6b7e0179..a240e70224 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2003-11-29 Karl Berry + + * argp-{help.c,parse.c,namefrob.h}, argp.h: update from libc. + 2003-11-23 Paul Eggert Bruno Haible diff --git a/lib/argp-help.c b/lib/argp-help.c index 14ee686610..e82f488353 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -25,20 +25,16 @@ #include #endif -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# define HAVE_ALLOCA 1 +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H || defined _LIBC +# include # else -# if defined HAVE_ALLOCA_H || defined _LIBC -# include +# ifdef _AIX +#pragma alloca # else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca +# ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); -# endif # endif # endif # endif diff --git a/lib/argp-namefrob.h b/lib/argp-namefrob.h index 6e71f75a21..09cafd0835 100644 --- a/lib/argp-namefrob.h +++ b/lib/argp-namefrob.h @@ -76,6 +76,11 @@ #undef __argp_fmtstream_wmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin +#include "mempcpy.h" +#include "strcase.h" +#include "strchrnul.h" +#include "strndup.h" + /* normal libc functions we call */ #undef __flockfile #define __flockfile flockfile diff --git a/lib/argp-parse.c b/lib/argp-parse.c index 2a8b6a0ff0..464a3c01cf 100644 --- a/lib/argp-parse.c +++ b/lib/argp-parse.c @@ -1,5 +1,5 @@ /* Hierarchial argument parsing, layered over getopt - Copyright (C) 1995-2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -21,6 +21,21 @@ #include #endif +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + #include #include #include diff --git a/lib/argp.h b/lib/argp.h index 5286fc488e..42e39adf6d 100644 --- a/lib/argp.h +++ b/lib/argp.h @@ -48,6 +48,18 @@ # endif #endif +/* GCC 2.95 and later have "__restrict"; C99 compilers have + "restrict", and "configure" may have defined "restrict". */ +#ifndef __restrict +# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) +# if defined restrict || 199901L <= __STDC_VERSION__ +# define __restrict restrict +# else +# define __restrict +# endif +# endif +#endif + #ifndef __error_t_defined typedef int error_t; # define __error_t_defined -- 2.30.2