bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] Merge glibc ieee128 ldbl redirect support into cdefs.h


From: Bruno Haible
Subject: Re: [PATCH] Merge glibc ieee128 ldbl redirect support into cdefs.h
Date: Tue, 05 Jan 2021 23:42:36 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Hi Paul,

> I think I see a way to do that: include glibc <cdefs.h> only on 
> platforms where <sys/cdefs.h> is not good enough for Gnulib.

This is better than what we had yesterday; thanks.

However, this is still making bets that undocumented internals of glibc
won't change.

Such bets bring big trouble onto the consumers of tarballs that use Gnulib.
We had two such troubles in the past:

  * The "#error "Please port gnulib freadahead.c ..." trouble from 2018.
    It was caused by relying on _IO_ftrylockfile in glibc.

  * The "syntax error near unexpected token 
`ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89'"
    from December 2020.
    It was caused by relying on the internal structure of AC_PROG_CC in
    Autoconf.

There is potential for similar trouble when the glibc people decide to
change internals of <sys/cdefs.h>. If, say, they rename '__flexarr' to
'__flexarr_bounds', all tarballs that use the module 'fnmatch' will be
broken with these newer glibc versions. We will have up to 6 months
to update Gnulib accordingly (since the glibc release cycle is 6 months),
but then the packages that use Gnulib all have their own release
schedules. m4, for example, has not seen a new release since the
"Please port gnulib freadahead.c ..." trouble from 2018.

How can we proactively avoid this trouble?

1) One possibility would be (again) to use a different include guard for
lib/cdefs.h. But it could likely cause redefinition warnings.

2) Another possibility I can think of is to go through all the macros
defined by lib/cdefs.h, and for those which are actually used in Gnulib
(most aren't), provide fallback definitions in lib/libc-config.h.

For example, the use of __THROW and __NTH in argp.h are already secured
by these fallbacks:
#ifndef __THROW
# define __THROW
#endif
#ifndef __NTH
# define __NTH(fct) fct __THROW
#endif

You find the entire list of such macros at the end of this mail,
together with the list of files that mention them.

For example, __flexarr could have a fallback
#ifndef __flexarr
# define __flexarr      [1]
# define __glibc_c99_flexarr_available 0
#endif

These fallbacks could be concentrated in libc-config.h, rather than
duplicating them in argp, fnmatch, glob, regex, obstack, etc.

Do you see other options?

Bruno

========================================================================
$ for symbol in $(grep '# define ' lib/cdefs.h|sed -e 's/^.*#[      ]*define[   
    ]*//' -e 's/[^a-zA-Z0-9_].*//'|LC_ALL=C sort -u); do echo ; echo $symbol; 
fgrep -rlw $symbol lib | LC_ALL=C sort; done

_Static_assert
lib/cdefs.h
lib/verify.h

__ASMNAME
lib/cdefs.h
lib/libc-config.h

__ASMNAME2
lib/cdefs.h
lib/libc-config.h

__BEGIN_DECLS
lib/cdefs.h
lib/fts_.h
lib/getopt-cdefs.in.h
lib/getopt-core.h
lib/getopt-ext.h
lib/glob-libc.h
lib/ieee754.in.h
lib/libc-config.h

__END_DECLS
lib/cdefs.h
lib/fts_.h
lib/getopt-cdefs.in.h
lib/getopt-core.h
lib/getopt-ext.h
lib/glob-libc.h
lib/ieee754.in.h
lib/libc-config.h

__HAVE_GENERIC_SELECTION
lib/cdefs.h
lib/libc-config.h

__LDBL_COMPAT
lib/cdefs.h
lib/libc-config.h

__LDBL_REDIR
lib/cdefs.h
lib/libc-config.h

__LDBL_REDIR1
lib/cdefs.h
lib/libc-config.h

__LDBL_REDIR1_NTH
lib/cdefs.h
lib/libc-config.h

__LDBL_REDIR2_DECL
lib/cdefs.h
lib/libc-config.h

__LDBL_REDIR_DECL
lib/cdefs.h
lib/libc-config.h

__LDBL_REDIR_NTH
lib/cdefs.h
lib/libc-config.h

__NTH
lib/argp.h
lib/cdefs.h
lib/libc-config.h

__REDIRECT
lib/cdefs.h
lib/libc-config.h
lib/stdio.in.h

__THROW
lib/argp.h
lib/cdefs.h
lib/fts_.h
lib/getopt-cdefs.in.h
lib/getopt-core.h
lib/getopt-ext.h
lib/glob-libc.h
lib/libc-config.h
lib/md5.h
lib/spawn.in.h

__THROWNL
lib/cdefs.h
lib/glob.c
lib/libc-config.h

__always_inline
lib/cdefs.h
lib/malloc/scratch_buffer.h

__attribute__
lib/_Noreturn.h
lib/allocator.h
lib/arg-nonnull.h
lib/argp-help.c
lib/canonicalize-lgpl.c
lib/canonicalize.c
lib/careadlinkat.c
lib/cdefs.h
lib/dfa.c
lib/dirent.in.h
lib/eloop-threshold.h
lib/error.c
lib/execl.c
lib/execle.c
lib/execlp.c
lib/execve.c
lib/execvpe.c
lib/file-set.h
lib/fnmatch.c
lib/fts.c
lib/getaddrinfo.c
lib/getdelim.c
lib/getpass.c
lib/glob.c
lib/ignore-value.h
lib/libc-config.h
lib/mbtowc-lock.c
lib/monetary.in.h
lib/nl_langinfo-lock.c
lib/noreturn.h
lib/obstack.h
lib/random_r.c
lib/regcomp.c
lib/regex_internal.c
lib/regex_internal.h
lib/regexec.c
lib/relocatable.h
lib/setenv.c
lib/setlocale-lock.c
lib/stdalign.in.h
lib/stddef.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/stdnoreturn.in.h
lib/string.in.h
lib/textstyle.in.h
lib/tsearch.c
lib/unitypes.in.h
lib/unsetenv.c
lib/warn-on-use.h
lib/wchar.in.h

__attribute_alloc_size__
lib/cdefs.h
lib/libc-config.h

__attribute_artificial__
lib/cdefs.h
lib/libc-config.h

__attribute_const__
lib/cdefs.h
lib/libc-config.h

__attribute_copy__
lib/cdefs.h

__attribute_deprecated__
lib/cdefs.h
lib/libc-config.h

__attribute_deprecated_msg__
lib/cdefs.h
lib/libc-config.h

__attribute_format_arg__
lib/cdefs.h
lib/libc-config.h

__attribute_format_strfmon__
lib/cdefs.h
lib/libc-config.h

__attribute_malloc__
lib/cdefs.h
lib/libc-config.h

__attribute_noinline__
lib/cdefs.h
lib/libc-config.h

__attribute_nonstring__
lib/cdefs.h
lib/libc-config.h

__attribute_pure__
lib/cdefs.h
lib/libc-config.h
lib/obstack.c
lib/obstack.h

__attribute_returns_twice__
lib/cdefs.h
lib/libc-config.h

__attribute_used__
lib/cdefs.h
lib/libc-config.h

__attribute_warn_unused_result__
lib/cdefs.h
lib/libc-config.h
lib/regex_internal.c
lib/regexec.c

__errordecl
lib/cdefs.h
lib/libc-config.h

__extension__
lib/cdefs.h
lib/fpucw.h
lib/ignore-value.h
lib/libc-config.h
lib/obstack.h

__flexarr
lib/cdefs.h
lib/fnmatch_loop.c
lib/libc-config.h

__fortify_function
lib/cdefs.h
lib/libc-config.h

__glibc_c99_flexarr_available
lib/cdefs.h
lib/libc-config.h

__glibc_clang_has_attribute
lib/cdefs.h
lib/libc-config.h

__glibc_clang_has_builtin
lib/cdefs.h
lib/libc-config.h

__glibc_clang_has_extension
lib/cdefs.h
lib/libc-config.h

__glibc_has_attribute
lib/cdefs.h

__glibc_likely
lib/cdefs.h
lib/fnmatch.c
lib/libc-config.h
lib/malloc/scratch_buffer.h
lib/malloc/scratch_buffer_grow.c
lib/malloc/scratch_buffer_grow_preserve.c
lib/regcomp.c
lib/regex_internal.c
lib/regexec.c

__glibc_macro_warning
lib/cdefs.h
lib/libc-config.h

__glibc_macro_warning1
lib/cdefs.h
lib/libc-config.h

__glibc_objsize
lib/cdefs.h
lib/libc-config.h

__glibc_objsize0
lib/cdefs.h
lib/libc-config.h

__glibc_unlikely
lib/cdefs.h
lib/fnmatch.c
lib/fnmatch_loop.c
lib/glob.c
lib/libc-config.h
lib/malloc/scratch_buffer_grow.c
lib/malloc/scratch_buffer_grow_preserve.c
lib/regcomp.c
lib/regex_internal.c
lib/regexec.c

__restrict_arr
lib/cdefs.h
lib/libc-config.h
lib/regex.h
lib/spawn.in.h

__va_arg_pack
lib/cdefs.h
lib/libc-config.h

__va_arg_pack_len
lib/cdefs.h
lib/libc-config.h

__warnattr
lib/cdefs.h
lib/libc-config.h

__wur
lib/cdefs.h




reply via email to

[Prev in Thread] Current Thread [Next in Thread]