public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite:analyzer: Fix header include for FreeBSD
@ 2020-05-01 19:49 Andreas Tobler
  2020-05-03 16:27 ` Kamil Rytarowski
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Tobler @ 2020-05-01 19:49 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

Hi all,

FreeBSD does not have the alloca.h header. Do not include it in the test 
cases which do include alloca.h.

There are two versions of this patch available, the one attached which 
uses ifdef or another one which defines alloca with __builtin_alloca.

I tested both approaches and they work on FreeBSD. I do not know which 
one you prefer.

Opinions welcome.

Ok for trunk?
TIA,
Andreas

[-- Attachment #2: 0001-testsuite-analyzer-Fix-header-include-for-FreeBSD.patch --]
[-- Type: text/plain, Size: 2169 bytes --]

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 949b81a4392..b67758bbc91 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-01  Andreas Tobler  <andreast@gcc.gnu.org>
+
+	* gcc.dg/analyzer/alloca-leak.c: Do not include
+	alloca.h for FreeBSD.
+	*  gcc.dg/analyzer/data-model-1.c: Likewise
+	* gcc.dg/analyzer/malloc-1.c: Likewise.
+	* gcc.dg/analyzer/malloc-paths-8.c: Likewise.
+
 2020-05-01  Andreas Tobler  <andreast@gcc.gnu.org>
 
 	* gcc.dg/asan/pr87930.c: Enable on x86_64 FreeBSD.
diff --git a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
index 6d9fe3431ce..ed4e4e38888 100644
--- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
+++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
@@ -1,5 +1,8 @@
+#ifdef __FreeBSD__
+#include <stdlib.h>
+#else
 #include <alloca.h>
-
+#endif
 void *test (void)
 {
   void *ptr = alloca (64);
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index 1db99133d50..6fa35db03b5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -1,7 +1,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#ifndef __FreeBSD__
 #include <alloca.h>
+#endif
 #include "analyzer-decls.h"
 
 struct foo
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
index 3024e546137..94f631b2a1d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
@@ -1,4 +1,6 @@
+#ifndef __FreeBSD__
 #include <alloca.h>
+#endif
 #include <stdlib.h>
 
 extern int foo (void);
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
index 10b97a05402..5fa9ad3b58e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
@@ -1,7 +1,9 @@
 /* { dg-additional-options "-fanalyzer-transitivity" } */
 
 #include <stddef.h>
+#ifndef __FreeBSD__
 #include <alloca.h>
+#endif
 #include <stdlib.h>
 
 extern void do_stuff (const void *);
-- 
2.24.1


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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-01 19:49 [PATCH] testsuite:analyzer: Fix header include for FreeBSD Andreas Tobler
@ 2020-05-03 16:27 ` Kamil Rytarowski
  2020-05-03 20:31   ` Andreas Tobler
  0 siblings, 1 reply; 12+ messages in thread
From: Kamil Rytarowski @ 2020-05-03 16:27 UTC (permalink / raw)
  To: Andreas Tobler, GCC Patches


[-- Attachment #1.1: Type: text/plain, Size: 544 bytes --]

On 01.05.2020 21:49, Andreas Tobler wrote:
> Hi all,
> 
> FreeBSD does not have the alloca.h header. Do not include it in the test
> cases which do include alloca.h.
> 
> There are two versions of this patch available, the one attached which
> uses ifdef or another one which defines alloca with __builtin_alloca.
> 
> I tested both approaches and they work on FreeBSD. I do not know which
> one you prefer.
> 
> Opinions welcome.
> 
> Ok for trunk?
> TIA,
> Andreas

Please include in your patch "|| defined(__NetBSD__)".


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-03 16:27 ` Kamil Rytarowski
@ 2020-05-03 20:31   ` Andreas Tobler
  2020-05-04  9:49     ` Kamil Rytarowski
  2020-05-05 16:22     ` Jeff Law
  0 siblings, 2 replies; 12+ messages in thread
From: Andreas Tobler @ 2020-05-03 20:31 UTC (permalink / raw)
  To: Kamil Rytarowski, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 713 bytes --]

On 03.05.20 18:27, Kamil Rytarowski wrote:
> On 01.05.2020 21:49, Andreas Tobler wrote:
>> Hi all,
>>
>> FreeBSD does not have the alloca.h header. Do not include it in the test
>> cases which do include alloca.h.
>>
>> There are two versions of this patch available, the one attached which
>> uses ifdef or another one which defines alloca with __builtin_alloca.
>>
>> I tested both approaches and they work on FreeBSD. I do not know which
>> one you prefer.
>>
>> Opinions welcome.
>>
>> Ok for trunk?
>> TIA,
>> Andreas
> 
> Please include in your patch "|| defined(__NetBSD__)".

is this ok for you?

This is one reason why I'd prefer #define alloca __builtin_alloca and 
leave the include away.....

Andreas

[-- Attachment #2: 0001-testsuite-analyzer-Fix-header-include-for-Free-NetBS.patch --]
[-- Type: text/plain, Size: 2909 bytes --]

From 70165e30fb5b4398c903b4522d6496c7da7c12fa Mon Sep 17 00:00:00 2001
From: Andreas Tobler <andreast@gcc.gnu.org>
Date: Fri, 1 May 2020 21:10:39 +0200
Subject: [PATCH] testsuite: analyzer: Fix header include for Free/NetBSD

FreeBSD and NetBSD do not have the alloca.h header.
Fix this with ifndef on alloca.h.
---
 gcc/testsuite/ChangeLog                        | 8 ++++++++
 gcc/testsuite/gcc.dg/analyzer/alloca-leak.c    | 5 ++++-
 gcc/testsuite/gcc.dg/analyzer/data-model-1.c   | 2 ++
 gcc/testsuite/gcc.dg/analyzer/malloc-1.c       | 2 ++
 gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c | 2 ++
 5 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 185f9ea725e..3f7b409bd42 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-03  Andreas Tobler  <andreast@gcc.gnu.org>
+
+	* gcc.dg/analyzer/alloca-leak.c: Do not include
+	  alloca.h for Free/NetBSD.
+	* gcc.dg/analyzer/data-model-1.c: Likewise
+	* gcc.dg/analyzer/malloc-1.c: Likewise.
+	* gcc.dg/analyzer/malloc-paths-8.c: Likewise.
+
 2020-05-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR target/93492
diff --git a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
index 6d9fe3431ce..631e81b8cf4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
+++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
@@ -1,5 +1,8 @@
+#if defined (__FreeBSD__) || defined(__NetBSD__)
+#include <stdlib.h>
+#else
 #include <alloca.h>
-
+#endif
 void *test (void)
 {
   void *ptr = alloca (64);
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index 1db99133d50..f06651802a5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -1,7 +1,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#if (!defined(__FreeBSD__) && !defined(__NetBSD__))
 #include <alloca.h>
+#endif
 #include "analyzer-decls.h"
 
 struct foo
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
index 3024e546137..046e3353192 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
@@ -1,4 +1,6 @@
+#if (!defined(__FreeBSD__) && !defined(__NetBSD__))
 #include <alloca.h>
+#endif
 #include <stdlib.h>
 
 extern int foo (void);
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
index 10b97a05402..d55d6350da8 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
@@ -1,7 +1,9 @@
 /* { dg-additional-options "-fanalyzer-transitivity" } */
 
 #include <stddef.h>
+#if (!defined(__FreeBSD__) && !defined(__NetBSD__))
 #include <alloca.h>
+#endif
 #include <stdlib.h>
 
 extern void do_stuff (const void *);
-- 
2.24.1


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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-03 20:31   ` Andreas Tobler
@ 2020-05-04  9:49     ` Kamil Rytarowski
  2020-05-04 10:04       ` Jakub Jelinek
  2020-05-05 16:22     ` Jeff Law
  1 sibling, 1 reply; 12+ messages in thread
From: Kamil Rytarowski @ 2020-05-04  9:49 UTC (permalink / raw)
  To: Andreas Tobler, GCC Patches


[-- Attachment #1.1: Type: text/plain, Size: 941 bytes --]

On 03.05.2020 22:31, Andreas Tobler wrote:
> On 03.05.20 18:27, Kamil Rytarowski wrote:
>> On 01.05.2020 21:49, Andreas Tobler wrote:
>>> Hi all,
>>>
>>> FreeBSD does not have the alloca.h header. Do not include it in the test
>>> cases which do include alloca.h.
>>>
>>> There are two versions of this patch available, the one attached which
>>> uses ifdef or another one which defines alloca with __builtin_alloca.
>>>
>>> I tested both approaches and they work on FreeBSD. I do not know which
>>> one you prefer.
>>>
>>> Opinions welcome.
>>>
>>> Ok for trunk?
>>> TIA,
>>> Andreas
>>
>> Please include in your patch "|| defined(__NetBSD__)".
> 
> is this ok for you?
> 
> This is one reason why I'd prefer #define alloca __builtin_alloca and
> leave the include away.....
> 
> Andreas

It looks fine to me now.

Personally, I would include stdlib.h unconditionally and alloca.h on
!FreeBSD && !NetBSD.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-04  9:49     ` Kamil Rytarowski
@ 2020-05-04 10:04       ` Jakub Jelinek
  2020-05-04 10:10         ` Kamil Rytarowski
  0 siblings, 1 reply; 12+ messages in thread
