[Csnd-dev] Misleading indentation

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

[Csnd-dev] Misleading indentation

Michael Gogins-2
I recently upgraded to gcc 7 and am now getting many compiler errors
in Csound such as this:

/home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
error: this ‘else’ clause does not guard...
[-Werror=misleading-indentation]

The cause of these errors is generally coding something like

      if(!csound->oparms->realtime) // no API lock in realtime mode
       csoundUnlockMutex(csound->API_lock);

while the C compiler will now only pass

      if(!csound->oparms->realtime) {// no API lock in realtime mode
       csoundUnlockMutex(csound->API_lock);
      }


This usage used to be acceptable to the compiler, though it has for a
long time been forbidden by most C and C++ coding standards. The usage
is now explicitly a compiler error.

Should we turn this error off, or fix the code to be more up to date?

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] Misleading indentation

Victor Lazzarini-2
You could add -Wno-misleading identation to your custom.cmake while I fix
this in the sources.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>
> I recently upgraded to gcc 7 and am now getting many compiler errors
> in Csound such as this:
>
> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
> error: this ‘else’ clause does not guard...
> [-Werror=misleading-indentation]
>
> The cause of these errors is generally coding something like
>
>      if(!csound->oparms->realtime) // no API lock in realtime mode
>       csoundUnlockMutex(csound->API_lock);
>
> while the C compiler will now only pass
>
>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>       csoundUnlockMutex(csound->API_lock);
>      }
>
>
> This usage used to be acceptable to the compiler, though it has for a
> long time been forbidden by most C and C++ coding standards. The usage
> is now explicitly a compiler error.
>
> Should we turn this error off, or fix the code to be more up to date?
>
> 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] Misleading indentation

jpff
I see nothing wrong wit the source.  Apart from a missing space that is.

On Thu, 1 Feb 2018, Victor Lazzarini wrote:

> You could add -Wno-misleading identation to your custom.cmake while I fix
> this in the sources.
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>
>> I recently upgraded to gcc 7 and am now getting many compiler errors
>> in Csound such as this:
>>
>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>> error: this ‘else’ clause does not guard...
>> [-Werror=misleading-indentation]
>>
>> The cause of these errors is generally coding something like
>>
>>      if(!csound->oparms->realtime) // no API lock in realtime mode
>>       csoundUnlockMutex(csound->API_lock);
>>
>> while the C compiler will now only pass
>>
>>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>>       csoundUnlockMutex(csound->API_lock);
>>      }
>>
>>
>> This usage used to be acceptable to the compiler, though it has for a
>> long time been forbidden by most C and C++ coding standards. The usage
>> is now explicitly a compiler error.
>>
>> Should we turn this error off, or fix the code to be more up to date?
>>
>> 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] Misleading indentation

Michael Gogins-2
There is something wrong with the source. The current compiler does
not pass sources that were OK with the older compiler. The standard
for C and the standard for C++ have become more stringent. I think we
should definitely try to keep up with the compiler.

Best,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Feb 1, 2018 at 10:37 AM, jpff <[hidden email]> wrote:

> I see nothing wrong wit the source.  Apart from a missing space that is.
>
>
> On Thu, 1 Feb 2018, Victor Lazzarini wrote:
>
>> You could add -Wno-misleading identation to your custom.cmake while I fix
>> this in the sources.
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>
>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>> in Csound such as this:
>>>
>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>> error: this ‘else’ clause does not guard...
>>> [-Werror=misleading-indentation]
>>>
>>> The cause of these errors is generally coding something like
>>>
>>>      if(!csound->oparms->realtime) // no API lock in realtime mode
>>>       csoundUnlockMutex(csound->API_lock);
>>>
>>> while the C compiler will now only pass
>>>
>>>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>       csoundUnlockMutex(csound->API_lock);
>>>      }
>>>
>>>
>>> This usage used to be acceptable to the compiler, though it has for a
>>> long time been forbidden by most C and C++ coding standards. The usage
>>> is now explicitly a compiler error.
>>>
>>> Should we turn this error off, or fix the code to be more up to date?
>>>
>>> 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] Misleading indentation

Dave Seidel
Yea, they're enforcing the use of curly braces to enclose a single-line block. I think this is good practice, and I follow it myself (albeit in Java), but it seems a bit drastic to fail a compile on that basis.

On Thu, Feb 1, 2018 at 11:08 AM, Michael Gogins <[hidden email]> wrote:
There is something wrong with the source. The current compiler does
not pass sources that were OK with the older compiler. The standard
for C and the standard for C++ have become more stringent. I think we
should definitely try to keep up with the compiler.

