public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix libcc1plugin and libc1plugin to avoid poisoned  identifiers
@ 2024-03-07 16:48 Dimitry Andric
  2024-03-13 11:30 ` Iain Sandoe
  0 siblings, 1 reply; 4+ messages in thread
From: Dimitry Andric @ 2024-03-07 16:48 UTC (permalink / raw)
  To: GCC Patches

Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111632

Use INCLUDE_VECTOR before including system.h, instead of directly
including <vector>, to avoid running into poisoned identifiers.

Signed-off-by: Dimitry Andric <dimitry@andric.com>
---
 libcc1/libcc1plugin.cc | 3 +--
 libcc1/libcp1plugin.cc | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
index 72d17c3b81c..e64847466f4 100644
--- a/libcc1/libcc1plugin.cc
+++ b/libcc1/libcc1plugin.cc
@@ -32,6 +32,7 @@
 #undef PACKAGE_VERSION
 
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "gcc-plugin.h"
 #include "system.h"
 #include "coretypes.h"
@@ -69,8 +70,6 @@
 #include "gcc-c-interface.h"
 #include "context.hh"
 
-#include <vector>
-
 using namespace cc1_plugin;
 
 \f
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 0eff7c68d29..da68c5d0ac1 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -33,6 +33,7 @@
 #undef PACKAGE_VERSION
 
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "gcc-plugin.h"
 #include "system.h"
 #include "coretypes.h"
@@ -71,8 +72,6 @@
 #include "rpc.hh"
 #include "context.hh"
 
-#include <vector>
-
 using namespace cc1_plugin;
 
 \f
-- 
2.43.2


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

* Re: [PATCH] Fix libcc1plugin and libc1plugin to avoid poisoned identifiers
  2024-03-07 16:48 [PATCH] Fix libcc1plugin and libc1plugin to avoid poisoned identifiers Dimitry Andric
@ 2024-03-13 11:30 ` Iain Sandoe
  2024-03-13 12:10   ` Dimitry Andric
  0 siblings, 1 reply; 4+ messages in thread
From: Iain Sandoe @ 2024-03-13 11:30 UTC (permalink / raw)
  To: Dimitry Andric; +Cc: GCC Patches

Hi Dimitry,

> On 7 Mar 2024, at 16:48, Dimitry Andric <dimitry@andric.com> wrote:
> 
> Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111632
> 
> Use INCLUDE_VECTOR before including system.h, instead of directly
> including <vector>, to avoid running into poisoned identifiers.

I would say that the patch itself is obvious, but you have not mentioned how
it was tested?

thanks
Iain

> 
> Signed-off-by: Dimitry Andric <dimitry@andric.com>
> ---
> libcc1/libcc1plugin.cc | 3 +--
> libcc1/libcp1plugin.cc | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
> index 72d17c3b81c..e64847466f4 100644
> --- a/libcc1/libcc1plugin.cc
> +++ b/libcc1/libcc1plugin.cc
> @@ -32,6 +32,7 @@
> #undef PACKAGE_VERSION
> 
> #define INCLUDE_MEMORY
> +#define INCLUDE_VECTOR
> #include "gcc-plugin.h"
> #include "system.h"
> #include "coretypes.h"
> @@ -69,8 +70,6 @@
> #include "gcc-c-interface.h"
> #include "context.hh"
> 
> -#include <vector>
> -
> using namespace cc1_plugin;
> 
> 
> diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
> index 0eff7c68d29..da68c5d0ac1 100644
> --- a/libcc1/libcp1plugin.cc
> +++ b/libcc1/libcp1plugin.cc
> @@ -33,6 +33,7 @@
> #undef PACKAGE_VERSION
> 
> #define INCLUDE_MEMORY
> +#define INCLUDE_VECTOR
> #include "gcc-plugin.h"
> #include "system.h"
> #include "coretypes.h"
> @@ -71,8 +72,6 @@
> #include "rpc.hh"
> #include "context.hh"
> 
> -#include <vector>
> -
> using namespace cc1_plugin;
> 
> 
> -- 
> 2.43.2
> 


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

* Re: [PATCH] Fix libcc1plugin and libc1plugin to avoid poisoned identifiers
  2024-03-13 11:30 ` Iain Sandoe
@ 2024-03-13 12:10   ` Dimitry Andric
  0 siblings, 0 replies; 4+ messages in thread
From: Dimitry Andric @ 2024-03-13 12:10 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches

On 13 Mar 2024, at 12:30, Iain Sandoe <iain@sandoe.co.uk> wrote:
> 
>> On 7 Mar 2024, at 16:48, Dimitry Andric <dimitry@andric.com> wrote:
>> 
>> Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111632
>> 
>> Use INCLUDE_VECTOR before including system.h, instead of directly
>> including <vector>, to avoid running into poisoned identifiers.
> 
> I would say that the patch itself is obvious, but you have not mentioned how
> it was tested?

This was tested by doing a --disable-bootstrap build, on a FreeBSD
system where llvm-project's libc++ is the default C++ library
(specifically 15.0-CURRENT, which has llvm-project 17.0.6), against both
the lang/gcc14-devel port, and against gcc master as of
gcc-14-9346-g74e8cc28eda. This also required gcc-14-9360-g9970b576b7e to
be applied, before it was committed to master.

Note that if you do a fully bootstrapped build, there aren't any compile
errors, since it will compile the plugins against a freshly built
libstdc++: it has already transitively included <vector> via other
standard headers, so the #include <vector> statement after #include
"system.h" effectively does nothing, and won't run into poisoned
identifiers.

You would only get compile errors on those poisoned identifiers with the
non-bootstrapped, single-stage build which compiles everything against
the host system's C++ headers.

-Dimitry


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

* Re: [PATCH] Fix libcc1plugin and libc1plugin to avoid poisoned identifiers
@ 2024-03-16  8:53 FX Coudert
  0 siblings, 0 replies; 4+ messages in thread
From: FX Coudert @ 2024-03-16  8:53 UTC (permalink / raw)
  To: GCC Patches; +Cc: Dimitry Andric, Iain Sandoe

Given its fixes build, is obvious, and tested appropriately: patch pushed as https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5213047b1d50af63dfabb5e5649821a6cb157e33

FX

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

end of thread, other threads:[~2024-03-16  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07 16:48 [PATCH] Fix libcc1plugin and libc1plugin to avoid poisoned identifiers Dimitry Andric
2024-03-13 11:30 ` Iain Sandoe
2024-03-13 12:10   ` Dimitry Andric
2024-03-16  8:53 FX Coudert

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