public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] gimple-fold.h: Add missing gimple-iterator.h
@ 2023-01-12  1:44 Palmer Dabbelt
  2023-01-12  7:55 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2023-01-12  1:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: Palmer Dabbelt

As of 6f5b06032eb ("Finish gimple_build API enhancement") gimple-fold.h
uses some of the declarations from gimple-iterator.h, which causes
issues when building Linux's stackprotector plugin.

gcc/ChangeLog:

	* gimple-fold.h: Add gimple-iterator.h include.

---

I'm not sure if this should instead be fixed in Linux by reordering the
includes along the lines of

diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
index 9a1895747b15..2c3a3079128a 100644
--- a/scripts/gcc-plugins/gcc-common.h
+++ b/scripts/gcc-plugins/gcc-common.h
@@ -72,6 +72,7 @@
 #include "stor-layout.h"
 #include "internal-fn.h"
 #include "gimple-expr.h"
+#include "gimple-iterator.h"
 #include "gimple-fold.h"
 #include "context.h"
 #include "tree-ssa-alias.h"
@@ -88,7 +89,6 @@
 #include "gimple.h"
 #include "tree-phinodes.h"
 #include "tree-cfg.h"
-#include "gimple-iterator.h"
 #include "gimple-ssa.h"
 #include "ssa-iterators.h"

but I figured it was slightly easier for users to keep these compatible.
It looks like many GCC-internal uses of gimple-fold.h already have the
gimple-iterator.h include right before, though, so not sure if that's
how things are meant to be.
---
 gcc/gimple-fold.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h
index 2fd58db9a2e..66bee2b75df 100644
--- a/gcc/gimple-fold.h
+++ b/gcc/gimple-fold.h
@@ -22,6 +22,8 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_GIMPLE_FOLD_H
 #define GCC_GIMPLE_FOLD_H
 
+#include "gimple-iterator.h"
+
 extern tree create_tmp_reg_or_ssa_name (tree, gimple *stmt = NULL);
 extern tree canonicalize_constructor_val (tree, tree);
 extern tree get_symbol_constant_value (tree);
-- 
2.39.0


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

* Re: [PATCH] gimple-fold.h: Add missing gimple-iterator.h
  2023-01-12  1:44 [PATCH] gimple-fold.h: Add missing gimple-iterator.h Palmer Dabbelt
@ 2023-01-12  7:55 ` Richard Biener
  2023-01-13 17:31   ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2023-01-12  7:55 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: gcc-patches

On Thu, Jan 12, 2023 at 2:46 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> As of 6f5b06032eb ("Finish gimple_build API enhancement") gimple-fold.h
> uses some of the declarations from gimple-iterator.h, which causes
> issues when building Linux's stackprotector plugin.
>
> gcc/ChangeLog:
>
>         * gimple-fold.h: Add gimple-iterator.h include.
>
> ---
>
> I'm not sure if this should instead be fixed in Linux by reordering the
> includes along the lines of
>
> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
> index 9a1895747b15..2c3a3079128a 100644
> --- a/scripts/gcc-plugins/gcc-common.h
> +++ b/scripts/gcc-plugins/gcc-common.h
> @@ -72,6 +72,7 @@
>  #include "stor-layout.h"
>  #include "internal-fn.h"
>  #include "gimple-expr.h"
> +#include "gimple-iterator.h"
>  #include "gimple-fold.h"
>  #include "context.h"
>  #include "tree-ssa-alias.h"
> @@ -88,7 +89,6 @@
>  #include "gimple.h"
>  #include "tree-phinodes.h"
>  #include "tree-cfg.h"
> -#include "gimple-iterator.h"
>  #include "gimple-ssa.h"
>  #include "ssa-iterators.h"

The above change is OK.

> but I figured it was slightly easier for users to keep these compatible.
> It looks like many GCC-internal uses of gimple-fold.h already have the
> gimple-iterator.h include right before, though, so not sure if that's
> how things are meant to be.
> ---
>  gcc/gimple-fold.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h
> index 2fd58db9a2e..66bee2b75df 100644
> --- a/gcc/gimple-fold.h
> +++ b/gcc/gimple-fold.h
> @@ -22,6 +22,8 @@ along with GCC; see the file COPYING3.  If not see
>  #ifndef GCC_GIMPLE_FOLD_H
>  #define GCC_GIMPLE_FOLD_H
>
> +#include "gimple-iterator.h"
> +

But this is not - we try to avoid #include directives in headers, we want the
include dependences to be "flat"

>  extern tree create_tmp_reg_or_ssa_name (tree, gimple *stmt = NULL);
>  extern tree canonicalize_constructor_val (tree, tree);
>  extern tree get_symbol_constant_value (tree);
> --
> 2.39.0
>

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

* Re: [PATCH] gimple-fold.h: Add missing gimple-iterator.h
  2023-01-12  7:55 ` Richard Biener
