sys_ioctl: simplify

2020-08-16 Thread Bruno Haible
This use of AC_INCLUDES_DEFAULT looks like a typo. But it is an intentional no-op. Weird. 2020-08-16 Bruno Haible sys_ioctl: Simplify. * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Remove confusing use of AC_INCLUDES_DEFAULT. diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4

Assume autoconf >= 2.64

2020-08-16 Thread Bruno Haible
With Autoconf 2.63 and Automake 1.12.6 in $PATH, gnulib-tool fails: executing aclocal -I glm4 glm4/00gnulib.m4:110: error: m4_defn: undefined macro: _AC_CHECK_DECL_BODY glm4/00gnulib.m4:110: the top level This unintended regression was introduced on 2020-01-04, when 00gnulib.m4 started to r

Fix quoting of AC_LANG_PROGRAM arguments

2020-08-16 Thread Bruno Haible
Similarly the AC_LANG_PROGRAM arguments ought to be double-quoted. Here, I did not find a bug. But it's better to be consistent, in order to avoid bugs in future autoconf macros. 2020-08-16 Bruno Haible Fix quoting of AC_LANG_PROGRAM arguments. * m4/fdopendir.m4 (gl_FUNC_FDOP

Don't use Autoconf quadrigraphs

2020-08-16 Thread Bruno Haible
Autoconf quadrigraphs are obsolete for a long time already. No more need for them, definitely, in Autoconf >= 2.64. 2020-08-16 Bruno Haible Don't use Autoconf quadrigraphs. * m4/alloca.m4 (_AC_LIBOBJ_ALLOCA): Use '#' instead of the corresponding Autoconf quadrigraph.

C++ tests: Fix link errors on MSVC

2020-08-16 Thread Bruno Haible
Link errors were accidentally introduced on 2020-05-31. Most of them were fixed on 2020-06-27, but I forgot to test the C++ tests as well. 2020-08-16 Bruno Haible C++ tests: Fix link errors on MSVC (regression from 2020-05-31). * modules/stdio-c++-tests (Makefile.am): Link tes

improve clang support (33)

2020-08-16 Thread Bruno Haible
This set of patches fixes a number of warnings that I'm seeing when building a POSIX testdir on MSVC/clang. 2020-08-16 Bruno Haible Fix "warning: 'WSASocketA' is deprecated: Use WSASocketW() instead". * lib/socket.c: Use WSASocketW, not WSASocketA. Fix "warning: forma

Re: improve clang support (3)

2020-08-16 Thread Bruno Haible
> clang supports __builtin_expect, even on Windows. Another use of __builtin_expect is here: 2020-08-16 Bruno Haible avltreehash-list, rbtreehash-list: Optimize also on clang. * lib/gl_anytreehash_list1.h (add_nodes_to_buckets): Use __builtin_expect also on clang. di

Re: improve clang support (22)

2020-08-16 Thread Bruno Haible
> clang supports expression statement syntax (a block inside parentheses) like > GCC. This patch makes use of it. Two further places where expression statements can be enabled in clang, for better optimization: 2020-08-16 Bruno Haible setenv: Use tree code also with clang. *

Re: improve clang support (23)

2020-08-16 Thread Bruno Haible
> clang also has the atomic built-ins and the asm support that GCC has. > > > 2020-08-11 Bruno Haible > > asyncsafe-spin: Use GCC built-ins also on clang. > * lib/asyncsafe-spin.c (asyncsafe_spin_init, do_lock, do_unlock): Use > the newer GCC built-ins also on clang. The te

Re: improve clang support (25)

2020-08-16 Thread Bruno Haible
> Where does clang support the 'restrict' and '__restrict' keywords? It's > like with GCC >= 3.1: > >C mode C++ mode > > T*__restrict supported supported > [__restrict] supported error > T*restrict supported error > [restrict]

Re: improve clang support (33)

2020-08-16 Thread Bruno Haible
> Fix "warning: 'format' attribute argument not supported: rpl_printf". > * lib/stdio.in.h (printf): Treat clang like GCC. Similarly, in order to preserve __attribute__ ((scanf, )): 'scanf' must be mapped to '__scanf__', not 'rpl_scanf'. 2020-08-16 Bruno Haible stdio

Re: improve clang support (33)

