[Csnd-dev] ignore_value

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

[Csnd-dev] ignore_value

Michael Gogins-2
GCC version 7 is now requiring GNUC library functions declared with
attribute to handle return values to compile with an error if the
return value is not referenced.

This is not uncommon in Csound. I have added a macro at the end of
include/sysdep.h to deal with this.

For example, instead of the following which with GCC 7 and -Werror
causes an error,

    (void) fgets(buffer, 10, f);

use

    ignore_value(fgets(buffer, 10, f));

It defaults to the original case for older or non-Gnu compilers.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd-dev] ignore_value

Victor Lazzarini-2
Couldn’t  IGN() be used?

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 2 Feb 2018, at 01:36, Michael Gogins <[hidden email]> wrote:
>
> GCC version 7 is now requiring GNUC library functions declared with
> attribute to handle return values to compile with an error if the
> return value is not referenced.
>
> This is not uncommon in Csound. I have added a macro at the end of
> include/sysdep.h to deal with this.
>
> For example, instead of the following which with GCC 7 and -Werror
> causes an error,
>
>    (void) fgets(buffer, 10, f);
>
> use
>
>    ignore_value(fgets(buffer, 10, f));
>
> It defaults to the original case for older or non-Gnu compilers.
>
> Regards,
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd-dev] ignore_value

Michael Gogins-2
Not for GCC 7. This has been an issue for a number of projects. Why would the code for ignore_value come from Gnu libc itself if there were not a real issue?

On Feb 2, 2018 02:58, "Victor Lazzarini" <[hidden email]> wrote:
Couldn’t  IGN() be used?

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 2 Feb 2018, at 01:36, Michael Gogins <[hidden email]> wrote:
>
> GCC version 7 is now requiring GNUC library functions declared with
> attribute to handle return values to compile with an error if the
> return value is not referenced.
>
> This is not uncommon in Csound. I have added a macro at the end of
> include/sysdep.h to deal with this.
>
> For example, instead of the following which with GCC 7 and -Werror
> causes an error,
>
>    (void) fgets(buffer, 10, f);
>
> use
>
>    ignore_value(fgets(buffer, 10, f));
>
> It defaults to the original case for older or non-Gnu compilers.
>
> Regards,
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd-dev] ignore_value

jpff
Does a cast to void not work?

⁣Sent from TypeApp ​

On Feb 2, 2018, 09:09, at 09:09, Michael Gogins <[hidden email]> wrote:

>Not for GCC 7. This has been an issue for a number of projects. Why
>would
>the code for ignore_value come from Gnu libc itself if there were not a
>real issue?
>
>On Feb 2, 2018 02:58, "Victor Lazzarini" <[hidden email]>
>wrote:
>
>> Couldn’t  IGN() be used?
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> > On 2 Feb 2018, at 01:36, Michael Gogins <[hidden email]>
>> wrote:
>> >
>> > GCC version 7 is now requiring GNUC library functions declared with
>> > attribute to handle return values to compile with an error if the
>> > return value is not referenced.
>> >
>> > This is not uncommon in Csound. I have added a macro at the end of
>> > include/sysdep.h to deal with this.
>> >
>> > For example, instead of the following which with GCC 7 and -Werror
>> > causes an error,
>> >
>> >    (void) fgets(buffer, 10, f);
>> >
>> > use
>> >
>> >    ignore_value(fgets(buffer, 10, f));
>> >
>> > It defaults to the original case for older or non-Gnu compilers.
>> >
>> > Regards,
>> > Mike
>> >
>> > -----------------------------------------------------
>> > Michael Gogins
>> > Irreducible Productions
>> > http://michaelgogins.tumblr.com
>> > Michael dot Gogins at gmail dot com
>>
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd-dev] ignore_value

Michael Gogins-2
Obviously not.

Best, 
Mike

On Feb 2, 2018 07:48, "John ff" <[hidden email]> wrote:
Does a cast to void not work?

⁣Sent from TypeApp ​

On Feb 2, 2018, 09:09, at 09:09, Michael Gogins <[hidden email]> wrote:
>Not for GCC 7. This has been an issue for a number of projects. Why
>would
>the code for ignore_value come from Gnu libc itself if there were not a
>real issue?
>
>On Feb 2, 2018 02:58, "Victor Lazzarini" <[hidden email]>
>wrote:
>
>> Couldn’t  IGN() be used?
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>> > On 2 Feb 2018, at 01:36, Michael Gogins <[hidden email]>
>> wrote:
>> >
>> > GCC version 7 is now requiring GNUC library functions declared with
>> > attribute to handle return values to compile with an error if the
>> > return value is not referenced.
>> >
>> > This is not uncommon in Csound. I have added a macro at the end of
>> > include/sysdep.h to deal with this.
>> >
>> > For example, instead of the following which with GCC 7 and -Werror
>> > causes an error,
>> >
>> >    (void) fgets(buffer, 10, f);
>> >
>> > use
>> >
>> >    ignore_value(fgets(buffer, 10, f));
>> >
>> > It defaults to the original case for older or non-Gnu compilers.
>> >
>> > Regards,
>> > Mike
>> >
>> > -----------------------------------------------------
>> > Michael Gogins
>> > Irreducible Productions
>> > http://michaelgogins.tumblr.com
>> > Michael dot Gogins at gmail dot com
>>