Re: [patch] Test setrlimit with c++ in libstdc++/configure

2019-12-20 Thread Jonathan Wakely

On 16/12/19 14:51 +0100, Jérôme Lambourg wrote:

Hello,

In libstdc++, the test for the presence of setrlimit on the target is currently
performed in C as opposed to the other similar tests there. This leads on only a
warning being issued during configure as opposed to the expected error, and thus
improper definition of _GLIBCXX_RES_LIMITS.

This happens in particular on VxWorks where the standard header files are
available and the "struct rlimit" type definition is there. During configure,
only the setrlimit function prototype is missing so the compilation in C only
yield warnings and the test passes.

This patch fixes that by switching to C++ before testing setrlimit. It was
implemented first on gcc-8 for our internal needs, then ported to gcc-9 and now
mainline for contribution.

This change shouldn't impact targets where setrlimit is actually defined. I
tested the change on Linux to check that the result of the configure stage is
not changed by this patch.

Best regards,
Jerome


2019-12-16  Corentin Gay  
  Jerome Lambourg  

libstdc++
* acinclude.m4 (GLIBCXX_CHECK_SETRLIMIT): Test with AC_LANG_CPLUSPLUS.
* configure: Regenerate.



OK for trunk, thanks.


diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 016b0c583d0..0c58d722988 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -316,6 +316,8 @@ AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
])

AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
  setrlimit_have_headers=yes
  AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
  [],
@@ -352,6 +354,7 @@ AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
  else
ac_res_limits=no
  fi
+  AC_LANG_RESTORE
  AC_MSG_RESULT($ac_res_limits)
])






[patch] Test setrlimit with c++ in libstdc++/configure

2019-12-16 Thread Jérôme Lambourg
Hello,

In libstdc++, the test for the presence of setrlimit on the target is currently
performed in C as opposed to the other similar tests there. This leads on only a
warning being issued during configure as opposed to the expected error, and thus
improper definition of _GLIBCXX_RES_LIMITS.

This happens in particular on VxWorks where the standard header files are
available and the "struct rlimit" type definition is there. During configure,
only the setrlimit function prototype is missing so the compilation in C only
yield warnings and the test passes.

This patch fixes that by switching to C++ before testing setrlimit. It was
implemented first on gcc-8 for our internal needs, then ported to gcc-9 and now
mainline for contribution.

This change shouldn't impact targets where setrlimit is actually defined. I
tested the change on Linux to check that the result of the configure stage is
not changed by this patch.

Best regards,
Jerome


2019-12-16  Corentin Gay  
   Jerome Lambourg  

libstdc++
* acinclude.m4 (GLIBCXX_CHECK_SETRLIMIT): Test with AC_LANG_CPLUSPLUS.
* configure: Regenerate.



setrlimit_libstdcxx_configure.patch
Description: Binary data