Csound Csound-dev Csound-tekno Search About

[Csnd-dev] ignore_value

Date2018-02-02 01:36
FromMichael Gogins
Subject[Csnd-dev] ignore_value
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

Date2018-02-02 07:57
FromVictor Lazzarini
SubjectRe: [Csnd-dev] ignore_value
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  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.tu

Date2018-02-02 09:09
FromMichael Gogins
SubjectRe: [Csnd-dev] ignore_value
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" <Victor.Lazzarini@mu.ie> 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 <michael.gogins@GMAIL.COM> 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

Date2018-02-02 12:48
FromJohn ff
SubjectRe: [Csnd-dev] ignore_value
Does a cast to void not work?

⁣Sent from TypeApp ​

On Feb 2, 2018, 09:09, at 09:09, Michael Gogins  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" 
>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 
>> 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

Date2018-02-02 13:12
FromMichael Gogins
SubjectRe: [Csnd-dev] ignore_value
Obviously not.

Best, 
Mike

On Feb 2, 2018 07:48, "John ff" <jpff@codemist.co.uk> wrote:
Does a cast to void not work?

⁣Sent from TypeApp ​

On Feb 2, 2018, 09:09, at 09:09, Michael Gogins <michael.gogins@GMAIL.COM> 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" <Victor.Lazzarini@mu.ie>
>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 <michael.gogins@GMAIL.COM>
>> 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
>>