public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Define 'EXTERN' for simulation internals
@ 2019-01-12 13:16 Павел Крюков
  2019-01-14 21:36 ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Павел Крюков @ 2019-01-12 13:16 UTC (permalink / raw)
  To: gdb-patches

Define 'EXTERN' for simulation internals

If inlining is not supported by compiler, sim-arange.h uses
EXTERN keyword which is not defined yet. Therefore, we define it
as 'extern' qualifier.

sim/common/Changelog:
2019-01-12  Pavel I. Kryukov  <kryukov@frtk.ru>

        * sim-inline.h: define EXTERN macro

diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
index e9fb5c7..b215252 100644
--- a/sim/common/sim-inline.h
+++ b/sim/common/sim-inline.h
@@ -324,6 +324,9 @@
 #define EXTERN_INLINE extern INLINE2
 #endif

+#ifndef EXTERN
+#define EXTERN extern
+#endif

 /* Your compiler's no-return reserved word */

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

* Re: [PATCH] Define 'EXTERN' for simulation internals
  2019-01-12 13:16 [PATCH] Define 'EXTERN' for simulation internals Павел Крюков
@ 2019-01-14 21:36 ` Simon Marchi
  2019-01-15  7:28   ` Павел Крюков
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2019-01-14 21:36 UTC (permalink / raw)
  To: Павел
	Крюков
  Cc: gdb-patches

On 2019-01-12 08:16, Павел Крюков wrote:
> Define 'EXTERN' for simulation internals
> 
> If inlining is not supported by compiler, sim-arange.h uses
> EXTERN keyword which is not defined yet. Therefore, we define it
> as 'extern' qualifier.
> 
> sim/common/Changelog:
> 2019-01-12  Pavel I. Kryukov  <kryukov@frtk.ru>
> 
>         * sim-inline.h: define EXTERN macro
> 
> diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
> index e9fb5c7..b215252 100644
> --- a/sim/common/sim-inline.h
> +++ b/sim/common/sim-inline.h
> @@ -324,6 +324,9 @@
>  #define EXTERN_INLINE extern INLINE2
>  #endif
> 
> +#ifndef EXTERN
> +#define EXTERN extern
> +#endif
> 
>  /* Your compiler's no-return reserved word */

Hi Pavel,

This LGTM.  Would you mind precising the compiler (name and version) and 
copy paste the error message?  I'll include those in the commit message, 
for future reference.

Thanks,

Simon

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

* Re: [PATCH] Define 'EXTERN' for simulation internals
  2019-01-14 21:36 ` Simon Marchi
@ 2019-01-15  7:28   ` Павел Крюков
  2019-01-15 22:28     ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Павел Крюков @ 2019-01-15  7:28 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

Assuming this patch is applied:
https://sourceware.org/ml/gdb-patches/2019-01/msg00241.html,
error message would appear for any GCC-compatible C++ compiler:

In file included from
/mipt-mips/simulator/../../sim/common/sim-basics.h:147:0,
                 from /mipt-mips/simulator/export/gdb/sim-main.h:13,
                 from /mipt-mips/simulator/export/gdb/gdb_interface.cpp:7:
/mipt-mips/simulator/../../sim/common/sim-arange.h:71:27: error: ‘EXTERN’
does not name a type; did you mean ‘EUSERS’?
 #define SIM_ARANGE_INLINE EXTERN
                           ^
/mipt-mips/simulator/../../sim/common/sim-arange.h:76:1: note: in expansion
of macro ‘SIM_ARANGE_INLINE’
 SIM_ARANGE_INLINE int
 ^~~~~~~~~~~~~~~~~
$ g++ --version
g++ (Ubuntu 7.1.0-10ubuntu1~16.04.york0) 7.1.0

Thanks,
--
Pavel

вт, 15 янв. 2019 г. в 00:36, Simon Marchi <simon.marchi@polymtl.ca>:

> On 2019-01-12 08:16, Павел Крюков wrote:
> > Define 'EXTERN' for simulation internals
> >
> > If inlining is not supported by compiler, sim-arange.h uses
> > EXTERN keyword which is not defined yet. Therefore, we define it
> > as 'extern' qualifier.
> >
> > sim/common/Changelog:
> > 2019-01-12  Pavel I. Kryukov  <kryukov@frtk.ru>
> >
> >         * sim-inline.h: define EXTERN macro
> >
> > diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
> > index e9fb5c7..b215252 100644
> > --- a/sim/common/sim-inline.h
> > +++ b/sim/common/sim-inline.h
> > @@ -324,6 +324,9 @@
> >  #define EXTERN_INLINE extern INLINE2
> >  #endif
> >
> > +#ifndef EXTERN
> > +#define EXTERN extern
> > +#endif
> >
> >  /* Your compiler's no-return reserved word */
>
> Hi Pavel,
>
> This LGTM.  Would you mind precising the compiler (name and version) and
> copy paste the error message?  I'll include those in the commit message,
> for future reference.
>
> Thanks,
>
> Simon
>

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

* Re: [PATCH] Define 'EXTERN' for simulation internals
  2019-01-15  7:28   ` Павел Крюков
@ 2019-01-15 22:28     ` Simon Marchi
  2019-01-15 22:32       ` Павел Крюков
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2019-01-15 22:28 UTC (permalink / raw)
  To: Павел
	Крюков
  Cc: gdb-patches

On 2019-01-15 02:28, Павел Крюков wrote:
> Assuming this patch is applied:
> https://sourceware.org/ml/gdb-patches/2019-01/msg00241.html,
> error message would appear for any GCC-compatible C++ compiler:
> 
> In file included from
> /mipt-mips/simulator/../../sim/common/sim-basics.h:147:0,
>                  from /mipt-mips/simulator/export/gdb/sim-main.h:13,
>                  from 
> /mipt-mips/simulator/export/gdb/gdb_interface.cpp:7:
> /mipt-mips/simulator/../../sim/common/sim-arange.h:71:27: error: 
> ‘EXTERN’
> does not name a type; did you mean ‘EUSERS’?
>  #define SIM_ARANGE_INLINE EXTERN
>                            ^
> /mipt-mips/simulator/../../sim/common/sim-arange.h:76:1: note: in 
> expansion
> of macro ‘SIM_ARANGE_INLINE’
>  SIM_ARANGE_INLINE int
>  ^~~~~~~~~~~~~~~~~
> $ g++ --version
> g++ (Ubuntu 7.1.0-10ubuntu1~16.04.york0) 7.1.0
> 

Ok thanks.

Actually, would it be fine with you if we just changed

#define SIM_ARANGE_INLINE EXTERN

to

#define SIM_ARANGE_INLINE extern

? There are already uses of "extern" in that file, I don't see why it 
wouldn't be fine to use it there too.

Simon

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

* Re: [PATCH] Define 'EXTERN' for simulation internals
  2019-01-15 22:28     ` Simon Marchi
@ 2019-01-15 22:32       ` Павел Крюков
  2019-01-15 22:47         ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Павел Крюков @ 2019-01-15 22:32 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

Yes, it would be fine as well.

Thanks,
--
Pavel

ср, 16 янв. 2019 г. в 01:28, Simon Marchi <simon.marchi@polymtl.ca>:

> On 2019-01-15 02:28, Павел Крюков wrote:
> > Assuming this patch is applied:
> > https://sourceware.org/ml/gdb-patches/2019-01/msg00241.html,
> > error message would appear for any GCC-compatible C++ compiler:
> >
> > In file included from
> > /mipt-mips/simulator/../../sim/common/sim-basics.h:147:0,
> >                  from /mipt-mips/simulator/export/gdb/sim-main.h:13,
> >                  from
> > /mipt-mips/simulator/export/gdb/gdb_interface.cpp:7:
> > /mipt-mips/simulator/../../sim/common/sim-arange.h:71:27: error:
> > ‘EXTERN’
> > does not name a type; did you mean ‘EUSERS’?
> >  #define SIM_ARANGE_INLINE EXTERN
> >                            ^
> > /mipt-mips/simulator/../../sim/common/sim-arange.h:76:1: note: in
> > expansion
> > of macro ‘SIM_ARANGE_INLINE’
> >  SIM_ARANGE_INLINE int
> >  ^~~~~~~~~~~~~~~~~
> > $ g++ --version
> > g++ (Ubuntu 7.1.0-10ubuntu1~16.04.york0) 7.1.0
> >
>
> Ok thanks.
>
> Actually, would it be fine with you if we just changed
>
> #define SIM_ARANGE_INLINE EXTERN
>
> to
>
> #define SIM_ARANGE_INLINE extern
>
> ? There are already uses of "extern" in that file, I don't see why it
> wouldn't be fine to use it there too.
>
> Simon
>

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

* Re: [PATCH] Define 'EXTERN' for simulation internals
  2019-01-15 22:32       ` Павел Крюков