From: Jakub Jelinek @ 2020-05-04 10:04 UTC (permalink / raw)
  To: David Malcolm, Kamil Rytarowski; +Cc: Andreas Tobler, GCC Patches

On Mon, May 04, 2020 at 11:49:27AM +0200, Kamil Rytarowski wrote:
> >> Please include in your patch "|| defined(__NetBSD__)".
> > 
> > is this ok for you?
> > 
> > This is one reason why I'd prefer #define alloca __builtin_alloca and
> > leave the include away.....
> > 
> > Andreas
> 
> It looks fine to me now.
> 
> Personally, I would include stdlib.h unconditionally and alloca.h on
> !FreeBSD && !NetBSD.

It just just a test.
Perhaps it could
#include <stdlib.h>
#if __has_include(<alloca.h>)
#include <alloca.h>
#endif
?

	Jakub


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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-04 10:04       ` Jakub Jelinek
@ 2020-05-04 10:10         ` Kamil Rytarowski
  2020-05-06 19:54           ` Andreas Tobler
  0 siblings, 1 reply; 12+ messages in thread
From: Kamil Rytarowski @ 2020-05-04 10:10 UTC (permalink / raw)
  To: Jakub Jelinek, David Malcolm; +Cc: Andreas Tobler, GCC Patches


[-- Attachment #1.1: Type: text/plain, Size: 655 bytes --]

On 04.05.2020 12:04, Jakub Jelinek wrote:
> On Mon, May 04, 2020 at 11:49:27AM +0200, Kamil Rytarowski wrote:
>>>> Please include in your patch "|| defined(__NetBSD__)".
>>>
>>> is this ok for you?
>>>
>>> This is one reason why I'd prefer #define alloca __builtin_alloca and
>>> leave the include away.....
>>>
>>> Andreas
>>
>> It looks fine to me now.
>>
>> Personally, I would include stdlib.h unconditionally and alloca.h on
>> !FreeBSD && !NetBSD.
> 
> It just just a test.
> Perhaps it could
> #include <stdlib.h>
> #if __has_include(<alloca.h>)
> #include <alloca.h>
> #endif
> ?
> 
> 	Jakub
> 

This looks fine too.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-03 20:31   ` Andreas Tobler
  2020-05-04  9:49     ` Kamil Rytarowski
@ 2020-05-05 16:22     ` Jeff Law
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff Law @ 2020-05-05 16:22 UTC (permalink / raw)
  To: Andreas Tobler, Kamil Rytarowski, GCC Patches