Best,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Feb 1, 2018 at 10:37 AM, jpff <[hidden email]> wrote:
> I see nothing wrong wit the source.  Apart from a missing space that is.
>
>
> On Thu, 1 Feb 2018, Victor Lazzarini wrote:
>
>> You could add -Wno-misleading identation to your custom.cmake while I fix
>> this in the sources.
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>
>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>> in Csound such as this:
>>>
>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>> error: this ‘else’ clause does not guard...
>>> [-Werror=misleading-indentation]
>>>
>>> The cause of these errors is generally coding something like
>>>
>>>      if(!csound->oparms->realtime) // no API lock in realtime mode
>>>       csoundUnlockMutex(csound->API_lock);
>>>
>>> while the C compiler will now only pass
>>>
>>>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>       csoundUnlockMutex(csound->API_lock);
>>>      }
>>>
>>>
>>> This usage used to be acceptable to the compiler, though it has for a
>>> long time been forbidden by most C and C++ coding standards. The usage
>>> is now explicitly a compiler error.
>>>
>>> Should we turn this error off, or fix the code to be more up to date?
>>>
>>> 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] Misleading indentation

Victor Lazzarini-2
In reply to this post by Michael Gogins-2
That’s what I proposed, to fix this issue in the sources.

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

> On 1 Feb 2018, at 16:09, Michael Gogins <[hidden email]> wrote:
>
> There is something wrong with the source. The current compiler does
> not pass sources that were OK with the older compiler. The standard
> for C and the standard for C++ have become more stringent. I think we
> should definitely try to keep up with the compiler.
>
> Best,
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
>
>
>> On Thu, Feb 1, 2018 at 10:37 AM, jpff <[hidden email]> wrote:
>> I see nothing wrong wit the source.  Apart from a missing space that is.
>>
>>
>>> On Thu, 1 Feb 2018, Victor Lazzarini wrote:
>>>
>>> You could add -Wno-misleading identation to your custom.cmake while I fix
>>> this in the sources.
>>> ========================
>>> Prof. Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>>
>>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>>
>>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>>> in Csound such as this:
>>>>
>>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>>> error: this ‘else’ clause does not guard...
>>>> [-Werror=misleading-indentation]
>>>>
>>>> The cause of these errors is generally coding something like
>>>>
>>>>     if(!csound->oparms->realtime) // no API lock in realtime mode
>>>>      csoundUnlockMutex(csound->API_lock);
>>>>
>>>> while the C compiler will now only pass
>>>>
>>>>     if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>>      csoundUnlockMutex(csound->API_lock);
>>>>     }
>>>>
>>>>
>>>> This usage used to be acceptable to the compiler, though it has for a
>>>> long time been forbidden by most C and C++ coding standards. The usage
>>>> is now explicitly a compiler error.
>>>>
>>>> Should we turn this error off, or fix the code to be more up to date?
>>>>
>>>> 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] Misleading indentation

Victor Lazzarini-2
In reply to this post by Dave Seidel
It fails because we have -Werror as we want to enforce zero warnings.

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

On 1 Feb 2018, at 16:13, Dave Seidel <[hidden email]> wrote:

Yea, they're enforcing the use of curly braces to enclose a single-line block. I think this is good practice, and I follow it myself (albeit in Java), but it seems a bit drastic to fail a compile on that basis.

On Thu, Feb 1, 2018 at 11:08 AM, Michael Gogins <[hidden email]> wrote:
There is something wrong with the source. The current compiler does
not pass sources that were OK with the older compiler. The standard
for C and the standard for C++ have become more stringent. I think we
should definitely try to keep up with the compiler.

Best,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Feb 1, 2018 at 10:37 AM, jpff <[hidden email]> wrote:
> I see nothing wrong wit the source.  Apart from a missing space that is.
>
>
> On Thu, 1 Feb 2018, Victor Lazzarini wrote:
>
>> You could add -Wno-misleading identation to your custom.cmake while I fix
>> this in the sources.
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>
>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>> in Csound such as this:
>>>
>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>> error: this ‘else’ clause does not guard...
>>> [-Werror=misleading-indentation]
>>>
>>> The cause of these errors is generally coding something like
>>>
>>>      if(!csound->oparms->realtime) // no API lock in realtime mode
>>>       csoundUnlockMutex(csound->API_lock);
>>>
>>> while the C compiler will now only pass
>>>
>>>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>       csoundUnlockMutex(csound->API_lock);
>>>      }
>>>
>>>
>>> This usage used to be acceptable to the compiler, though it has for a
>>> long time been forbidden by most C and C++ coding standards. The usage
>>> is now explicitly a compiler error.
>>>
>>> Should we turn this error off, or fix the code to be more up to date?
>>>
>>> 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] Misleading indentation

