Closed
Bug 583460
Opened 15 years ago
Closed 15 years ago
[clang] nsClipboard: cannot initialize a parameter of type 'NSString *' with an lvalue of type 'NSString const *'
Categories
(Core :: Widget: Cocoa, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: Nomis101, Assigned: sgreenlay)
References
Details
Attachments
(3 files, 2 obsolete files)
573.68 KB,
application/zip
|
Details | |
4.00 KB,
patch
|
jaas
:
review+
jaas
:
approval2.0+
|
Details | Diff | Splinter Review |
4.33 KB,
patch
|
Details | Diff | Splinter Review |
After fixing of Bug 583283, it turns out, there is a similar issue for nsClipboard. I've attached the preprocessed source. Building with Clang stops with the following errors:
/Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.mm:164:58: error:
cannot initialize a parameter of type 'NSString *' with an lvalue of type
'NSString const *'
NSString* pString = [cocoaPasteboard stringForType:pboardType];
^~~~~~~~~~
In file included from /Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.mm:45:
In file included from /Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.h:45:
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:36:
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:32:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSPasteboard.h:138:41: note:
passing argument to parameter 'dataType' here
- (NSString *)stringForType:(NSString *)dataType;
^
/Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.mm:366:59: error:
cannot initialize a parameter of type 'NSString *' with an lvalue of type
'NSString const *'
if (availableType && [availableType isEqualToString:pboardType]) {
^~~~~~~~~~
In file included from /Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.mm:45:
In file included from /Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.h:45:
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:15:
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:8:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:113:37: note:
passing argument to parameter 'aString' here
- (BOOL)isEqualToString:(NSString *)aString;
^
In file included from /Volumes/Developer/temp-ql/src/mozilla/widget/src/cocoa/nsClipboard.mm:56:
../../../dist/include/nsObjCExceptions.h:161:13: warning: unused function
'nsObjCExceptionLogAbort' [-Wunused-function]
static void nsObjCExceptionLogAbort(NSException *e)
^
1 warning and 2 errors generated.
make[6]: *** [nsClipboard.o] Error 1
make[6]: *** Waiting for unfinished jobs....
(In reply to comment #1)
> Can you look into this Scott?
We don't actually support Clang but we may someday. It tends to have more strict error checking as far as I can tell, see if you can figure out the problem and just have the reporter test your patch. No need to actually try to build with Clang yourself.
![]() |
Assignee | |
Comment 3•15 years ago
|
||
How about this? (Clang seems to dislike the use of const NSString for pboardType)
Attachment #479130 -
Flags: review?(joshmoz)
Comment on attachment 479130 [details] [diff] [review]
pboardType fix
>- const NSString *pboardType;
>+ NSString *pboardType = nil;
> if (nsClipboard::IsStringType(flavorStr, &pboardType)) {
It's const in part because "IsStringType" takes a "const NSString*" argument. We can probably do away with that too.
Attachment #479130 -
Flags: review?(joshmoz) → review-
![]() |
Assignee | |
Updated•15 years ago
|
Status: NEW → ASSIGNED
![]() |
Assignee | |
Comment 5•15 years ago
|
||
Changed IsStringType to take NSString** instad of const NSString** and changed places that used const (in order to use the old IsStringType).
Builds and runs fine under current build set-up. Can someone building under clang try it and see if that fixes the problem (or point me to instructions so I can set up to build under clang)?
Attachment #479130 -
Attachment is obsolete: true
Attachment #480293 -
Flags: review?(joshmoz)
(In reply to comment #5)
> Builds and runs fine under current build set-up. Can someone building under
> clang try it and see if that fixes the problem (or point me to instructions so
> I can set up to build under clang)?
I've tested this patch with Clang and it fixes the nsClipboard error for me.
If you want to test it by yourself, you need two things:
1. You need to install Clang. You can do this by installing Xcode4DP or you use Clang trunk: http://clang.llvm.org/get_started.html
2. You need to apply the LLVM Mozilla patch from this Bug:
http://llvm.org/bugs/show_bug.cgi?id=5511 (I have a newer patch from John Regehr, that also fixes issues introduced with JM)
Than you are prepared to build with Clang.
OS: Mac OS X → Windows 7
Nomis101 - can you keep the latest patch for building with clang on a bug that is blocking bug 574346? That way if we decide to try it we can access the latest code easily. Thanks.
(In reply to comment #7)
> Nomis101 - can you keep the latest patch for building with clang on a bug that
> is blocking bug 574346? That way if we decide to try it we can access the
> latest code easily. Thanks.
Done, Bug 601360.
![]() |
Assignee | |
Updated•15 years ago
|
OS: Windows 7 → Mac OS X
Hardware: x86 → All
![]() |
Assignee | |
Updated•15 years ago
|
Summary: nsClipboard: cannot initialize a parameter of type 'NSString *' with an lvalue of type 'NSString const *' → [clang] nsClipboard: cannot initialize a parameter of type 'NSString *' with an lvalue of type 'NSString const *'
Attachment #480293 -
Flags: review?(joshmoz) → review+
Attachment #480293 -
Flags: approval2.0+
![]() |
Assignee | |
Comment 9•15 years ago
|
||
![]() |
Assignee | |
Comment 10•15 years ago
|
||
changed a=2.0 to a=josh
Attachment #491303 -
Attachment is obsolete: true
![]() |
Assignee | |
Updated•15 years ago
|
Attachment #491305 -
Attachment is patch: true
Attachment #491305 -
Attachment mime type: application/octet-stream → text/plain
Comment 11•15 years ago
|
||
pushed to mozilla-central
http://hg.mozilla.org/mozilla-central/rev/0e4ab404540d
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•