Skip to content

Commit 05dbd05

Browse files
authored
Merge pull request #70943 from tshortli/resolve-more-warnings
Resolve more warnings
2 parents 1bc76a4 + 064afb9 commit 05dbd05

File tree

19 files changed

+45
-12
lines changed

19 files changed

+45
-12
lines changed

lib/Demangling/Errors.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ static void reportNow(uint32_t flags, const char *message) {
102102
fflush(stderr);
103103
#endif
104104
#if SWIFT_STDLIB_HAS_ASL
105+
#pragma clang diagnostic push
106+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
105107
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
108+
#pragma clang diagnostic pop
106109
#elif defined(__ANDROID__) && !defined(__TERMUX__)
107110
__android_log_print(ANDROID_LOG_FATAL, "SwiftDemangle", "%s", message);
108111
#endif

lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
#include "llvm/Support/Debug.h"
5252
#include "llvm/Support/ErrorHandling.h"
5353
#include "llvm/Support/FileSystem.h"
54-
#include "llvm/Support/Host.h"
5554
#include "llvm/Support/MD5.h"
5655
#include "llvm/Support/Path.h"
5756
#include "llvm/Support/PrettyStackTrace.h"
5857
#include "llvm/Support/raw_ostream.h"
58+
#include "llvm/TargetParser/Host.h"
5959

6060
#include "CompilationRecord.h"
6161

lib/Driver/FrontendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include "llvm/ADT/DenseSet.h"
2222
#include "llvm/Option/ArgList.h"
2323
#include "llvm/Support/CommandLine.h"
24-
#include "llvm/Support/Host.h"
2524
#include "llvm/Support/StringSaver.h"
25+
#include "llvm/TargetParser/Host.h"
2626

2727
using namespace swift;
2828
using namespace swift::driver;

lib/DriverTool/driver.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@
3232
#include "swift/FrontendTool/FrontendTool.h"
3333
#include "swift/DriverTool/DriverTool.h"
3434
#include "llvm/ADT/SmallVector.h"
35-
#include "llvm/TargetParser/Triple.h"
3635
#include "llvm/Support/CommandLine.h"
3736
#include "llvm/Support/ConvertUTF.h"
3837
#include "llvm/Support/Errno.h"
3938
#include "llvm/Support/FileSystem.h"
40-
#include "llvm/Support/Host.h"
39+
#include "llvm/TargetParser/Host.h"
4140
#include "llvm/Support/ManagedStatic.h"
4241
#include "llvm/Support/Path.h"
4342
#include "llvm/Support/PrettyStackTrace.h"
@@ -47,6 +46,8 @@
4746
#include "llvm/Support/StringSaver.h"
4847
#include "llvm/Support/TargetSelect.h"
4948
#include "llvm/Support/raw_ostream.h"
49+
#include "llvm/TargetParser/Host.h"
50+
#include "llvm/TargetParser/Triple.h"
5051

5152
#include <memory>
5253
#include <stdlib.h>

lib/DriverTool/swift_llvm_opt_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include "llvm/MC/TargetRegistry.h"
5757
#include "llvm/Support/Debug.h"
5858
#include "llvm/Support/FileSystem.h"
59-
#include "llvm/Support/Host.h"
6059
#include "llvm/Support/ManagedStatic.h"
6160
#include "llvm/Support/PluginLoader.h"
6261
#include "llvm/Support/PrettyStackTrace.h"
@@ -66,6 +65,7 @@
6665
#include "llvm/Support/TargetSelect.h"
6766
#include "llvm/Support/ToolOutputFile.h"
6867
#include "llvm/Target/TargetMachine.h"
68+
#include "llvm/TargetParser/Host.h"
6969
#include "llvm/Transforms/Scalar/LoopPassManager.h"
7070

7171
using namespace swift;

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7928,7 +7928,6 @@ void Parser::parseExpandedMemberList(SmallVectorImpl<ASTNode> &items) {
79287928
if (Tok.is(tok::NUM_TOKENS))
79297929
consumeTokenWithoutFeedingReceiver();
79307930

7931-
auto *decl = CurDeclContext->getAsDecl();
79327931
bool previousHadSemi = true;
79337932

79347933
SourceLoc startingLoc = Tok.getLoc();

lib/Serialization/Deserialization.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7629,7 +7629,6 @@ class SwiftToClangBasicReader :
76297629
if (!rawKind)
76307630
return nullptr;
76317631

7632-
clang::attr::Kind attrKind = static_cast<clang::attr::Kind>(rawKind - 1);
76337632
auto name = readIdentifier();
76347633
auto scopeName = readIdentifier();
76357634

stdlib/public/Concurrency/Actor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,10 @@ void swift::swift_task_reportUnexpectedExecutor(
426426
fflush(stderr);
427427
#endif
428428
#if SWIFT_STDLIB_HAS_ASL
429+
#pragma clang diagnostic push
430+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
429431
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
432+
#pragma clang diagnostic pop
430433
#elif defined(__ANDROID__)
431434
__android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", message);
432435
#endif

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,10 @@ struct TaskGroupStatus {
594594
write(STDERR_FILENO, message, strlen(message));
595595
#endif
596596
#if defined(SWIFT_STDLIB_HAS_ASL)
597+
#pragma clang diagnostic push
598+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
597599
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
600+
#pragma clang diagnostic pop
598601
#elif defined(__ANDROID__)
599602
__android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", message);
600603
#endif

stdlib/public/Concurrency/TaskLocal.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ static void swift_task_reportIllegalTaskLocalBindingWithinWithTaskGroupImpl(
294294
fflush(stderr);
295295
#endif
296296
#if SWIFT_STDLIB_HAS_ASL
297+
#pragma clang diagnostic push
298+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
297299
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
300+
#pragma clang diagnostic pop
298301
#elif defined(__ANDROID__)
299302
__android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", message);
300303
#endif

stdlib/public/LLVMSupport/ErrorHandling.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ void error(const char *prefix, const char *msg, const char *file = nullptr, unsi
4141
}
4242

4343
#if SWIFT_STDLIB_HAS_ASL
44+
#pragma clang diagnostic push
45+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
4446
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", buffer);
47+
#pragma clang diagnostic pop
4548
#elif defined(__ANDROID__) && !defined(__TERMUX__)
4649
__android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", buffer);
4750
#elif defined(_WIN32)

stdlib/public/SwiftShims/swift/shims/LibcOverlayShims.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static inline char * _Nullable * _Null_unspecified _swift_stdlib_getEnviron() {
5959
return environ;
6060
}
6161
#elif defined(__APPLE__)
62-
static inline char * _Nullable *_swift_stdlib_getEnviron() {
62+
static inline char * _Nullable * _Null_unspecified _swift_stdlib_getEnviron() {
6363
extern char * _Nullable **_NSGetEnviron(void);
6464
return *_NSGetEnviron();
6565
}

stdlib/public/runtime/Errors.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,10 @@ reportNow(uint32_t flags, const char *message)
313313
fflush(stderr);
314314
#endif
315315
#if SWIFT_STDLIB_HAS_ASL
316+
#pragma clang diagnostic push
317+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
316318
asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", message);
319+
#pragma clang diagnostic pop
317320
#elif defined(__ANDROID__)
318321
__android_log_print(ANDROID_LOG_FATAL, "SwiftRuntime", "%s", message);
319322
#endif

stdlib/public/runtime/SwiftObject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
// Real class name: mangled "Swift._SwiftObject"
3636
#define SwiftObject _TtCs12_SwiftObject
3737

38+
#pragma clang diagnostic push
39+
#pragma clang diagnostic ignored "-Wobjc-root-class"
3840
#if __has_attribute(objc_root_class)
3941
__attribute__((__objc_root_class__))
4042
#endif
@@ -43,6 +45,7 @@ SWIFT_RUNTIME_EXPORT @interface SwiftObject<NSObject> {
4345
Class isa;
4446
SWIFT_HEAPOBJECT_NON_OBJC_MEMBERS;
4547
}
48+
#pragma clang diagnostic pop
4649

4750
- (BOOL)isEqual:(id)object;
4851
- (NSUInteger)hash;

stdlib/public/runtime/SwiftObject.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,10 @@ static bool isObjCForUnownedReference(void *value) {
11711171
if (object == nullptr)
11721172
return nullptr;
11731173

1174+
#pragma clang diagnostic push
1175+
#pragma clang diagnostic ignored "-Wreceiver-forward-class"
11741176
if ([id_const_cast(object) isKindOfClass:[__SwiftValue class]]) {
1177+
#pragma clang diagnostic pop
11751178
// Source is a `__SwiftValue` container
11761179
// Unwrap, then use the most general casting machine to do the heavy lifting
11771180
auto typeValue = getValueFromSwiftValue(reinterpret_cast<__SwiftValue *>(object));

stdlib/tools/swift-reflection-test/swift-reflection-test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ static int PipeMemoryReader_queryDataLayout(void *Context,
187187

188188
static void PipeMemoryReader_freeBytes(void *reader_context, const void *bytes,
189189
void *context) {
190+
#pragma clang diagnostic push
191+
#pragma clang diagnostic ignored "-Wcast-qual"
190192
free((void *)bytes);
193+
#pragma clang diagnostic pop
191194
}
192195

193196
static
@@ -652,10 +655,13 @@ int reflectEnumValue(SwiftReflectionContextRef RC,
652655
void *outFreeContext = NULL;
653656
// !!! FIXME !!! obtain the pointer by properly projecting the enum value
654657
// Next lines are a hack to prove the concept.
658+
#pragma clang diagnostic push
659+
#pragma clang diagnostic ignored "-Wcast-qual"
655660
const void *rawPtr
656661
= PipeMemoryReader_readBytes((void *)&Pipe, EnumInstance, 8, &outFreeContext);
657662
uintptr_t instance = *(uintptr_t *)rawPtr & 0xffffffffffffff8ULL;
658663
PipeMemoryReader_freeBytes((void *)&Pipe, rawPtr, outFreeContext);
664+
#pragma clang diagnostic pop
659665

660666
// Indirect enum stores the payload as the first field of a closure context
661667
swift_typeinfo_t TI = swift_reflection_infoForInstance(RC, instance);

tools/SourceKit/lib/Support/Logging.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ Logger::~Logger() {
6666
fprintf(stderr, "%s: %s\n", LoggerName.c_str(), LogMsg.c_str());
6767

6868
#if __APPLE__
69+
// rdar://121076739
70+
#pragma clang diagnostic push
71+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
6972
// Use the Apple System Log facility.
7073
aslclient asl = asl_open(LoggerName.c_str(), "com.apple.console",
7174
ASL_OPT_NO_DELAY);
@@ -76,5 +79,6 @@ Logger::~Logger() {
7679
asl_send(asl, msg);
7780
asl_free(msg);
7881
asl_close(asl);
82+
#pragma clang diagnostic pop
7983
#endif
8084
}

unittests/AST/TestContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "swift/Basic/SourceManager.h"
1919
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
2020

21-
#include "llvm/Support/Host.h"
21+
#include "llvm/TargetParser/Host.h"
2222

2323
namespace swift {
2424
namespace unittest {

unittests/DependencyScan/ModuleDeps.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "ScanFixture.h"
14-
#include "swift/Basic/Platform.h"
1514
#include "swift/Basic/Defer.h"
16-
#include "llvm/TargetParser/Triple.h"
17-
#include "llvm/Support/Host.h"
15+
#include "swift/Basic/Platform.h"
1816
#include "llvm/Support/Path.h"
1917
#include "llvm/Support/raw_ostream.h"
18+
#include "llvm/TargetParser/Host.h"
19+
#include "llvm/TargetParser/Triple.h"
2020
#include "gtest/gtest.h"
2121
#include <string>
2222

0 commit comments

Comments
 (0)