warnings when installing the control pkg

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

warnings when installing the control pkg

Doug Stewart-4
I am seeing these new warnings.
any suggestion on how to fix it will be muchly  appreciated.



common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
common.cc:98:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
         warning ("%s: unknown warning, iwarn = %d", name, index);

--
DASCertificate for 206392

Reply | Threaded
Open this post in threaded view
|

Re: warnings when installing the control pkg

Carnë Draug
On Thu, 10 Jan 2019 at 15:52, Doug Stewart <[hidden email]> wrote:

>
> I am seeing these new warnings.
> any suggestion on how to fix it will be muchly  appreciated.
>
>
>
> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
> common.cc:98:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>          warning ("%s: unknown warning, iwarn = %d", name, index);

On the image package, I fixed it like this

http://hg.code.sf.net/p/octave/image/rev/30c5b43bce2f

Reply | Threaded
Open this post in threaded view
|

Re: warnings when installing the control pkg

mmuetzel
In reply to this post by Doug Stewart-4
"Doug Stewart" wrote:
> I am seeing these new warnings.
> any suggestion on how to fix it will be muchly  appreciated.



> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
> common.cc:98:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>          warning ("%s: unknown warning, iwarn = %d", name, index);


In the core this was solved with this macro:

#if defined (OCTAVE_ENABLE_64)
#  define OCTAVE_IDX_TYPE_FORMAT PRId64
#else
#  define OCTAVE_IDX_TYPE_FORMAT PRId32
#endif


And later in the code:
warning ("%s: unknown warning, iwarn = %" OCTAVE_IDX_TYPE_FORMAT, name, index);


I don't know if any of OCTAVE_ENABLE_64 or OCTAVE_IDX_TYPE_FORMAT is part of the public API though.

Markus

Reply | Threaded
Open this post in threaded view
|

Re: warnings when installing the control pkg

John W. Eaton
Administrator
On 1/10/19 11:16 AM, "Markus Mützel" wrote:

> "Doug Stewart" wrote:
>> I am seeing these new warnings.
>> any suggestion on how to fix it will be muchly  appreciated.
>>  
>>  
>>  
>> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>> common.cc:98:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>>           warning ("%s: unknown warning, iwarn = %d", name, index);
>
>
> In the core this was solved with this macro:
>
> #if defined (OCTAVE_ENABLE_64)
> #  define OCTAVE_IDX_TYPE_FORMAT PRId64
> #else
> #  define OCTAVE_IDX_TYPE_FORMAT PRId32
> #endif
>
>
> And later in the code:
> warning ("%s: unknown warning, iwarn = %" OCTAVE_IDX_TYPE_FORMAT, name, index);
>
>
> I don't know if any of OCTAVE_ENABLE_64 or OCTAVE_IDX_TYPE_FORMAT is part of the public API though.

OCTAVE_ENABLE_64 is defined in the octave-config.h header file that is
included in all public header files.

OCTAVE_IDX_TYPE_FORMAT isn't, but we could add it to the octave-config.h
header file if people think it would be useful.  Otherwise, you can
duplicate the conditional in your own code.

jwe

Reply | Threaded
Open this post in threaded view
|

Re: warnings when installing the control pkg

Doug Stewart-4


On Thu, Jan 10, 2019 at 12:29 PM John W. Eaton <[hidden email]> wrote:
On 1/10/19 11:16 AM, "Markus Mützel" wrote:
> "Doug Stewart" wrote:
>> I am seeing these new warnings.
>> any suggestion on how to fix it will be muchly  appreciated.
>>   
>>   
>>   
>> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>> common.cc:96:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>> common.cc:98:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘octave_idx_type’ {aka ‘longint’} [-Wformat=]
>>           warning ("%s: unknown warning, iwarn = %d", name, index);
>
>
> In the core this was solved with this macro:
>
> #if defined (OCTAVE_ENABLE_64)
> #  define OCTAVE_IDX_TYPE_FORMAT PRId64
> #else
> #  define OCTAVE_IDX_TYPE_FORMAT PRId32
> #endif
>
>
> And later in the code:
> warning ("%s: unknown warning, iwarn = %" OCTAVE_IDX_TYPE_FORMAT, name, index);
>
>
> I don't know if any of OCTAVE_ENABLE_64 or OCTAVE_IDX_TYPE_FORMAT is part of the public API though.

OCTAVE_ENABLE_64 is defined in the octave-config.h header file that is
included in all public header files.

OCTAVE_IDX_TYPE_FORMAT isn't, but we could add it to the octave-config.h
header file if people think it would be useful.  Otherwise, you can
duplicate the conditional in your own code.

jwe

was it wrong for me to replace  
OCTAVE_IDX_TYPE  with int


--
DASCertificate for 206392

Reply | Threaded
Open this post in threaded view
|

Aw: Re: warnings when installing the control pkg

mmuetzel
Am Donnerstag, 10. Januar 2019 um 18:49 Uhr "Doug Stewart" wrote:
> was it wrong for me to replace  OCTAVE_IDX_TYPE  with int
 
Using int instead of octave_idx_type might limit the range of that variable. I can't judge whether that can be a problem in your code.

Markus

Reply | Threaded
Open this post in threaded view
|

Re: Re: warnings when installing the control pkg

Doug Stewart-4


On Thu, Jan 10, 2019 at 12:56 PM "Markus Mützel" <[hidden email]> wrote:
Am Donnerstag, 10. Januar 2019 um 18:49 Uhr "Doug Stewart" wrote:
> was it wrong for me to replace  OCTAVE_IDX_TYPE  with int
 
Using int instead of octave_idx_type might limit the range of that variable. I can't judge whether that can be a problem in your code.

Markus

It is just an error code index   -- I don't think that there are indexes that would go past an int.

--
DASCertificate for 206392

Reply | Threaded
Open this post in threaded view
|

Re: warnings when installing the control pkg

Mike Miller-4
In reply to this post by Doug Stewart-4
On Thu, Jan 10, 2019 at 12:49:51 -0500, Doug Stewart wrote:
> was it wrong for me to replace
> OCTAVE_IDX_TYPE  with int

I fixed the same thing in the signal package with

@@ -361,7 +360,8 @@ to bring them up to size @var{n}.\n\
                      args(3).double_value ());
             //if (dim < 1 || dim > signal.dims ().length ())
             if (dim < 1)
-              error ("medfilt1: DIM must be positive, not %d", dim);
+              error ("medfilt1: DIM must be positive, not %ld",
+                     static_cast<long> (dim));
           }
         else
           error ("medfilt1: Invalid type for DIM: %s",

I think it's better to keep it an octave_idx_type. Maybe in a future
version of Octave we can rely on octave_idx_type being the same as
either size_t or ssize_t.

--
mike

signature.asc (849 bytes) Download Attachment