On Sun, 2020-05-03 at 22:31 +0200, Andreas Tobler wrote:
> On 03.05.20 18:27, Kamil Rytarowski wrote:
> > On 01.05.2020 21:49, Andreas Tobler wrote:
> > > Hi all,
> > > 
> > > FreeBSD does not have the alloca.h header. Do not include it in the test
> > > cases which do include alloca.h.
> > > 
> > > There are two versions of this patch available, the one attached which
> > > uses ifdef or another one which defines alloca with __builtin_alloca.
> > > 
> > > I tested both approaches and they work on FreeBSD. I do not know which
> > > one you prefer.
> > > 
> > > Opinions welcome.
> > > 
> > > Ok for trunk?
> > > TIA,
> > > Andreas
> > 
> > Please include in your patch "|| defined(__NetBSD__)".
> 
> is this ok for you?
> 
> This is one reason why I'd prefer #define alloca __builtin_alloca and 
> leave the include away.....
OK for the trunk.
jeff


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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-04 10:10         ` Kamil Rytarowski
@ 2020-05-06 19:54           ` Andreas Tobler
  2020-05-06 20:12             ` Jakub Jelinek
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Tobler @ 2020-05-06 19:54 UTC (permalink / raw)
  To: Kamil Rytarowski, Jakub Jelinek, David Malcolm; +Cc: GCC Patches

On 04.05.20 12:10, Kamil Rytarowski wrote:
> On 04.05.2020 12:04, Jakub Jelinek wrote:
>> On Mon, May 04, 2020 at 11:49:27AM +0200, Kamil Rytarowski wrote:
>>>>> Please include in your patch "|| defined(__NetBSD__)".
>>>>
>>>> is this ok for you?
>>>>
>>>> This is one reason why I'd prefer #define alloca __builtin_alloca and
>>>> leave the include away.....
>>>>
>>>> Andreas
>>>
>>> It looks fine to me now.
>>>
>>> Personally, I would include stdlib.h unconditionally and alloca.h on
>>> !FreeBSD && !NetBSD.
>>
>> It just just a test.
>> Perhaps it could
>> #include <stdlib.h>
>> #if __has_include(<alloca.h>)
>> #include <alloca.h>
>> #endif
>> ?
>>
>> 	Jakub
>>
> 
> This looks fine too.
> 

K, fine with me. I'll commit this solution once I finished testing. Thanks,
Andreas

+2020-05-07  Andreas Tobler  <andreast@gcc.gnu.org>
+
+       * gcc.dg/analyzer/alloca-leak.c: Include alloca.h only if
+         available.
+       * gcc.dg/analyzer/data-model-1.c: Likewise
+       * gcc.dg/analyzer/malloc-1.c: Likewise.
+       * gcc.dg/analyzer/malloc-paths-8.c: Likewise.

diff --git a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c 
b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
index 6d9fe3431ce..e4717a1bbb3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
+++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
@@ -1,5 +1,6 @@
-#include <alloca.h>
-
+#include <stdlib.h>
+#if __has_include(<alloca.h>)
+#endif
  void *test (void)
  {
    void *ptr = alloca (64);
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c 
b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index 1db99133d50..32559952e34 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -1,7 +1,8 @@
  #include <stdlib.h>
  #include <string.h>
  #include <stdio.h>
-#include <alloca.h>
+#if __has_include(<alloca.h>)
+#endif
  #include "analyzer-decls.h"

  struct foo
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c 
b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
index 3024e546137..0f3f1fc760a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
@@ -1,4 +1,5 @@
-#include <alloca.h>
+#if __has_include(<alloca.h>)
+#endif
  #include <stdlib.h>

  extern int foo (void);
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c 
b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
index 10b97a05402..35035d27ff7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
@@ -1,7 +1,8 @@
  /* { dg-additional-options "-fanalyzer-transitivity" } */

  #include <stddef.h>
-#include <alloca.h>
+#if __has_include(<alloca.h>)
+#endif
  #include <stdlib.h>

  extern void do_stuff (const void *);

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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-06 19:54           ` Andreas Tobler
@ 2020-05-06 20:12             ` Jakub Jelinek
  2020-05-06 20:25               ` Andreas Tobler
  0 siblings, 1 reply; 12+ messages in thread
