Opened 12 years ago
Last modified 9 years ago
#37974 new defect
Pallet @1.1.1 Patches for syntax warnings when using Clang and Xcode 4.6
Reported by: | IanWadham | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Low | Milestone: | |
Component: | contrib | Version: | 2.1.3 |
Keywords: | haspatch | Cc: | ksammons@…, cooljeanius (Eric Gallager), ryandesign (Ryan Carsten Schmidt) |
Port: | Pallet |
Description
Using OS X 10.7.5, Xcode 4.6 and Clang, I get about 50 syntax warnings when compiling the source code of Pallet in an Xcode 4.6 project. Attached are four patches to fix these. The patches are against SVN checkout on 7 Feb 2013.
I have also re-worded some offensive text in a string in file MPQueueTableView.m.diff.
Attachments (4)
Change History (14)
Changed 12 years ago by IanWadham
Attachment: | patch-MPActionLauncher.m.diff added |
---|
Changed 12 years ago by IanWadham
Attachment: | patch-MPActionsController.m.diff added |
---|
Changed 12 years ago by IanWadham
Attachment: | patch-MPQueueTableView.m.diff added |
---|
Changed 12 years ago by IanWadham
Attachment: | patch-PortsTableController.m.diff added |
---|
comment:1 follow-up: 4 Changed 12 years ago by cooljeanius (Eric Gallager)
comment:3 follow-ups: 8 9 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | haspatch added |
---|---|
Port: | @1.1.1 removed |
Replying to iandw.au@…:
I have also re-worded some offensive text in a string in file MPQueueTableView.m.diff.
Changed this in r102780. I am not certain about the other changes. What were the warnings you received?
comment:4 follow-up: 5 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|
Replying to egall@…:
You might want to apply these conditionally; string literals are a newer Objective C feature, and I'm not sure how far backwards compatible they go...
NSString literals have been around "forever" according to this blog post; what's new in clang 3.2 are literals for NSNumber, NSArray, and NSDictionary.
comment:5 follow-up: 6 Changed 12 years ago by larryv (Lawrence Velázquez)
Replying to ryandesign@…:
Replying to egall@…:
You might want to apply these conditionally; string literals are a newer Objective C feature, and I'm not sure how far backwards compatible they go...
NSString literals have been around "forever" according to this blog post
Mac OS X 10.0’s GCC (which looks like it was 2.95.2, Apple build 926) recognized Objective-C string literals. So yeah, we probably don’t have to worry too much about backwards compatibility on that front.
comment:6 follow-up: 7 Changed 12 years ago by cooljeanius (Eric Gallager)
Replying to larryv@…:
Replying to ryandesign@…:
Replying to egall@…:
You might want to apply these conditionally; string literals are a newer Objective C feature, and I'm not sure how far backwards compatible they go...
NSString literals have been around "forever" according to this blog post; what's new in clang 3.2 are literals for NSNumber, NSArray, and NSDictionary.
Mac OS X 10.0’s GCC (which looks like it was 2.95.2, Apple build 926) recognized Objective-C string literals. So yeah, we probably don’t have to worry too much about backwards compatibility on that front.
Right, I was getting my different types of literals confused... guess that means it's probably safe to commit then.
comment:7 Changed 12 years ago by larryv (Lawrence Velázquez)
Replying to egall@…:
Right, I was getting my different types of literals confused...
“we heard you like @ signs…” —Apple
comment:8 Changed 12 years ago by larryv (Lawrence Velázquez)
Replying to ryandesign@…:
Changed this in r102780. I am not certain about the other changes. What were the warnings you received?
From eyeballing it, it looks like the warnings are either:
printf
-style format specifiers that don’t quite match the arguments given. These should be fine to commit; plus, they’re just for logging.- Redundant invocations of
[NSString +stringWithString]
with an NSString literal argument. Those might once have been necessary for memory management. They still might be; I’m not familiar enough with non-ARC code to say whether it’s safe to use NSString literals like this.
comment:9 Changed 12 years ago by IanWadham
Replying to ryandesign@…:
Replying to iandw.au@…:
I have also re-worded some offensive text in a string in file MPQueueTableView.m.diff.
Changed this in r102780. I am not certain about the other changes. What were the warnings you received?
Examples of the warning messages I was getting are shown below, as comments, along with "before and after" code.
1) NSLog(@"Default variants count: %i", [defaultVariants count]);
Values of type 'NSUInteger' should not be used as format arguments; add an explicit cast to 'unsigned long' instead
NSLog(@"Default variants count: %li", (unsigned long)[defaultVariants count]);
2) [variants addObject: [NSString stringWithString:@"+"]];
Using 'stringWithString' with a literal is redundant
[variants addObject: @"+"];
These examples are from file MPActionsController.m. BTW, Pallet was written by GSoC students in 2009 and 2010, so is not very old.
comment:10 Changed 9 years ago by jmroot (Joshua Root)
Cc: | ksammons@… added |
---|
You might want to apply these conditionally; string literals are a newer Objective C feature, and I'm not sure how far backwards compatible they go...