discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warning with clang, error with gcc : attached files


From: Riccardo Mottola
Subject: Re: Warning with clang, error with gcc : attached files
Date: Mon, 29 Apr 2019 14:26:45 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4

Hi,

the "error" comes from this :
themeControlState is a private method of GUI of NSButtonCell which RikScrollerArrowCell subclasses.

Being private and not protected, it is not exposed nor should it be accessible. A method not found is supposed to return "id", which is not compatible with GSThemeControlState.

either it is wrong that the subclass directly calls the theme DrawPathButton for which it needs to know the GSThemeControlState and this drawing should happen differently, so that the subclass shouldn't care about, or our API is too restrictive here.

Perhaps Fred and other GUI experts could chime in?

Riccardo


I do not know a quick solution for this, though.
Bertrand Dekoninck wrote:
Oups, and here are the attached files


Le 29/04/2019 à 10:39, Bertrand Dekoninck a écrit :
Hi, everyone on the list.

I'm facing an issue here and I don't find a solution.

I have a warning compiling the class RikScrollerArrowCell from the rik theme. I've got two warnings that causes an error with gcc (without libobjc2) but only one warning and no error with clang+libobjc2.

Here are the build logs :

with gcc :

RikScrollerArrowCell.m: In function ‘-[RikScrollerArrowCell drawBezelWithFrame:inView:]’: RikScrollerArrowCell.m:13:3: warning: ‘RikScrollerArrowCell’ may not respond to
‘-themeControlState’
   GSThemeControlState buttonState = [self themeControlState];
   ^
RikScrollerArrowCell.m:13:3: warning: (Messages without a matching method signature RikScrollerArrowCell.m:13:3: warning: will be assumed to return ‘id’ and accept
RikScrollerArrowCell.m:13:3: warning: ‘...’ as arguments.)
RikScrollerArrowCell.m:13:37: error: incompatible types when initializing type ‘GSThemeControlState’ using type ‘id’
   GSThemeControlState buttonState = [self themeControlState];
                                     ^
RikScrollerArrowCell.m:14:3: warning: ‘RikScrollerArrowCell’ may not respond to
‘-pathForFrame:’
   NSBezierPath * path = [self pathForFrame: cellFrame];
   ^
make[3]: *** [obj/Rik.obj/RikScrollerArrowCell.m.o] Error 1
make[2]: *** [internal-bundle-run-compile-submake] Error 2
make[1]: *** [Rik.all.bundle.variables] Error 2
make: *** [internal-all] Error 2


And with clang+libobjc2 :

Compiling file RikScrollerArrowCell.m ...
RikScrollerArrowCell.m:13:43: warning: instance method '-themeControlState' not
      found (return type defaults to 'id') [-Wobjc-method-access]
  GSThemeControlState buttonState = [self themeControlState];
                                          ^~~~~~~~~~~~~~~~~
./RikScrollerArrowCell.h:10:12: note: receiver is instance of class declared here
@interface RikScrollerArrowCell : NSButtonCell
           ^
RikScrollerArrowCell.m:13:23: warning: incompatible pointer to integer conversion
      initializing 'GSThemeControlState' with an expression of type 'id'
      [-Wint-conversion]
  GSThemeControlState buttonState = [self themeControlState];
                      ^             ~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
 Compiling file NSBrowserCell+Rik.m ...


I don't think it's an objc2 vs objc1 issue. RikScrollerArrowCell is a NSButtonCell subclass. Should'nt it respond to themeControlState ? The best would be to get rid of the warning and I don't understand why it occurs.

Here are attached RikScrollerArrowCell.m and RikScrollerArrowCell.h.


Any idea ?

Bertrand



_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep





reply via email to

[Prev in Thread] Current Thread [Next in Thread]