public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] libiberty: Fix C89-isms in configure tests
@ 2022-10-18 14:10 Florian Weimer
  2022-10-18 14:14 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2022-10-18 14:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

libiberty/

	* acinclude.m4 (ac_cv_func_strncmp_works): Add missing
	int return type and parameter list to the definition of main.
	Include <stdlib.h> and <string.h> for prototypes.
	(ac_cv_c_stack_direction): Add missing
	int return type and parameter list to the definitions of
	main, find_stack_direction.  Include <stdlib.h> for exit
	prototype.
	* configure: Regenerate.

---
 libiberty/acinclude.m4 | 14 +++++++++++---
 libiberty/configure    | 14 +++++++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4
index 6bd127e9826..6bb690597bf 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 <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 
 #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 <stdlib.h>
+
+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 0a797255c70..ca83f89da6d 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 <stdlib.h>
+
+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 <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 
 #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;

base-commit: 1dc4488e091ae75bdd2c00a482db0f1b68229154


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] libiberty: Fix C89-isms in configure tests
  2022-10-18 14:10 [PATCH v2] libiberty: Fix C89-isms in configure tests Florian Weimer
@ 2022-10-18 14:14 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-10-18 14:14 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-patches

On Tue, Oct 18, 2022 at 04:10:43PM +0200, Florian Weimer wrote:
> libiberty/
> 
> 	* acinclude.m4 (ac_cv_func_strncmp_works): Add missing
> 	int return type and parameter list to the definition of main.
> 	Include <stdlib.h> and <string.h> for prototypes.
> 	(ac_cv_c_stack_direction): Add missing
> 	int return type and parameter list to the definitions of
> 	main, find_stack_direction.  Include <stdlib.h> for exit
> 	prototype.
> 	* configure: Regenerate.

LGTM.

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-18 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 14:10 [PATCH v2] libiberty: Fix C89-isms in configure tests Florian Weimer
2022-10-18 14:14 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).