Victor Lazzarini-2
In reply to this post by Michael Gogins-2
I fixed all of these (or at least the ones I saw in my gcc 6 build for arm). I will try to
upgrade my ubuntu gcc because that build  is more complete and might find other cases.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>
> I recently upgraded to gcc 7 and am now getting many compiler errors
> in Csound such as this:
>
> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
> error: this ‘else’ clause does not guard...
> [-Werror=misleading-indentation]
>
> The cause of these errors is generally coding something like
>
>      if(!csound->oparms->realtime) // no API lock in realtime mode
>       csoundUnlockMutex(csound->API_lock);
>
> while the C compiler will now only pass
>
>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>       csoundUnlockMutex(csound->API_lock);
>      }
>
>
> This usage used to be acceptable to the compiler, though it has for a
> long time been forbidden by most C and C++ coding standards. The usage
> is now explicitly a compiler error.
>
> Should we turn this error off, or fix the code to be more up to date?
>
> 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] Misleading indentation

Michael Gogins-2
Thanks for this necessary work. Let me know if you want help, and if so how.

Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Feb 1, 2018 at 1:35 PM, Victor Lazzarini <[hidden email]> wrote:

> I fixed all of these (or at least the ones I saw in my gcc 6 build for arm). I will try to
> upgrade my ubuntu gcc because that build  is more complete and might find other cases.
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>
>> I recently upgraded to gcc 7 and am now getting many compiler errors
>> in Csound such as this:
>>
>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>> error: this ‘else’ clause does not guard...
>> [-Werror=misleading-indentation]
>>
>> The cause of these errors is generally coding something like
>>
>>      if(!csound->oparms->realtime) // no API lock in realtime mode
>>       csoundUnlockMutex(csound->API_lock);
>>
>> while the C compiler will now only pass
>>
>>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>>       csoundUnlockMutex(csound->API_lock);
>>      }
>>
>>
>> This usage used to be acceptable to the compiler, though it has for a
>> long time been forbidden by most C and C++ coding standards. The usage
>> is now explicitly a compiler error.
>>
>> Should we turn this error off, or fix the code to be more up to date?
>>
>> 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] Misleading indentation

Victor Lazzarini-2
I setup a Debian build with gcc 6 and all dependencies. It seems to pass everything now.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 1 Feb 2018, at 20:08, Michael Gogins <[hidden email]> wrote:
>
> Thanks for this necessary work. Let me know if you want help, and if so how.
>
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
>
>
> On Thu, Feb 1, 2018 at 1:35 PM, Victor Lazzarini <[hidden email]> wrote:
>> I fixed all of these (or at least the ones I saw in my gcc 6 build for arm). I will try to
>> upgrade my ubuntu gcc because that build  is more complete and might find other cases.
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>
>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>> in Csound such as this:
>>>
>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>> error: this ‘else’ clause does not guard...
>>> [-Werror=misleading-indentation]
>>>
>>> The cause of these errors is generally coding something like
>>>
>>>     if(!csound->oparms->realtime) // no API lock in realtime mode
>>>      csoundUnlockMutex(csound->API_lock);
>>>
>>> while the C compiler will now only pass
>>>
>>>     if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>      csoundUnlockMutex(csound->API_lock);
>>>     }
>>>
>>>
>>> This usage used to be acceptable to the compiler, though it has for a
>>> long time been forbidden by most C and C++ coding standards. The usage
>>> is now explicitly a compiler error.
>>>
>>> Should we turn this error off, or fix the code to be more up to date?
>>>
>>> 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] Misleading indentation

Michael Gogins-2
I am running gcc 7 as I have moved to Ubuntu 17.10. I will go ahead,
then, and make such additional corrections as are required to compile
with -Werror.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Feb 1, 2018 at 3:33 PM, Victor Lazzarini <[hidden email]> wrote:

