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)

patch-MPActionLauncher.m.diff (6.3 KB) - added by IanWadham 12 years ago.
patch-MPActionsController.m.diff (2.0 KB) - added by IanWadham 12 years ago.
patch-MPQueueTableView.m.diff (623 bytes) - added by IanWadham 12 years ago.
patch-PortsTableController.m.diff (382 bytes) - added by IanWadham 12 years ago.

Download all attachments as: .zip

Change History (14)

Changed 12 years ago by IanWadham

Changed 12 years ago by IanWadham

Changed 12 years ago by IanWadham

Changed 12 years ago by IanWadham

comment:1 Changed 12 years ago by cooljeanius (Eric Gallager)

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...

comment:2 Changed 12 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:3 in reply to:  description ; 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 in reply to:  1 ; 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 in reply to:  4 ; 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 in reply to:  5 ; 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 in reply to:  6 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 in reply to:  3 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.
Version 0, edited 12 years ago by larryv (Lawrence Velázquez) (next)

comment:9 in reply to:  3 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
Note: See TracTickets for help on using tickets.