-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix eight warnings on Linux. #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1291,10 +1291,7 @@ bool ModelASTWalker::processComment(CharSourceRange Range) { | |
bool ModelASTWalker::findUrlStartingLoc(StringRef Text, | ||
unsigned &Start, | ||
std::regex &Regex) { | ||
#ifndef SWIFT_HAVE_WORKING_STD_REGEX | ||
return false; | ||
#endif | ||
|
||
#ifdef SWIFT_HAVE_WORKING_STD_REGEX | ||
static const auto MailToPosition = std::find(URLProtocols.begin(), | ||
URLProtocols.end(), | ||
"mailto"); | ||
|
@@ -1318,6 +1315,7 @@ bool ModelASTWalker::findUrlStartingLoc(StringRef Text, | |
return true; | ||
} | ||
} | ||
#endif | ||
return false; | ||
} | ||
|
||
|
@@ -1354,10 +1352,8 @@ bool ModelASTWalker::searchForURL(CharSourceRange Range) { | |
Optional<SyntaxNode> ModelASTWalker::parseFieldNode(StringRef Text, | ||
StringRef OrigText, | ||
SourceLoc OrigLoc) { | ||
#ifndef SWIFT_HAVE_WORKING_STD_REGEX | ||
return None; | ||
#endif | ||
|
||
Optional<SyntaxNode> Node; | ||
#ifdef SWIFT_HAVE_WORKING_STD_REGEX | ||
std::match_results<StringRef::iterator> Matches; | ||
for (unsigned i = 0; i != 3; ++i) { | ||
auto &Rx = getDocCommentRegex(i); | ||
|
@@ -1372,7 +1368,9 @@ Optional<SyntaxNode> ModelASTWalker::parseFieldNode(StringRef Text, | |
StringRef MatchStr(Match.first, Match.second - Match.first); | ||
auto Loc = OrigLoc.getAdvancedLoc(MatchStr.data() - OrigText.data()); | ||
CharSourceRange Range(Loc, MatchStr.size()); | ||
return Optional<SyntaxNode>({ SyntaxNodeKind::DocCommentField, Range }); | ||
Node = Optional<SyntaxNode>({ SyntaxNodeKind::DocCommentField, Range }); | ||
#endif | ||
return Node; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
} | ||
|
||
bool ModelASTWalker::findFieldsInDocCommentLine(SyntaxNode Node) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,7 @@ class ConvertForWcharSize<4> { | |
|
||
using Convert = ConvertForWcharSize<sizeof(wchar_t)>; | ||
|
||
#if defined(__APPLE__) | ||
static void convertFromUTF8(llvm::StringRef utf8, | ||
llvm::SmallVectorImpl<wchar_t> &out) { | ||
size_t reserve = out.size() + utf8.size(); | ||
|
@@ -157,9 +158,12 @@ static void convertToUTF8(llvm::ArrayRef<wchar_t> wide, | |
(void)res; | ||
out.set_size(utf8_begin - out.begin()); | ||
} | ||
#endif | ||
|
||
} // end anonymous namespace | ||
|
||
#if defined(__APPLE__) | ||
|
||
static bool appendToREPLFile(SourceFile &SF, | ||
PersistentParserState &PersistentState, | ||
REPLContext &RC, | ||
|
@@ -183,8 +187,6 @@ static bool appendToREPLFile(SourceFile &SF, | |
return FoundAnySideEffects; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file LGTM. |
||
} | ||
|
||
#if defined(__APPLE__) | ||
|
||
/// An arbitrary, otherwise-unused char value that editline interprets as | ||
/// entering/leaving "literal mode", meaning it passes prompt characters through | ||
/// to the terminal without affecting the line state. This prevents color | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1388,6 +1388,7 @@ swift::swift_dynamicCastMetatypeUnconditional(const Metadata *sourceType, | |
} | ||
} | ||
|
||
#if SWIFT_OBJC_INTEROP | ||
/// Do a dynamic cast to the target class. | ||
static void *_dynamicCastUnknownClass(void *object, | ||
const Metadata *targetType, | ||
|
@@ -1400,6 +1401,7 @@ static void *_dynamicCastUnknownClass(void *object, | |
|
||
return const_cast<void*>(swift_dynamicCastUnknownClass(object, targetType)); | ||
} | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM. |
||
|
||
static bool _dynamicCastUnknownClassIndirect(OpaqueValue *dest, | ||
void *object, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this cause equivalent unreachable code warnings for
return false
?Could you do
#ifdef ... #else ... #endif
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the 'return false' is reachable with and without SWIFT_HAVE_WORKING_STD_REGEX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Cute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I patched it both ways but settled on this way because it looked cleaner.