public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] configure.ac: drop unnecessary gnu99 extension checks
@ 2021-08-10 12:56 Adrian Ratiu
  2021-08-23 20:21 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Ratiu @ 2021-08-10 12:56 UTC (permalink / raw)
  To: elfutils-devel; +Cc: manojgupta

It is true that Clang does not support all gnu99 extensions [1],
but not all of them are used in the codebase and over time there
have been code cleanup efforts to improve Clang support.

For example after commit 779c57ea ("readelf: Pull advance_pc()
in file scope") there are no more nested function declarations
and elfutils now builds fine with Clang.

So in the interest of enabling Clang builds we remove the only
remaining blocker: the configure checks for nested functions and
variable length arrays which are also unused.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=24964
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
---
 ChangeLog    |  4 ++++
 configure.ac | 11 -----------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 12b8f403..32f5b68d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-08-10  Adrian Ratiu  <adrian.ratiu@collabora.com>
+
+	* configure.ac (AC_CACHE_CHECK): Drop unnecessary std=gnu99 checks
+
 2021-07-28  Mark Wielaard  <mark@klomp.org>
 
 	* configure.ac (AC_CHECK_DECLS): Add reallocarray check.
diff --git a/configure.ac b/configure.ac
index 7caff2c5..c14eb9f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,17 +112,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
 int foo (int a)
 {
   for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s;
-}
-
-double bar (double a, double b)
-{
-  double square (double z) { return z * z; }
-  return square (a) + square (b);
-}
-
-void baz (int n)
-{
-  struct S { int x[[n]]; };
 }])],
 		  ac_cv_c99=yes, ac_cv_c99=no)
 CFLAGS="$old_CFLAGS"])
-- 
2.32.0


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

* Re: [PATCH] configure.ac: drop unnecessary gnu99 extension checks
  2021-08-10 12:56 [PATCH] configure.ac: drop unnecessary gnu99 extension checks Adrian Ratiu
@ 2021-08-23 20:21 ` Mark Wielaard
  2021-08-26 12:00   ` Adrian Ratiu
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2021-08-23 20:21 UTC (permalink / raw)
  To: Adrian Ratiu; +Cc: elfutils-devel, manojgupta

Hi Adrian,

On Tue, Aug 10, 2021 at 03:56:51PM +0300, Adrian Ratiu via Elfutils-devel wrote:
> So in the interest of enabling Clang builds we remove the only
> remaining blocker: the configure checks for nested functions and
> variable length arrays which are also unused.

Can we just remove the whole configure test? And change the AC_PROG_CC
to AC_PROG_CC_C99?

The patch doesn't update the comments about what is being tested, and
the only thing being tested now is Mixed Declarations and Code, which
is a standard part of C99.

Have you tried running make check with an alternative compiler? There
are a couple of "self tests" which run the code on the just produced
binaries and it would be interesting to know whether or not all tests
pass.

Thanks,

Mark

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

* Re: [PATCH] configure.ac: drop unnecessary gnu99 extension checks
  2021-08-23 20:21 ` Mark Wielaard
@ 2021-08-26 12:00   ` Adrian Ratiu
  0 siblings, 0 replies; 3+ messages in thread
From: Adrian Ratiu @ 2021-08-26 12:00 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel, manojgupta

Hi Mark,

On Mon, 23 Aug 2021, Mark Wielaard <mark@klomp.org> wrote:
> Hi Adrian, 
> 
> On Tue, Aug 10, 2021 at 03:56:51PM +0300, Adrian Ratiu via 
> Elfutils-devel wrote: 
>> So in the interest of enabling Clang builds we remove the only 
>> remaining blocker: the configure checks for nested functions 
>> and variable length arrays which are also unused. 
> 
> Can we just remove the whole configure test? And change the 
> AC_PROG_CC to AC_PROG_CC_C99?

Yes, I think we can do that.
 
> 
> The patch doesn't update the comments about what is being 
> tested, and the only thing being tested now is Mixed 
> Declarations and Code, which is a standard part of C99.

Good catch. I'll update and send a v2.
 
> 
> Have you tried running make check with an alternative compiler? 
> There are a couple of "self tests" which run the code on the 
> just produced binaries and it would be interesting to know 
> whether or not all tests pass.

I did comparative builds within the Gentoo/ChromeOS build 
environments with the GNU/GCC 10.2 and LLVM/Clang 13.0 toolchains.

With GCC:

# TOTAL: 224 PASS:  214 SKIP:  7 XFAIL: 0 FAIL:  3 XPASS: 0 ERROR: 
# 0 

With Clang:

# TOTAL: 224 PASS:  212 SKIP:  7 XFAIL: 0 FAIL:  5 XPASS: 0 ERROR: 
# 0 

The two tests which failed are run-strip-strmerge.sh and 
run-reverse-sections-self.sh because the `.gnu.version` is 
invalid.

Links are below for the gcc [1] vs clang [2] test-suite.logs.

[1] 
https://drive.google.com/file/d/1uQSHarIQwA07fIih0ZHHt8zfim_BWRYP/view?usp=sharing
[2] 
https://drive.google.com/file/d/1q7iGXjutyoLgM4iOm_rFMVxT11dnwpt5/view?usp=sharing

Thanks,
Adrian

>
> Thanks,
>
> Mark

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

end of thread, other threads:[~2021-08-26 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 12:56 [PATCH] configure.ac: drop unnecessary gnu99 extension checks Adrian Ratiu
2021-08-23 20:21 ` Mark Wielaard
2021-08-26 12:00   ` Adrian Ratiu

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).