diff mbox

Define 'EXTERN' for simulation internals

Message ID CADip9ga+K8Z2sHqCzrGdnU7tYzLrm7SC_Q7US5vg6AJeb5Xo0Q@mail.gmail.com
State New
Headers show

Commit Message

Павел Крюков Jan. 12, 2019, 1:16 p.m. UTC
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

Comments

Simon Marchi Jan. 14, 2019, 9:35 p.m. UTC | #1
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
Павел Крюков Jan. 15, 2019, 7:28 a.m. UTC | #2
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
>
Simon Marchi Jan. 15, 2019, 10:28 p.m. UTC | #3
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
Павел Крюков Jan. 15, 2019, 10:32 p.m. UTC | #4
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
>
diff mbox

Patch

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 */