From 910689b88d5581aa6f0934278d21839ccf30da18 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Tue, 29 Nov 2022 14:19:51 -0800 Subject: [PATCH] Updates for "ModernC" initiative Resolves: rhbz#2143992 --- _gdb.spec.Patch.include | 4 + _gdb.spec.patch.include | 1 + _patch_order | 1 + gdb-6.6-buildid-locate-rpm.patch | 6 +- gdb-fedora-libncursesw.patch | 12 +- ...2-libiberty-fix-c89isms-in-configure.patch | 109 ++++++++++++++++++ gdb.spec | 5 + 7 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index e2b909c..6d16d7e 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -309,3 +309,7 @@ Patch073: gdb-backport-fix-break-main-file-remove-fail.patch # (Keith Seitz, build/22395) Patch074: gdb-sw22395-constify-target_desc.patch +# libiberty: Fix C89-isms in configure tests +# (Florian Weimer, RHBZ 2143992) +Patch075: gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index affe771..f5bd893 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -72,3 +72,4 @@ %patch072 -p1 %patch073 -p1 %patch074 -p1 +%patch075 -p1 diff --git a/_patch_order b/_patch_order index bc9565c..90e7185 100644 --- a/_patch_order +++ b/_patch_order @@ -72,3 +72,4 @@ gdb-rhbz1553104-s390x-arch12-test.patch gdb-backport-readline_support.patch gdb-backport-fix-break-main-file-remove-fail.patch gdb-sw22395-constify-target_desc.patch +gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index efaf989..6c3b728 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -305,7 +305,7 @@ diff --git a/gdb/configure b/gdb/configure YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. -@@ -6634,6 +6646,494 @@ _ACEOF +@@ -6634,6 +6646,495 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -369,6 +369,7 @@ diff --git a/gdb/configure b/gdb/configure +#include +#include +#include ++#include + +int +main () @@ -803,7 +804,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, +@@ -153,6 +153,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, [Directories safe to hold auto-loaded files.]) AC_MSG_RESULT([$with_auto_load_safe_path]) @@ -853,6 +854,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac +#include +#include +#include ++#include + ]], [[ + void *h; + const char *const *rpmverp; diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index 7456bf8..a1181d8 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534 diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9567,6 +9567,7 @@ if test x"$prefer_curses" = xyes; then +@@ -9568,6 +9568,7 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 $as_echo_n "checking for library containing waddstr... " >&6; } if ${ac_cv_search_waddstr+:} false; then : -@@ -9591,7 +9592,7 @@ return waddstr (); +@@ -9592,7 +9593,7 @@ return waddstr (); return 0; } _ACEOF @@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure if test -z "$ac_lib"; then ac_res="none required" else -@@ -9665,6 +9666,7 @@ case $host_os in +@@ -9666,6 +9667,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 $as_echo_n "checking for library containing tgetent... " >&6; } if ${ac_cv_search_tgetent+:} false; then : -@@ -9689,7 +9691,7 @@ return tgetent (); +@@ -9690,7 +9692,7 @@ return tgetent (); return 0; } _ACEOF @@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -713,7 +713,8 @@ if test x"$prefer_curses" = xyes; then +@@ -714,7 +714,8 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_waddstr" != no; then curses_found=yes -@@ -755,7 +756,8 @@ case $host_os in +@@ -756,7 +757,8 @@ case $host_os in esac # These are the libraries checked by Readline. diff --git a/gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch b/gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch new file mode 100644 index 0000000..89f51b0 --- /dev/null +++ b/gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch @@ -0,0 +1,109 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Keith Seitz +Date: Tue, 29 Nov 2022 13:43:34 -0800 +Subject: gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch + +;; libiberty: Fix C89-isms in configure tests +;; (Florian Weimer, RHBZ 2143992) + + 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. + +diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4 +--- 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 +--- a/libiberty/configure ++++ b/libiberty/configure +@@ -6918,7 +6918,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; +@@ -6930,7 +6933,9 @@ find_stack_direction () + else + return (&dummy > addr) ? 1 : -1; + } +-main () ++ ++int ++main (void) + { + exit (find_stack_direction() < 0); + } +@@ -7755,6 +7760,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 +@@ -7782,7 +7789,8 @@ else + + #define MAP_LEN 0x10000 + +-main () ++int ++main (void) + { + #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) + char *p; diff --git a/gdb.spec b/gdb.spec index db60cd0..09d4246 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1186,6 +1186,11 @@ fi %endif %changelog +* Wed Nov 30 2022 Keith Seitz +- Backport "libiberty: Fix C89-isms in configure tests" and do likewise in + gdb-6.6-buildid-locate-rpm.patch. + (Florian Weimer, RHBZ 2143992) + * Wed Nov 23 2022 Kevin Buettner - Remove gdb-6.3-inheritancetest-20050726.patch. Upstream testcase gdb.cp/impl-this.exp tests the printing of an instance variable from