Re: [gem5-users] Constant Defined but not Used

2017-07-14 Thread Alec Roelke
Yeah, that's what I figured.  But I was also under the impression that
const was supposed to ignore that, and I believe static const and const are
supposed to be the same thing.  I did try using static const for one of the
constants, but it still gave me the defined but not used error.  The only
thing I tried that worked was to add __attribute__ ((unused)) (and
M5_VAR_USED that Jason pointed out, but that's the same attribute).

On Fri, Jul 14, 2017 at 4:35 PM, Gabe Black  wrote:

> The compiler will complain if the constant isn't used somewhere for *any*
> .cc file, not if it isn't used at all, since it only compiles one .cc file
> at a time and wouldn't know that somebody else was using it somewhere. I
> think you can usually address those sorts of problems by making constants
> const and static.
>
> Gabe
>
> On Fri, Jul 14, 2017 at 7:39 AM, Jason Lowe-Power 
> wrote:
>
>> Hi Alec,
>>
>> I'm not sure if this really answers your question, but there are a number
>> of places in the code where for different compiler options some variables
>> are unused. This often happens when doing debug checks (e.g., asserts)
>> which are removed when compiling fast mode. To ignore these warnings from
>> the compiler, there is the macro "M5_VAR_USED" which can be used after
>> declaring the variable to make sure that it appears used to the compiler
>> (like __attribute__((unused))).
>>
>> Jason
>>
>> On Thu, Jul 13, 2017 at 3:34 PM Alec Roelke  wrote:
>>
>>> Hi Everyone,
>>>
>>> Lately when I've been trying to build gem5.opt for RISC-V, I've been
>>> getting an error that three of the scalar constants defined in registers.hh
>>> are 'defined but not used' (one of which definitely is used in faults.cc).
>>> I've been under the impression that g++ is supposed to ignore this warning
>>> for values defined as const, but I've had to mark them with __attribute__
>>> ((unused)) to get it to compile.
>>>
>>> The only solutions I can find (define them as extern and initialize them
>>> in a .cc file) when I search for it only apply to arrays, but all the const
>>> arrays in registers.hh work fine.  This error only appears for some of the
>>> scalar constants.
>>>
>>> Is anyone else having this issue?
>>>
>>> Thanks,
>>> Alec Roelke
>>> ___
>>> gem5-users mailing list
>>> gem5-users@gem5.org
>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>>
>> ___
>> gem5-users mailing list
>> gem5-users@gem5.org
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>
>
> ___
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Re: [gem5-users] Constant Defined but not Used

2017-07-14 Thread Jason Lowe-Power
Hi Alec,

I'm not sure if this really answers your question, but there are a number
of places in the code where for different compiler options some variables
are unused. This often happens when doing debug checks (e.g., asserts)
which are removed when compiling fast mode. To ignore these warnings from
the compiler, there is the macro "M5_VAR_USED" which can be used after
declaring the variable to make sure that it appears used to the compiler
(like __attribute__((unused))).

Jason

On Thu, Jul 13, 2017 at 3:34 PM Alec Roelke  wrote:

> Hi Everyone,
>
> Lately when I've been trying to build gem5.opt for RISC-V, I've been
> getting an error that three of the scalar constants defined in registers.hh
> are 'defined but not used' (one of which definitely is used in faults.cc).
> I've been under the impression that g++ is supposed to ignore this warning
> for values defined as const, but I've had to mark them with __attribute__
> ((unused)) to get it to compile.
>
> The only solutions I can find (define them as extern and initialize them
> in a .cc file) when I search for it only apply to arrays, but all the const
> arrays in registers.hh work fine.  This error only appears for some of the
> scalar constants.
>
> Is anyone else having this issue?
>
> Thanks,
> Alec Roelke
> ___
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

[gem5-users] Constant Defined but not Used

2017-07-13 Thread Alec Roelke
Hi Everyone,

Lately when I've been trying to build gem5.opt for RISC-V, I've been
getting an error that three of the scalar constants defined in registers.hh
are 'defined but not used' (one of which definitely is used in faults.cc).
I've been under the impression that g++ is supposed to ignore this warning
for values defined as const, but I've had to mark them with __attribute__
((unused)) to get it to compile.

The only solutions I can find (define them as extern and initialize them in
a .cc file) when I search for it only apply to arrays, but all the const
arrays in registers.hh work fine.  This error only appears for some of the
scalar constants.

Is anyone else having this issue?

Thanks,
Alec Roelke
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users