> I setup a Debian build with gcc 6 and all dependencies. It seems to pass everything now.
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 1 Feb 2018, at 20:08, Michael Gogins <[hidden email]> wrote:
>>
>> Thanks for this necessary work. Let me know if you want help, and if so how.
>>
>> Mike
>>
>> -----------------------------------------------------
>> Michael Gogins
>> Irreducible Productions
>> http://michaelgogins.tumblr.com
>> Michael dot Gogins at gmail dot com
>>
>>
>> On Thu, Feb 1, 2018 at 1:35 PM, Victor Lazzarini <[hidden email]> wrote:
>>> I fixed all of these (or at least the ones I saw in my gcc 6 build for arm). I will try to
>>> upgrade my ubuntu gcc because that build  is more complete and might find other cases.
>>> ========================
>>> Prof. Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy,
>>> Maynooth University,
>>> Maynooth, Co Kildare, Ireland
>>> Tel: 00 353 7086936
>>> Fax: 00 353 1 7086952
>>>
>>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>>
>>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>>> in Csound such as this:
>>>>
>>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>>> error: this ‘else’ clause does not guard...
>>>> [-Werror=misleading-indentation]
>>>>
>>>> The cause of these errors is generally coding something like
>>>>
>>>>     if(!csound->oparms->realtime) // no API lock in realtime mode
>>>>      csoundUnlockMutex(csound->API_lock);
>>>>
>>>> while the C compiler will now only pass
>>>>
>>>>     if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>>      csoundUnlockMutex(csound->API_lock);
>>>>     }
>>>>
>>>>
>>>> This usage used to be acceptable to the compiler, though it has for a
>>>> long time been forbidden by most C and C++ coding standards. The usage
>>>> is now explicitly a compiler error.
>>>>
>>>> Should we turn this error off, or fix the code to be more up to date?
>>>>
>>>> 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] Misleading indentation

Michael Gogins-2
I have pushed changes to build all of Csound  using GCC 7.2.0 with
-Werror. There are pragmas in some files and additional target
compiler flags for some files. Not really that many changes. Changes
were necessary in some of my C++ opcode files and in some core Csound
files. SWIG generated files have to be compiled with -Wno-error.

I tried to ensure that these changes are safe for OS X and MSVC, but I
can't test that here.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Feb 1, 2018 at 4:01 PM, Michael Gogins <[hidden email]> wrote:

> I am running gcc 7 as I have moved to Ubuntu 17.10. I will go ahead,
> then, and make such additional corrections as are required to compile
> with -Werror.
>
> Regards,
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
>
>
> On Thu, Feb 1, 2018 at 3:33 PM, Victor Lazzarini <[hidden email]> wrote:
>> I setup a Debian build with gcc 6 and all dependencies. It seems to pass everything now.
>> ========================
>> Prof. Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy,
>> Maynooth University,
>> Maynooth, Co Kildare, Ireland
>> Tel: 00 353 7086936
>> Fax: 00 353 1 7086952
>>
>>> On 1 Feb 2018, at 20:08, Michael Gogins <[hidden email]> wrote:
>>>
>>> Thanks for this necessary work. Let me know if you want help, and if so how.
>>>
>>> Mike
>>>
>>> -----------------------------------------------------
>>> Michael Gogins
>>> Irreducible Productions
>>> http://michaelgogins.tumblr.com
>>> Michael dot Gogins at gmail dot com
>>>
>>>
>>> On Thu, Feb 1, 2018 at 1:35 PM, Victor Lazzarini <[hidden email]> wrote:
>>>> I fixed all of these (or at least the ones I saw in my gcc 6 build for arm). I will try to
>>>> upgrade my ubuntu gcc because that build  is more complete and might find other cases.
>>>> ========================
>>>> Prof. Victor Lazzarini
>>>> Dean of Arts, Celtic Studies, and Philosophy,
>>>> Maynooth University,
>>>> Maynooth, Co Kildare, Ireland
>>>> Tel: 00 353 7086936
>>>> Fax: 00 353 1 7086952
>>>>
>>>>> On 1 Feb 2018, at 14:57, Michael Gogins <[hidden email]> wrote:
>>>>>
>>>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>>>> in Csound such as this:
>>>>>
>>>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>>>> error: this ‘else’ clause does not guard...
>>>>> [-Werror=misleading-indentation]
>>>>>
>>>>> The cause of these errors is generally coding something like
>>>>>
>>>>>     if(!csound->oparms->realtime) // no API lock in realtime mode
>>>>>      csoundUnlockMutex(csound->API_lock);
>>>>>
>>>>> while the C compiler will now only pass
>>>>>
>>>>>     if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>>>      csoundUnlockMutex(csound->API_lock);
>>>>>     }
>>>>>
>>>>>
>>>>> This usage used to be acceptable to the compiler, though it has for a
>>>>> long time been forbidden by most C and C++ coding standards. The usage
>>>>> is now explicitly a compiler error.
>>>>>
>>>>> Should we turn this error off, or fix the code to be more up to date?
>>>>>
>>>>> 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] Misleading indentation

jpff
In reply to this post by Michael Gogins-2
There are many examples in csound that the form "if () statement" after
today's changes.nWhat exactly is supposed to be bad?