From: Jakub Jelinek @ 2020-05-06 20:12 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: Kamil Rytarowski, David Malcolm, GCC Patches

On Wed, May 06, 2020 at 09:54:47PM +0200, Andreas Tobler wrote:
> --- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
> @@ -1,5 +1,6 @@
> -#include <alloca.h>
> -
> +#include <stdlib.h>

It needs to be:
> +#if __has_include(<alloca.h>)

+#include <alloca.h>

> +#endif

__has_include doesn't include anything, just checks if the header is
available.

	Jakub


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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-06 20:12             ` Jakub Jelinek
@ 2020-05-06 20:25               ` Andreas Tobler
  2020-05-06 20:27                 ` Kamil Rytarowski
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Tobler @ 2020-05-06 20:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Kamil Rytarowski, David Malcolm, GCC Patches

On 06.05.20 22:12, Jakub Jelinek wrote:
> On Wed, May 06, 2020 at 09:54:47PM +0200, Andreas Tobler wrote:
>> --- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
>> +++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
>> @@ -1,5 +1,6 @@
>> -#include <alloca.h>
>> -
>> +#include <stdlib.h>
> 
> It needs to be:
>> +#if __has_include(<alloca.h>)
> 
> +#include <alloca.h>
> 
>> +#endif

Doh :(

Fixed, thanks.

> __has_include doesn't include anything, just checks if the header is
> available.

Then I just wonder why the tests passed on Linux (ubuntu-20.04)

Andreas

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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-06 20:25               ` Andreas Tobler
@ 2020-05-06 20:27                 ` Kamil Rytarowski
  2020-05-06 20:33                   ` Andreas Tobler
  0 siblings, 1 reply; 12+ messages in thread
