Paul Eggert wrote: > * m4/threadlib.m4: Refactor by prefering AS_CASE to case
I've nothing against the use of AS_CASE. In the editor that I use, I also like to have parentheses matching up properly :) But the indentation in your patch is terrible: 1) In some cases, the cases don't appear on a fresh line: $ grep -rn 'AS_CASE.*, [^)]*$' . ./threadlib.m4:229: AS_CASE([$host_os], [linux*], [ ./threadlib.m4:478: AS_CASE([$gl_use_threads], [yes | isoc | posix | isoc+posix], [ ./threadlib.m4:500: AS_CASE([$gl_cv_have_weak], [*yes], [ ./threadlib.m4:507: AS_CASE([$gl_use_threads], [isoc | isoc+posix], [ ./threadlib.m4:511: AS_CASE([$gl_use_threads], [yes | posix | isoc+posix], [ ./threadlib.m4:530: AS_CASE([$gl_cv_have_weak], [*yes], ./threadlib.m4:563: AS_CASE([$gl_use_threads], [yes | windows | win32], ./threadlib.m4:564: [AS_CASE([$host_os], [mingw* | windows*], It's best not to do that, for readability. 2) The indentation of the cases is irregular: Sometimes 2 spaces for the case and 3 spaces for the statement. Sometimes 1 space for the case and 3 spaces for the statement. Sometimes the last statement hangs off unindented. Etc. It's best to choose one style and stick with it. I'm choosing 2 spaces for the case and 3 spaces for the statement. 2025-04-28 Bruno Haible <br...@clisp.org> threadlib: Correct indentation. * m4/threadlib.m4: Put cases on a fresh line. Correct indentation. diff --git -w a/m4/threadlib.m4 b/m4/threadlib.m4 index c7fe989472..37def278f6 100644 --- a/m4/threadlib.m4 +++ b/m4/threadlib.m4 @@ -152,10 +152,12 @@ AC_DEFUN([gl_WEAK_SYMBOLS] $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest - ])]) + ]) + ]) ]) AS_CASE([$gl_cv_have_weak], - [*yes], [ + [*yes], + [ AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [Define to 1 if the compiler and linker support weak declarations of symbols.]) ]) @@ -226,7 +228,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY] gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. - AS_CASE([$host_os], [linux*], [ + AS_CASE([$host_os], + [linux*], + [ AC_EGREP_CPP([Lucky user], [#include <features.h> #ifdef __GNU_LIBRARY__ @@ -465,17 +469,21 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY] [cygwin*], [AS_CASE([$(uname -r)], [[1.[0-5].*]], [gl_use_threads=no], - [gl_use_threads=yes])], + [gl_use_threads=yes]) + ], dnl Obey gl_AVOID_WINPTHREAD on mingw. [mingw* | windows*], [AS_CASE([$gl_use_winpthreads_default], [yes], [gl_use_threads=posix], [no], [gl_use_threads=windows], - [gl_use_threads=yes])], + [gl_use_threads=yes]) + ], [gl_use_threads=yes]) fi ]) - AS_CASE([$gl_use_threads], [yes | isoc | posix | isoc+posix], [ + AS_CASE([$gl_use_threads], + [yes | isoc | posix | isoc+posix], + [ # For using <threads.h> or <pthread.h>: gl_ANYTHREADLIB_EARLY ]) @@ -497,18 +505,24 @@ AC_DEFUN([gl_THREADLIB_BODY] [ dnl Check whether the compiler and linker support weak declarations. gl_WEAK_SYMBOLS - AS_CASE([$gl_cv_have_weak], [*yes], [ + AS_CASE([$gl_cv_have_weak], + [*yes], + [ dnl If we use weak symbols to implement pthread_in_use / pth_in_use / dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create dnl facility is in use. AC_CHECK_HEADERS_ONCE([threads.h]) : ]) - AS_CASE([$gl_use_threads], [isoc | isoc+posix], [ + AS_CASE([$gl_use_threads], + [isoc | isoc+posix], + [ AC_CHECK_HEADERS_ONCE([threads.h]) gl_have_isoc_threads="$ac_cv_header_threads_h" ]) - AS_CASE([$gl_use_threads], [yes | posix | isoc+posix], [ + AS_CASE([$gl_use_threads], + [yes | posix | isoc+posix], + [ gl_PTHREADLIB_BODY LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD @@ -527,7 +541,8 @@ AC_DEFUN([gl_THREADLIB_BODY] AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], [Define if references to the POSIX multithreading library are satisfied by libc.]) ], [ - AS_CASE([$gl_cv_have_weak], [*yes], + AS_CASE([$gl_cv_have_weak], + [*yes], [ AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], [Define if references to the POSIX multithreading library should be made weak.]) @@ -543,7 +558,8 @@ AC_DEFUN([gl_THREADLIB_BODY] AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], [Define if the pthread_in_use() detection is hard.]) ]) - ])]) + ]) + ]) ]) ]) ]) @@ -560,13 +576,16 @@ AC_DEFUN([gl_THREADLIB_BODY] ]) AS_IF([test $gl_threads_api = none], [ # The "win32" is for backward compatibility. - AS_CASE([$gl_use_threads], [yes | windows | win32], - [AS_CASE([$host_os], [mingw* | windows*], + AS_CASE([$gl_use_threads], + [yes | windows | win32], + [AS_CASE([$host_os], + [mingw* | windows*], [ gl_threads_api=windows AC_DEFINE([USE_WINDOWS_THREADS], [1], [Define if the native Windows multithreading API can be used.]) - ])]) + ]) + ]) ]) ]) AC_MSG_CHECKING([for multithread API to use])