From b4a60afda25fe02fe6e5edd82433135f4f9cd56c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 4 Jan 2023 14:36:27 +0100 Subject: [PATCH] Apply upstream patches for better C99 compatibility of configure scripts Related to: --- mingw-gcc-configure-c99-1.patch | 40 ++++++++++++ mingw-gcc-configure-c99-2.patch | 111 ++++++++++++++++++++++++++++++++ mingw-gcc.spec | 8 ++- 3 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 mingw-gcc-configure-c99-1.patch create mode 100644 mingw-gcc-configure-c99-2.patch diff --git a/mingw-gcc-configure-c99-1.patch b/mingw-gcc-configure-c99-1.patch new file mode 100644 index 0000000..82070b9 --- /dev/null +++ b/mingw-gcc-configure-c99-1.patch @@ -0,0 +1,40 @@ +commit 7d7146102365f708a37401c902fce2f4024b546a +Author: Florian Weimer +Date: Wed Jan 4 11:13:17 2023 +0100 + + libsanitizer: Avoid implicit function declaration in configure test + + libsanitizer/ + + * configure.ac (sanitizer_supported): Include for + syscall prototype. + * configure: Regenerate. + + (cherry picked from commit 6be2672e4ee41c566a9e072088cccca263bab5f7) + +diff --git a/libsanitizer/configure b/libsanitizer/configure +index 771b135573a8b031..ae8c1bd7e831e83d 100755 +--- a/libsanitizer/configure ++++ b/libsanitizer/configure +@@ -16028,6 +16028,7 @@ case "$target" in + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include ++#include + int + main () + { +diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac +index 7f1ef3979c4cb03c..ad49f29db7e04d30 100644 +--- a/libsanitizer/configure.ac ++++ b/libsanitizer/configure.ac +@@ -161,7 +161,8 @@ case "$target" in + *-*-linux*) + # Some old Linux distributions miss required syscalls. + sanitizer_supported=no +- AC_TRY_COMPILE([#include ],[ ++ AC_TRY_COMPILE([#include ++#include ],[ + syscall (__NR_gettid); + syscall (__NR_futex); + syscall (__NR_exit_group); diff --git a/mingw-gcc-configure-c99-2.patch b/mingw-gcc-configure-c99-2.patch new file mode 100644 index 0000000..f1bafe0 --- /dev/null +++ b/mingw-gcc-configure-c99-2.patch @@ -0,0 +1,111 @@ +commit 63f3eae53683e857818c4bd3d1de719e1310e22a +Author: Florian Weimer +Date: Tue Oct 18 16:58:48 2022 +0200 + + libiberty: Fix C89-isms in configure tests + + libiberty/ + + * acinclude.m4 (ac_cv_func_strncmp_works): Add missing + int return type and parameter list to the definition of main. + Include and for prototypes. + (ac_cv_c_stack_direction): Add missing + int return type and parameter list to the definitions of + main, find_stack_direction. Include for exit + prototype. + * configure: Regenerate. + + (cherry picked from commit 885b6660c17fb91980b5682514ef54668e544b02) + +diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4 +index 6bd127e98268b7ab..6bb690597bfb77c9 100644 +--- a/libiberty/acinclude.m4 ++++ b/libiberty/acinclude.m4 +@@ -24,6 +24,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works, + [AC_TRY_RUN([ + /* Test by Jim Wilson and Kaveh Ghazi. + Check whether strncmp reads past the end of its string parameters. */ ++#include ++#include + #include + + #ifdef HAVE_FCNTL_H +@@ -51,7 +53,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works, + + #define MAP_LEN 0x10000 + +-main () ++int ++main (void) + { + #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) + char *p; +@@ -157,7 +160,10 @@ if test $ac_cv_os_cray = yes; then + fi + + AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +-[AC_TRY_RUN([find_stack_direction () ++[AC_TRY_RUN([#include ++ ++int ++find_stack_direction (void) + { + static char *addr = 0; + auto char dummy; +@@ -169,7 +175,9 @@ AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, + else + return (&dummy > addr) ? 1 : -1; + } +-main () ++ ++int ++main (void) + { + exit (find_stack_direction() < 0); + }], +diff --git a/libiberty/configure b/libiberty/configure +index 0a797255c70c00f6..ca83f89da6d670d3 100755 +--- a/libiberty/configure ++++ b/libiberty/configure +@@ -6780,7 +6780,10 @@ else + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-find_stack_direction () ++#include ++ ++int ++find_stack_direction (void) + { + static char *addr = 0; + auto char dummy; +@@ -6792,7 +6795,9 @@ find_stack_direction () + else + return (&dummy > addr) ? 1 : -1; + } +-main () ++ ++int ++main (void) + { + exit (find_stack_direction() < 0); + } +@@ -7617,6 +7622,8 @@ else + + /* Test by Jim Wilson and Kaveh Ghazi. + Check whether strncmp reads past the end of its string parameters. */ ++#include ++#include + #include + + #ifdef HAVE_FCNTL_H +@@ -7644,7 +7651,8 @@ else + + #define MAP_LEN 0x10000 + +-main () ++int ++main (void) + { + #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) + char *p; diff --git a/mingw-gcc.spec b/mingw-gcc.spec index ae15b7d..9d2afa1 100644 --- a/mingw-gcc.spec +++ b/mingw-gcc.spec @@ -25,7 +25,7 @@ Name: mingw-gcc Version: %{gcc_version} -Release: 5%{?dist} +Release: 6%{?dist} Summary: MinGW Windows cross-compiler (GCC) for C License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions @@ -43,6 +43,9 @@ Source0: %{srcdir}.tar.xz # See https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/8fd2fb03-9b8a-07e1-e162-0bb48bcc3984%40gmail.com/#msg37200751 Patch0: 0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch +Patch1: mingw-gcc-configure-c99-1.patch +Patch2: mingw-gcc-configure-c99-2.patch + BuildRequires: gcc-c++ BuildRequires: make BuildRequires: texinfo @@ -901,6 +904,9 @@ ln -sf %{ucrt64_bindir}/libssp-0.dll %{buildroot}%{ucrt64_libdir}/libssp.dll.a %changelog +* Wed Jan 04 2023 Florian Weimer - 12.2.1-6 +- Apply upstream patches to improve C99 compatibility of configure scripts + * Wed Jan 04 2023 Sandro Mani - 12.2.1-5 - Update to 20221121 snapshot