Problem with Disable Mac App Nap

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

Problem with Disable Mac App Nap

bpabbott
Administrator
Hi Andrew,

After changeset 27575:d0fe6e344c41 I’m seeing the error below (macOS 10.14.6)

libgui/src/octave-qobject.cc:197:26: warning: use of old-style cast [-Wold-style-cast]
    process_info_class = (Class) objc_getClass ("NSProcessInfo");
                         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libgui/src/octave-qobject.cc:210:39: warning: use of old-style cast [-Wold-style-cast]
    if ((process_info = objc_msgSend ((id)process_info_class, process_info_selector)) == nil)
                                      ^   ~~~~~~~~~~~~~~~~~~
libgui/src/octave-qobject.cc:213:21: error: no matching function for call to 'objc_msgSend'
    reason_string = objc_msgSend (objc_getClass ("NSString"),
                    ^~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/message.h:85:1: note: candidate function not viable: no known conversion from 'Class _Nullable' (aka 'objc_class *') to
      'id _Nullable' (aka 'objc_object *') for 1st argument
objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
^
libgui/src/octave-qobject.cc:222:5: error: use of undeclared identifier 'osx_latencycritical_activity'
    osx_latencycritical_activity = objc_msgSend (process_info,


Ben
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Disable Mac App Nap

apjanke-floss


On 10/28/19 11:16 PM, Ben Abbott wrote:

> Hi Andrew,
>
> After changeset 27575:d0fe6e344c41 I’m seeing the error below (macOS 10.14.6)
>
> libgui/src/octave-qobject.cc:197:26: warning: use of old-style cast [-Wold-style-cast]
>     process_info_class = (Class) objc_getClass ("NSProcessInfo");
>                          ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> libgui/src/octave-qobject.cc:210:39: warning: use of old-style cast [-Wold-style-cast]
>     if ((process_info = objc_msgSend ((id)process_info_class, process_info_selector)) == nil)
>                                       ^   ~~~~~~~~~~~~~~~~~~
> libgui/src/octave-qobject.cc:213:21: error: no matching function for call to 'objc_msgSend'
>     reason_string = objc_msgSend (objc_getClass ("NSString"),
>                     ^~~~~~~~~~~~
> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/message.h:85:1: note: candidate function not viable: no known conversion from 'Class _Nullable' (aka 'objc_class *') to
>       'id _Nullable' (aka 'objc_object *') for 1st argument
> objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
> ^
> libgui/src/octave-qobject.cc:222:5: error: use of undeclared identifier 'osx_latencycritical_activity'
>     osx_latencycritical_activity = objc_msgSend (process_info,
>
>
> Ben

Argh. macOS 10.14.6 is what I tested it on in the first place.

Out of curiosity, what Xcode version? Not that I was expecting this to
happen; the Stack Overflow answer I sourced this from was supposed to be
compatible going back many macOS versions.

Best revert the change. I don't think I have a way of tracking down
what's causing this error.

Cheers,
Andrew

Reply | Threaded
Open this post in threaded view
|

Re: Problem with Disable Mac App Nap

bpabbott
Administrator

> On Oct 28, 2019, at 8:21 PM, Andrew Janke <[hidden email]> wrote:
>
>
> On 10/28/19 11:16 PM, Ben Abbott wrote:
>> Hi Andrew,
>>
>> After changeset 27575:d0fe6e344c41 I’m seeing the error below (macOS 10.14.6)
>>
>> libgui/src/octave-qobject.cc:197:26: warning: use of old-style cast [-Wold-style-cast]
>>    process_info_class = (Class) objc_getClass ("NSProcessInfo");
>>                         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> libgui/src/octave-qobject.cc:210:39: warning: use of old-style cast [-Wold-style-cast]
>>    if ((process_info = objc_msgSend ((id)process_info_class, process_info_selector)) == nil)
>>                                      ^   ~~~~~~~~~~~~~~~~~~
>> libgui/src/octave-qobject.cc:213:21: error: no matching function for call to 'objc_msgSend'
>>    reason_string = objc_msgSend (objc_getClass ("NSString"),
>>                    ^~~~~~~~~~~~
>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/message.h:85:1: note: candidate function not viable: no known conversion from 'Class _Nullable' (aka 'objc_class *') to
>>      'id _Nullable' (aka 'objc_object *') for 1st argument
>> objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
>> ^
>> libgui/src/octave-qobject.cc:222:5: error: use of undeclared identifier 'osx_latencycritical_activity'
>>    osx_latencycritical_activity = objc_msgSend (process_info,
>>
>>
>> Ben
>
> Argh. macOS 10.14.6 is what I tested it on in the first place.
>
> Out of curiosity, what Xcode version? Not that I was expecting this to
> happen; the Stack Overflow answer I sourced this from was supposed to be
> compatible going back many macOS versions.
>
> Best revert the change. I don't think I have a way of tracking down
> what's causing this error.
>
> Cheers,
> Andrew

About -> Version 11.1

If it works for you on macOS 10.14.6, it should work for me as well.

Before reverting, let’s wait for others to try. Maybe something is wrong on my end.

Ben



Reply | Threaded
Open this post in threaded view
|

Re: Problem with Disable Mac App Nap

apjanke-floss


On 10/28/19 11:57 PM, Ben Abbott wrote:

>
>> On Oct 28, 2019, at 8:21 PM, Andrew Janke <[hidden email]> wrote:
>>
>>
>> On 10/28/19 11:16 PM, Ben Abbott wrote:
>>> Hi Andrew,
>>>
>>> After changeset 27575:d0fe6e344c41 I’m seeing the error below (macOS 10.14.6)
>>>
>>> libgui/src/octave-qobject.cc:197:26: warning: use of old-style cast [-Wold-style-cast]
>>>    process_info_class = (Class) objc_getClass ("NSProcessInfo");
>>>                         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> libgui/src/octave-qobject.cc:210:39: warning: use of old-style cast [-Wold-style-cast]
>>>    if ((process_info = objc_msgSend ((id)process_info_class, process_info_selector)) == nil)
>>>                                      ^   ~~~~~~~~~~~~~~~~~~
>>> libgui/src/octave-qobject.cc:213:21: error: no matching function for call to 'objc_msgSend'
>>>    reason_string = objc_msgSend (objc_getClass ("NSString"),
>>>                    ^~~~~~~~~~~~
>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/message.h:85:1: note: candidate function not viable: no known conversion from 'Class _Nullable' (aka 'objc_class *') to
>>>      'id _Nullable' (aka 'objc_object *') for 1st argument
>>> objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
>>> ^
>>> libgui/src/octave-qobject.cc:222:5: error: use of undeclared identifier 'osx_latencycritical_activity'
>>>    osx_latencycritical_activity = objc_msgSend (process_info,
>>>
>>>
>>> Ben
>>
>> Argh. macOS 10.14.6 is what I tested it on in the first place.
>>
>> Out of curiosity, what Xcode version? Not that I was expecting this to
>> happen; the Stack Overflow answer I sourced this from was supposed to be
>> compatible going back many macOS versions.
>>
>> Best revert the change. I don't think I have a way of tracking down
>> what's causing this error.
>>
>> Cheers,
>> Andrew
>
> About -> Version 11.1
>
> If it works for you on macOS 10.14.6, it should work for me as well.
>
> Before reverting, let’s wait for others to try. Maybe something is wrong on my end.
>
> Ben

I can reproduce the build failure.

Aaaaaaand, I remember now: I couldn't get a good test in the first place
due to unrelated build failures. (See
https://savannah.gnu.org/bugs/?55940#comment50.) So I bet it's broken
for everyone.

I've asked for a revert.
https://savannah.gnu.org/bugs/index.php?55940#comment52

Cheers,
Andrew

Reply | Threaded
Open this post in threaded view
|

Re: Problem with Disable Mac App Nap

Rik-4
In reply to this post by bpabbott
On 10/28/2019 08:57 PM, [hidden email] wrote:
Subject:
Re: Problem with Disable Mac App Nap
From:
Ben Abbott [hidden email]
Date:
10/28/2019 08:57 PM
To:
Andrew Janke [hidden email]
CC:
Ben Abbott [hidden email], Octave Maintainers [hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
quoted-printable
Precedence:
list
MIME-Version:
1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
References:
[hidden email] [hidden email]
In-Reply-To:
[hidden email]
Message-ID:
[hidden email]
Content-Type:
text/plain; charset=utf-8
Message:
5

On Oct 28, 2019, at 8:21 PM, Andrew Janke [hidden email] wrote:


On 10/28/19 11:16 PM, Ben Abbott wrote:
Hi Andrew,

After changeset 27575:d0fe6e344c41 I’m seeing the error below (macOS 10.14.6)

libgui/src/octave-qobject.cc:197:26: warning: use of old-style cast [-Wold-style-cast]
   process_info_class = (Class) objc_getClass ("NSProcessInfo");
                        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libgui/src/octave-qobject.cc:210:39: warning: use of old-style cast [-Wold-style-cast]
   if ((process_info = objc_msgSend ((id)process_info_class, process_info_selector)) == nil)
                                     ^   ~~~~~~~~~~~~~~~~~~
libgui/src/octave-qobject.cc:213:21: error: no matching function for call to 'objc_msgSend'
   reason_string = objc_msgSend (objc_getClass ("NSString"),
                   ^~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/objc/message.h:85:1: note: candidate function not viable: no known conversion from 'Class _Nullable' (aka 'objc_class *') to
     'id _Nullable' (aka 'objc_object *') for 1st argument
objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
^
libgui/src/octave-qobject.cc:222:5: error: use of undeclared identifier 'osx_latencycritical_activity'
   osx_latencycritical_activity = objc_msgSend (process_info,


Ben
Argh. macOS 10.14.6 is what I tested it on in the first place.

Out of curiosity, what Xcode version? Not that I was expecting this to
happen; the Stack Overflow answer I sourced this from was supposed to be
compatible going back many macOS versions.

Best revert the change. I don't think I have a way of tracking down
what's causing this error.

Cheers,
Andrew
About -> Version 11.1

If it works for you on macOS 10.14.6, it should work for me as well.

Before reverting, let’s wait for others to try. Maybe something is wrong on my end.

Ben

The compile warnings about old-style casting are easy to resolve by using static_cast operator.  See https://hg.savannah.gnu.org/hgweb/octave/rev/a1907c3fdef4.  In that changeset I also took the opportunity to make disable_app_nap a file local function, rather than a private member function of the base_qobject class.  This function never needs to be exposed as part of the API of the class so this felt better.

I don't think we're that far from a solution.  See this blog post: https://www.mikeash.com/pyblog/objc_msgsends-new-prototype.html.  Quoting from it, "Apple's new OSes are out. If you've looked through the documentation, you may have noticed that the prototype for objc_msgSend has changed. Previously, it was declared as a function that took id, SEL, and variadic arguments after that, and returned id. Now it's declared as a function that takes and returns void."  The date of the blog post was 10/11/2010 so this is a recent change.

This seems easy enough to resolve.  There needs to be a configure test to check whether objc_msgSend has the old or new prototype and then call the correct one.

--Rik