Remove extern statics.

They have weird semantics and lead to hard to debug linking issues. Just
force static inline everywhere.
This commit is contained in:
Érico Rolim 2021-02-10 18:10:10 -03:00
parent 6336530a9c
commit e7ff8d9787
3 changed files with 10 additions and 53 deletions

2
TODO
View file

@ -1,2 +0,0 @@
Figure out what to do about extern inline, as it's not supported by
newer gcc-3.x.

View file

@ -130,16 +130,6 @@ extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
const char *__fmt, ...) const char *__fmt, ...)
PRINTF_STYLE(2,3); PRINTF_STYLE(2,3);
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str);
extern int argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str);
extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
/* Access macros for various bits of state. */ /* Access macros for various bits of state. */
#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) #define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
@ -149,38 +139,16 @@ extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
#define __argp_fmtstream_rmargin argp_fmtstream_rmargin #define __argp_fmtstream_rmargin argp_fmtstream_rmargin
#define __argp_fmtstream_wmargin argp_fmtstream_wmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
/* Set __FS's left margin to LMARGIN and return the old value. */
extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
size_t __lmargin);
extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
size_t __lmargin);
/* Set __FS's right margin to __RMARGIN and return the old value. */
extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
size_t __rmargin);
extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
size_t __rmargin);
/* Set __FS's wrap margin to __WMARGIN and return the old value. */
extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
size_t __wmargin);
extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
size_t __wmargin);
/* Return the column number of the current output point in __FS. */
extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
/* Internal routines. */ /* Internal routines. */
extern void _argp_fmtstream_update (argp_fmtstream_t __fs); extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
extern void __argp_fmtstream_update (argp_fmtstream_t __fs); extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
#ifdef __OPTIMIZE__ #if 1
/* Inline versions of above routines. */ /* Inline versions of above routines. */
#if !_LIBC #if 1
#define __argp_fmtstream_putc argp_fmtstream_putc #define __argp_fmtstream_putc argp_fmtstream_putc
#define __argp_fmtstream_puts argp_fmtstream_puts #define __argp_fmtstream_puts argp_fmtstream_puts
#define __argp_fmtstream_write argp_fmtstream_write #define __argp_fmtstream_write argp_fmtstream_write
@ -193,7 +161,7 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
#endif #endif
#ifndef ARGP_FS_EI #ifndef ARGP_FS_EI
#define ARGP_FS_EI extern inline #define ARGP_FS_EI static inline
#endif #endif
ARGP_FS_EI size_t ARGP_FS_EI size_t
@ -276,7 +244,7 @@ __argp_fmtstream_point (argp_fmtstream_t __fs)
return __fs->point_col >= 0 ? __fs->point_col : 0; return __fs->point_col >= 0 ? __fs->point_col : 0;
} }
#if !_LIBC #if 1
#undef __argp_fmtstream_putc #undef __argp_fmtstream_putc
#undef __argp_fmtstream_puts #undef __argp_fmtstream_puts
#undef __argp_fmtstream_write #undef __argp_fmtstream_write

21
argp.h
View file

@ -490,10 +490,6 @@ extern void __argp_state_help (const struct argp_state *__restrict __state,
FILE *__restrict __stream, FILE *__restrict __stream,
unsigned int __flags); unsigned int __flags);
/* Possibly output the standard usage message for ARGP to stderr and exit. */
extern void argp_usage (const struct argp_state *__state);
extern void __argp_usage (const struct argp_state *__state);
/* If appropriate, print the printf string FMT and following args, preceded /* If appropriate, print the printf string FMT and following args, preceded
by the program name and `:', to stderr, and followed by a `Try ... --help' by the program name and `:', to stderr, and followed by a `Try ... --help'
message, then exit (1). */ message, then exit (1). */
@ -521,15 +517,6 @@ extern void __argp_failure (const struct argp_state *__restrict __state,
const char *__restrict __fmt, ...) const char *__restrict __fmt, ...)
PRINTF_STYLE(4,5); PRINTF_STYLE(4,5);
/* Returns true if the option OPT is a valid short option. */
extern int _option_is_short (const struct argp_option *__opt) __THROW;
extern int __option_is_short (const struct argp_option *__opt) __THROW;
/* Returns true if the option OPT is in fact the last (unused) entry in an
options array. */
extern int _option_is_end (const struct argp_option *__opt) __THROW;
extern int __option_is_end (const struct argp_option *__opt) __THROW;
/* Return the input field for ARGP in the parser corresponding to STATE; used /* Return the input field for ARGP in the parser corresponding to STATE; used
by the help routines. */ by the help routines. */
extern void *_argp_input (const struct argp *__restrict __argp, extern void *_argp_input (const struct argp *__restrict __argp,
@ -539,7 +526,7 @@ extern void *__argp_input (const struct argp *__restrict __argp,
const struct argp_state *__restrict __state) const struct argp_state *__restrict __state)
__THROW; __THROW;
#ifdef __USE_EXTERN_INLINES #if 1
# if 1 # if 1
# define __argp_usage argp_usage # define __argp_usage argp_usage
@ -549,15 +536,17 @@ extern void *__argp_input (const struct argp *__restrict __argp,
# endif # endif
# ifndef ARGP_EI # ifndef ARGP_EI
# define ARGP_EI extern __inline # define ARGP_EI static __inline
# endif # endif
/* Possibly output the standard usage message for ARGP to stderr and exit. */
ARGP_EI void ARGP_EI void
__argp_usage (const struct argp_state *__state) __argp_usage (const struct argp_state *__state)
{ {
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
} }
/* Returns true if the option OPT is a valid short option. */
ARGP_EI int ARGP_EI int
__NTH (__option_is_short (const struct argp_option *__opt)) __NTH (__option_is_short (const struct argp_option *__opt))
{ {
@ -570,6 +559,8 @@ __NTH (__option_is_short (const struct argp_option *__opt))
} }
} }
/* Returns true if the option OPT is in fact the last (unused) entry in an
options array. */
ARGP_EI int ARGP_EI int
__NTH (__option_is_end (const struct argp_option *__opt)) __NTH (__option_is_end (const struct argp_option *__opt))
{ {