On Thu, 1 Feb 2018, Michael Gogins wrote:

> I recently upgraded to gcc 7 and am now getting many compiler errors
> in Csound such as this:
>
> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
> error: this ‘else’ clause does not guard...
> [-Werror=misleading-indentation]
>
> The cause of these errors is generally coding something like
>
>      if(!csound->oparms->realtime) // no API lock in realtime mode
>       csoundUnlockMutex(csound->API_lock);
>
> while the C compiler will now only pass
>
>      if(!csound->oparms->realtime) {// no API lock in realtime mode
>       csoundUnlockMutex(csound->API_lock);
>      }
>
>
> This usage used to be acceptable to the compiler, though it has for a
> long time been forbidden by most C and C++ coding standards. The usage
> is now explicitly a compiler error.
>
> Should we turn this error off, or fix the code to be more up to date?
>
> 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] Misleading indentation

Victor Lazzarini-2
I think when the text formatting looks
unclear to the compiler, it complains
and asks for it to be clarified/checked
up. That’s my understanding from
the instances I fixed.

A typical example was

if(  ) statement; statement;

this would trigger the warning.
Changing the formatting or
adding brackets would fix it.

I guess it all helps us to make
sure we mean what we write.

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

> On 2 Feb 2018, at 20:30, jpff <[hidden email]> wrote:
>
> There are many examples in csound that the form "if () statement" after today's changes.nWhat exactly is supposed to be bad?
>
>
>
>> On Thu, 1 Feb 2018, Michael Gogins wrote:
>>
>> I recently upgraded to gcc 7 and am now getting many compiler errors
>> in Csound such as this:
>>
>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>> error: this ‘else’ clause does not guard...
>> [-Werror=misleading-indentation]
>>
>> The cause of these errors is generally coding something like
>>
>>     if(!csound->oparms->realtime) // no API lock in realtime mode
>>      csoundUnlockMutex(csound->API_lock);
>>
>> while the C compiler will now only pass
>>
>>     if(!csound->oparms->realtime) {// no API lock in realtime mode
>>      csoundUnlockMutex(csound->API_lock);
>>     }
>>
>>
>> This usage used to be acceptable to the compiler, though it has for a
>> long time been forbidden by most C and C++ coding standards. The usage
>> is now explicitly a compiler error.
>>
>> Should we turn this error off, or fix the code to be more up to date?
>>
>> 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] Misleading indentation

Michael Gogins-2
It is bad because it does not compile with the -Werror option in GCC 7
(and maybe 6). And it is bad for GCC because it can be misleading to
read if indentation is messed up. As it sometimes is in our code.

Best,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Fri, Feb 2, 2018 at 3:36 PM, Victor Lazzarini <[hidden email]> wrote:

> I think when the text formatting looks
> unclear to the compiler, it complains
> and asks for it to be clarified/checked
> up. That’s my understanding from
> the instances I fixed.
>
> A typical example was
>
> if(  ) statement; statement;
>
> this would trigger the warning.
> Changing the formatting or
> adding brackets would fix it.
>
> I guess it all helps us to make
> sure we mean what we write.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
>> On 2 Feb 2018, at 20:30, jpff <[hidden email]> wrote:
>>
>> There are many examples in csound that the form "if () statement" after today's changes.nWhat exactly is supposed to be bad?
>>
>>
>>
>>> On Thu, 1 Feb 2018, Michael Gogins wrote:
>>>
>>> I recently upgraded to gcc 7 and am now getting many compiler errors
>>> in Csound such as this:
>>>
>>> /home/mkg/csound-extended/dependencies/csound/Engine/insert.c:172:4:
>>> error: this ‘else’ clause does not guard...
>>> [-Werror=misleading-indentation]
>>>
>>> The cause of these errors is generally coding something like
>>>
>>>     if(!csound->oparms->realtime) // no API lock in realtime mode
>>>      csoundUnlockMutex(csound->API_lock);
>>>
>>> while the C compiler will now only pass
>>>
>>>     if(!csound->oparms->realtime) {// no API lock in realtime mode
>>>      csoundUnlockMutex(csound->API_lock);
>>>     }
>>>
>>>
>>> This usage used to be acceptable to the compiler, though it has for a
>>> long time been forbidden by most C and C++ coding standards. The usage
>>> is now explicitly a compiler error.
>>>
>>> Should we turn this error off, or fix the code to be more up to date?
>>>
>>> Regards,
>>> Mike
>>> -----------------------------------------------------
>>> Michael Gogins
>>> Irreducible Productions
>>> http://michaelgogins.tumblr.com
>>> Michael dot Gogins at gmail dot com