iOS 5 beta 2 SDK unicode/udraft.h #defines StringPiece, breaking libraries
| Originator: | bgertzfield | ||
| Number: | rdar://9704966 | Date Originated: | 2011-06-30 |
| Status: | Closed | Resolved: | |
| Product: | iOS SDK | Product Version: | 5.0 beta 2 |
| Classification: | Serious Bug | Reproducible: | 100% |
I upgraded from iOS 5 beta 1 SDK to iOS 5 beta 2. I found the new version of ICU included in the SDK defines a macro called StringPiece:
% find . -type f -print0 | xargs -0 grep StringPiece
./unicode/udraft.h:# define StringPiece StringPiece_DRAFT_API_DO_NOT_USE
./unicode/udraft.h:# define StringPiece_48 StringPiece_DRAFT_API_DO_NOT_USE
This breaks any library that previously defined a function or class called StringPiece, including Google libphonenumber (which uses another library class, re2::StringPiece):
libphonenumber/cpp/src/phonenumberutil.cc:56: error: 're2::StringPiece_DRAFT_API_DO_NOT_USE' has not been declared
libphonenumber/cpp/src/phonenumberutil.cc: In function 'void i18n::phonenumbers::<unnamed>::FormatAccordingToFormatsWithCarrier(const std::string&, const google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>&, i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat, const std::string&, const std::string&, std::string*)':
Steps to Reproduce:
% cat testStringPiece.cc
namespace foo {
class StringPiece { };
}
#include <unicode/uchar.h>
#include <unicode/utf8.h>
namespace bar {
using foo::StringPiece;
void DoStuff() {
StringPiece blah;
}
}
% /Developer/usr/bin/g++ -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -c testStringPiece testStringPiece.cc
testStringPiece.cc:9: error: ‘foo::StringPiece_DRAFT_API_DO_NOT_USE’ has not been declared
testStringPiece.cc: In function ‘void bar::DoStuff()’:
testStringPiece.cc:12: error: ‘StringPiece_DRAFT_API_DO_NOT_USE’ was not declared in this scope
testStringPiece.cc:12: error: expected `;' before ‘blah’
Expected Results:
StringPiece should not be #defined in ICU headers included with iOS SDK 5.
Actual Results:
StringPiece is #defined in ICU headers, causing existing code to fail to compile.
Regression:
100% reproducible.
Notes:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!