From: Kamil Rytarowski @ 2020-05-06 20:27 UTC (permalink / raw)
  To: Andreas Tobler, Jakub Jelinek; +Cc: David Malcolm, GCC Patches


[-- Attachment #1.1: Type: text/plain, Size: 741 bytes --]

On 06.05.2020 22:25, Andreas Tobler wrote:
> On 06.05.20 22:12, Jakub Jelinek wrote:
>> On Wed, May 06, 2020 at 09:54:47PM +0200, Andreas Tobler wrote:
>>> --- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
>>> +++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
>>> @@ -1,5 +1,6 @@
>>> -#include <alloca.h>
>>> -
>>> +#include <stdlib.h>
>>
>> It needs to be:
>>> +#if __has_include(<alloca.h>)
>>
>> +#include <alloca.h>
>>
>>> +#endif
> 
> Doh :(
> 
> Fixed, thanks.
> 
>> __has_include doesn't include anything, just checks if the header is
>> available.
> 
> Then I just wonder why the tests passed on Linux (ubuntu-20.04)
> 

alloca.h is only needed on solaris. Other system can use stdlib.h.

> Andreas



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] testsuite:analyzer: Fix header include for FreeBSD
  2020-05-06 20:27                 ` Kamil Rytarowski
@ 2020-05-06 20:33                   ` Andreas Tobler
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Tobler @ 2020-05-06 20:33 UTC (permalink / raw)
  To: Kamil Rytarowski, Jakub Jelinek; +Cc: David Malcolm, GCC Patches

On 06.05.20 22:27, Kamil Rytarowski wrote:
> On 06.05.2020 22:25, Andreas Tobler wrote:
>> On 06.05.20 22:12, Jakub Jelinek wrote:
>>> On Wed, May 06, 2020 at 09:54:47PM +0200, Andreas Tobler wrote:
>>>> --- a/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
>>>> +++ b/gcc/testsuite/gcc.dg/analyzer/alloca-leak.c
>>>> @@ -1,5 +1,6 @@
>>>> -#include <alloca.h>
>>>> -
>>>> +#include <stdlib.h>
>>>
>>> It needs to be:
>>>> +#if __has_include(<alloca.h>)
>>>
>>> +#include <alloca.h>
>>>
>>>> +#endif
>>
>> Doh :(
>>
>> Fixed, thanks.
>>
>>> __has_include doesn't include anything, just checks if the header is
>>> available.
>>
>> Then I just wonder why the tests passed on Linux (ubuntu-20.04)
>>
> 
> alloca.h is only needed on solaris. Other system can use stdlib.h.

Ok, I see. and alloca-leak.c succeed because I included unconditionally 
the stdlib.h. Sigh, foot shot.

Thanks,
Andreas



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

end of thread, other threads:[~2020-05-06 20:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 19:49 [PATCH] testsuite:analyzer: Fix header include for FreeBSD Andreas Tobler
2020-05-03 16:27 ` Kamil Rytarowski
2020-05-03 20:31   ` Andreas Tobler
2020-05-04  9:49     ` Kamil Rytarowski
2020-05-04 10:04       ` Jakub Jelinek
2020-05-04 10:10         ` Kamil Rytarowski
2020-05-06 19:54           ` Andreas Tobler
2020-05-06 20:12             ` Jakub Jelinek
2020-05-06 20:25               ` Andreas Tobler
2020-05-06 20:27                 ` Kamil Rytarowski
2020-05-06 20:33                   ` Andreas Tobler
2020-05-05 16:22     ` Jeff Law

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