2020-08-16 Thread Bruno Haible
> Fix "warning: implicitly declaring library function 'strncasecmp'". > * lib/strptime.c: Include . Similarly, to fix this warning: ../../gllib/argp-help.c:783:16: warning: implicitly declaring library function 'strcasecmp' with type 'int (const char *, const char *)' [-Wimplicit-fu

improve clang support (34)

2020-08-16 Thread Bruno Haible
clang has #include_next. 2020-08-16 Bruno Haible absolute-header: Add support for clang. * modules/absolute-header (Makefile.am): Include '__clang__' in the HAVE_INCLUDE_NEXT expression. diff --git a/modules/absolute-header b/modules/absolute-header index 491d3d2..186

improve clang support (35)

2020-08-16 Thread Bruno Haible
clang (at least in version >= 4), in C++ mode, supports the 'throw ()' declaration on functions, and uses it to optimize try/catch statements at the caller site. 2020-08-16 Bruno Haible Use 'throw ()' for optimization in C++ mode also on clang. * lib/cdefs.h (__THROW): Define

improve clang support (36)

2020-08-16 Thread Bruno Haible
clang has _Static_assert and, in C++ mode, also 'static_assert' (at least in clang >= 4). Gnulib can make use of it. 2020-08-16 Bruno Haible Use _Static_assert and static_assert primitives when present on clang. * lib/cdefs.h (_Static_assert): Don't define as a macro on clang.

improve clang support (37)

2020-08-16 Thread Bruno Haible
clang supports struct members whose type is an enum, with a bitfield width. 2020-08-16 Bruno Haible regex: Use space optimization also with clang. * lib/regex_internal.h (re_token_t): Use a single byte for the type also with clang. diff --git a/lib/regex_internal.h b/

improve clang support (38)

2020-08-16 Thread Bruno Haible
clang support the array initialization shorthand syntax [ first ... last ] = value , at least in clang >= 4. 2020-08-16 Bruno Haible regex: Use initializer shorthand syntax also with clang. * lib/regcomp.c

improve clang support (39)

2020-08-16 Thread Bruno Haible
clang supports referencing a symbol under a different name at the assembler level, like GCC. Also it supports __USER_LABEL_PREFIX__, like GCC (this is an underscore on 32-bit native Windows, but empty on 64-bit native Windows). 2020-08-16 Bruno Haible libc-config: Enable __REDIRECT ma

improve clang support (40)

2020-08-16 Thread Bruno Haible
clang support #warning. 2020-08-16 Bruno Haible argp: Emit a warning also with clang. * lib/argp-help.c (__argp_short_program_name): Use #warning also on clang. diff --git a/lib/argp-help.c b/lib/argp-help.c index 9c95c16..80be8c8 100644 --- a/lib/argp-help.c +++ b/li

improve clang support (41)

2020-08-16 Thread Bruno Haible
Unlike MSVC, clang groks the expression 0.0L/0.0L. 2020-08-16 Bruno Haible log2l: Disable MSVC workaround on clang. * lib/log2l.c (log2l): On clang, use the expression 0.0L/0.0L. diff --git a/lib/log2l.c b/lib/log2l.c index 8634026..ad47379 100644 --- a/lib/log2l.c +++ b/lib/

improve clang support (42)

2020-08-16 Thread Bruno Haible
clang emits several hundred "warning: division by zero is undefined" warnings when compiling test-intprops.c. This patch fixes it. 2020-08-16 Bruno Haible intprops: Avoid bogus "warning: division by zero is undefined" on clang. * lib/intprops.h (_GL__GENERIC_BOGUS): Define to

improve clang support (43)

2020-08-16 Thread Bruno Haible
clang can inline, like GCC. It also supports the '__inline' and '__inline__' keywords. 2020-08-16 Bruno Haible nstrftime: Guide inlining also on clang. * lib/nstrftime.c (iso_week_days): Inline also on clang. diff --git a/lib/nstrftime.c b/lib/nstrftime.c index 28bc42f..58022

improve clang support (44)

2020-08-16 Thread Bruno Haible
With clang, verify_stmt works well enough (as evidenced by the unit test). 2020-08-16 Bruno Haible intprops test: Strengthen on clang. * tests/test-intprops.c (VERIFY): Use verify_stmt. diff --git a/tests/test-intprops.c b/tests/test-intprops.c index a56b18e..51477fd 100644 -

[PATCH] time_rz: fix issues with mktime_z failures

2020-08-16 Thread Paul Eggert
* lib/time_rz.c (mktime_z): Do not update *TM if revert_tz fails. Use a cheaper tm_yday test for failed mktime. --- ChangeLog | 6 ++ lib/time_rz.c | 26 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0810c1106..2e465

Re: improve clang support (34)

2020-08-16 Thread Paul Smith
On Sun, 2020-08-16 at 18:55 +0200, Bruno Haible wrote: > +HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 6000 <= __DECC_VER) Just wondering, are these changes for the sake of documentation, or are they really needed (do you see problems without them)? In my experience with clang, it always def

Re: improve clang support (34)

2020-08-16 Thread Bruno Haible
Hi Paul, Paul Smith wrote: > > +HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 6000 <= __DECC_VER) > > Just wondering, are these changes for the sake of documentation, or are > they really needed (do you see problems without them)? This Makefile variable HAVE_INCLUDE_NEXT is not used in Gnuli

Re: improve clang support (35)

2020-08-16 Thread Florian Weimer
* Bruno Haible: > clang (at least in version >= 4), in C++ mode, supports the 'throw > ()' declaration on functions, and uses it to optimize try/catch > statements at the caller site. I think throw() has been removed from C++20:

Re: improve clang support (34)

2020-08-16 Thread Paul Smith
On Sun, 2020-08-16 at 22:54 +0200, Bruno Haible wrote: > This Makefile variable HAVE_INCLUDE_NEXT is not used in Gnulib, but > some packages may be using it. I included this module in the clang > support for completeness. Thanks; I wasn't really asking about this particular change per se, rather t

Re: C++ throw() clause

2020-08-16 Thread Bruno Haible
Hi Florian, > > clang (at least in version >= 4), in C++ mode, supports the 'throw > > ()' declaration on functions, and uses it to optimize try/catch > > statements at the caller site. > > I think throw() has been removed from C++20: > > >

Re: C++ throw() clause

2020-08-16 Thread Jeffrey Walton
On Sun, Aug 16, 2020 at 7:14 PM Bruno Haible wrote: > > Hi Florian, > > > > clang (at least in version >= 4), in C++ mode, supports the 'throw > > > ()' declaration on functions, and uses it to optimize try/catch > > > statements at the caller site. > > > > I think throw() has been removed from C+