Problems building rsync with Clang 15 beta

2022-08-18 Thread Paul Eggert via rsync

[Resending because the rsync mailing list rejected my email earlier.]

On 8/17/22 23:58, Khem Raj wrote:

rsync which add -pedantic-errors option to cflags during configure



OK, that's the problem then. 'configure' should not use flags like 
-pedantic-errors. This has long been a property of 'autoconf'-generated 
scripts.


The simplest way to fix this would be for rsync to not add 
-pedantic-errors, as it's more trouble than it's worth. But if rsync 
must add -pedantic-errors for some reason, it should do so at the very 
end of 'configure', as in the attached untested patch, so as not to 
screw up earlier 'configure' tests; and perhaps it'd be better for rsync 
to also add -pedantic-errors only for GCC not Clang (since Clang is more 
likely to mutate further in this area).


Really, though, omitting -pedantic-errors entirely is the way to go. 
-pedantic-errors should be enabled only for special purposes, by 
explicit request of the person running 'configure' and/or 'make'; it's 
not suitable as a default option.


Anyway, Khem, please give this rsync patch a try. I'll cc it to the 
rsync mailing list to give rsync developers a heads-up about the 
compatibility problem building rsync with Clang 15 (which luckily does 
not exist yet :-).From e64a58387db46239902b610871a0eb81626e99ff Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Thu, 18 Aug 2022 07:46:28 -0700
Subject: [PATCH] Turn on -pedantic-errors at the end of 'configure'

Problem reported by Khem Raj in:
https://lists.gnu.org/r/autoconf-patches/2022-08/msg9.html
---
 configure.ac | 35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index d185b2d3..7e9514f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1071,21 +1071,6 @@ elif test x"$ac_cv_header_popt_h" != x"yes"; then
 with_included_popt=yes
 fi
 
-if test x"$GCC" = x"yes"; then
-if test x"$with_included_popt" != x"yes"; then
-	# Turn pedantic warnings into errors to ensure an array-init overflow is an error.
-	CFLAGS="$CFLAGS -pedantic-errors"
-else
-	# Our internal popt code cannot be compiled with pedantic warnings as errors, so try to
-	# turn off pedantic warnings (which will not lose the error for array-init overflow).
-	# Older gcc versions don't understand -Wno-pedantic, so check if --help=warnings lists
-	# -Wpedantic and use that as a flag.
-	case `$CC --help=warnings 2>/dev/null | grep Wpedantic` in
-	*-Wpedantic*) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;;
-	esac
-fi
-fi
-
 AC_MSG_CHECKING([whether to use included libpopt])
 if test x"$with_included_popt" = x"yes"; then
 AC_MSG_RESULT($srcdir/popt)
@@ -1444,6 +1429,26 @@ case "$CC" in
 ;;
 esac
 
+# Enable -pedantic-errors last, so that it doesn't mess up other
+# 'configure' tests.  For example, Autoconf uses empty function
+# prototypes like 'int main () {}' which Clang 15's -pedantic-errors
+# would reject.  Generally it's not a good idea to try to run
+# 'configure' itself with strict compiler checking.
+if test x"$GCC" = x"yes"; then
+if test x"$with_included_popt" != x"yes"; then
+	# Turn pedantic warnings into errors to ensure an array-init overflow is an error.
+	CFLAGS="$CFLAGS -pedantic-errors"
+else
+	# Our internal popt code cannot be compiled with pedantic warnings as errors, so try to
+	# turn off pedantic warnings (which will not lose the error for array-init overflow).
+	# Older gcc versions don't understand -Wno-pedantic, so check if --help=warnings lists
+	# -Wpedantic and use that as a flag.
+	case `$CC --help=warnings 2>/dev/null | grep Wpedantic` in
+	*-Wpedantic*) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;;
+	esac
+fi
+fi
+
 AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
 AC_OUTPUT
 
-- 
2.37.1

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Problems building rsync with Clang 15 beta

2022-08-18 Thread Paul Eggert via rsync

On 8/18/22 09:38, Khem Raj wrote:

I think the autoconf patch should be good on its own merits regardless


It partly depends on how much we care about compatibility. Putting the 
'void' in there will break pre-C89 compilers, as well as C++ compilers 
pretending (badly) to be C compilers. I doubt whether we care about the 
former any more, but the latter might be an issue.




there were few other package
builds which started to succeed after this change in autoconf


Which ones, exactly, and why?

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: Problems building rsync with Clang 15 beta

2022-08-18 Thread Paul Eggert via rsync

On 8/18/22 19:31, Wayne Davison wrote:

Maybe Clang 15 broke the testing idiom that sets $GCC?


I think Clang has always pretended to be GCC well enough to fool 
Autoconf so that 'configure' sets GCC. What's new in Clang 15 is that it 
starts being pedantic about empty arglists, apparently.



--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html