@ 2023-01-13 17:31   ` Palmer Dabbelt
  0 siblings, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2023-01-13 17:31 UTC (permalink / raw)
  To: richard.guenther; +Cc: gcc-patches

On Wed, 11 Jan 2023 23:55:15 PST (-0800), richard.guenther@gmail.com wrote:
> On Thu, Jan 12, 2023 at 2:46 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>>
>> As of 6f5b06032eb ("Finish gimple_build API enhancement") gimple-fold.h
>> uses some of the declarations from gimple-iterator.h, which causes
>> issues when building Linux's stackprotector plugin.
>>
>> gcc/ChangeLog:
>>
>>         * gimple-fold.h: Add gimple-iterator.h include.
>>
>> ---
>>
>> I'm not sure if this should instead be fixed in Linux by reordering the
>> includes along the lines of
>>
>> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
>> index 9a1895747b15..2c3a3079128a 100644
>> --- a/scripts/gcc-plugins/gcc-common.h
>> +++ b/scripts/gcc-plugins/gcc-common.h
>> @@ -72,6 +72,7 @@
>>  #include "stor-layout.h"
>>  #include "internal-fn.h"
>>  #include "gimple-expr.h"
>> +#include "gimple-iterator.h"
>>  #include "gimple-fold.h"
>>  #include "context.h"
>>  #include "tree-ssa-alias.h"
>> @@ -88,7 +89,6 @@
>>  #include "gimple.h"
>>  #include "tree-phinodes.h"
>>  #include "tree-cfg.h"
>> -#include "gimple-iterator.h"
>>  #include "gimple-ssa.h"
>>  #include "ssa-iterators.h"
>
> The above change is OK.
>
>> but I figured it was slightly easier for users to keep these compatible.
>> It looks like many GCC-internal uses of gimple-fold.h already have the
>> gimple-iterator.h include right before, though, so not sure if that's
>> how things are meant to be.
>> ---
>>  gcc/gimple-fold.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h
>> index 2fd58db9a2e..66bee2b75df 100644
>> --- a/gcc/gimple-fold.h
>> +++ b/gcc/gimple-fold.h
>> @@ -22,6 +22,8 @@ along with GCC; see the file COPYING3.  If not see
>>  #ifndef GCC_GIMPLE_FOLD_H
>>  #define GCC_GIMPLE_FOLD_H
>>
>> +#include "gimple-iterator.h"
>> +
>
> But this is not - we try to avoid #include directives in headers, we want the
> include dependences to be "flat"

Makes sense.  I've sent the diff above to Linux: 
https://lore.kernel.org/r/20230113173033.4380-1-palmer@rivosinc.com/

>
>>  extern tree create_tmp_reg_or_ssa_name (tree, gimple *stmt = NULL);
>>  extern tree canonicalize_constructor_val (tree, tree);
>>  extern tree get_symbol_constant_value (tree);
>> --
>> 2.39.0
>>

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

end of thread, other threads:[~2023-01-13 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12  1:44 [PATCH] gimple-fold.h: Add missing gimple-iterator.h Palmer Dabbelt
2023-01-12  7:55 ` Richard Biener
2023-01-13 17:31   ` Palmer Dabbelt

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