@ 2019-01-15 22:47         ` Simon Marchi
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2019-01-15 22:47 UTC (permalink / raw)
  To: Павел
	Крюков,
	Simon Marchi
  Cc: gdb-patches

On 2019-01-15 5:32 p.m., Павел Крюков wrote:
> Yes, it would be fine as well.

Thanks, I pushed this.

From dc7e818497f0af0a3ee569f6eee0ad74e19b4bc2 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Tue, 15 Jan 2019 17:45:39 -0500
Subject: [PATCH] sim: Fix definition of SIM_ARANGE_INLINE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If HAVE_INLINE is false, SIM_ARANGE_INLINE is currently defined as

    #define SIM_ARANGE_INLINE EXTERN

However, EXTERN is not defined anywhere, leading to errors such as:

    In file included from
    /mipt-mips/simulator/../../sim/common/sim-basics.h:147:0,
                     from /mipt-mips/simulator/export/gdb/sim-main.h:13,
                     from /mipt-mips/simulator/export/gdb/gdb_interface.cpp:7:
    /mipt-mips/simulator/../../sim/common/sim-arange.h:71:27: error: ‘EXTERN’
    does not name a type; did you mean ‘EUSERS’?
     #define SIM_ARANGE_INLINE EXTERN
                               ^
    /mipt-mips/simulator/../../sim/common/sim-arange.h:76:1: note: in expansion
    of macro ‘SIM_ARANGE_INLINE’
     SIM_ARANGE_INLINE int
     ^~~~~~~~~~~~~~~~~

I (Simon) have reproduced the problem by simply removing the HAVE_INLINE
definition.  This was originally reported by Pavel I. Kryukov
<kryukov@frtk.ru>.

sim/common/ChangeLog:

	* sim-arange.h (SIM_ARANGE_INLINE): Change EXTERN to extern.
---
 sim/common/ChangeLog    | 4 ++++
 sim/common/sim-arange.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 01ee122b019..a95735a4793 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,7 @@
+2019-01-15  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* sim-arange.h (SIM_ARANGE_INLINE): Change EXTERN to extern.
+
 2018-12-18  Andrew Burgess  <andrew.burgess@embecosm.com>

 	* sim-syscall.c (sim_syscall_multi): Don't update sc->errcode at
diff --git a/sim/common/sim-arange.h b/sim/common/sim-arange.h
index ce84c1138ad..f2ac595390f 100644
--- a/sim/common/sim-arange.h
+++ b/sim/common/sim-arange.h
@@ -68,7 +68,7 @@ extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
 #define SIM_ARANGE_INLINE EXTERN_INLINE
 #endif
 #else
-#define SIM_ARANGE_INLINE EXTERN
+#define SIM_ARANGE_INLINE extern
 #endif

 /* Return non-zero if ADDR is in range AR, traversing the entire tree.
-- 
2.20.1



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

end of thread, other threads:[~2019-01-15 22:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-12 13:16 [PATCH] Define 'EXTERN' for simulation internals Павел Крюков
2019-01-14 21:36 ` Simon Marchi
2019-01-15  7:28   ` Павел Крюков
2019-01-15 22:28     ` Simon Marchi
2019-01-15 22:32       ` Павел Крюков
2019-01-15 22:47         ` Simon Marchi

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