[build] Fix clang-tidy false positive on Linux (#4406)

* Fix clang-tidy false positive on Linux

```
== clang-tidy /home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp ==
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:12:33: error: expected class name [clang-diagnostic-error]
class StackTraceWalker : public StackWalker {
                                ^
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:16:17: error: unknown type name 'LPCTSTR' [clang-diagnostic-error]
  void OnOutput(LPCTSTR szText) override;
                ^
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:23:33: error: unknown type name 'LPCTSTR' [clang-diagnostic-error]
void StackTraceWalker::OnOutput(LPCTSTR szText) {
                                ^
```

* Fix false positives for macOS code
This commit is contained in:
Tyler Veness
2022-09-17 00:23:59 -07:00
committed by GitHub
parent 97836f0e55
commit ba4ec6c967
4 changed files with 16 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of // Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project. // the WPILib BSD license file in the root directory of this project.
#if defined(__APPLE__)
#include "wpinet/MulticastServiceResolver.h" #include "wpinet/MulticastServiceResolver.h"
#include <netinet/in.h> #include <netinet/in.h>
@@ -212,3 +214,5 @@ void MulticastServiceResolver::Stop() {
pImpl->ResolveStates.clear(); pImpl->ResolveStates.clear();
pImpl->serviceRef = nullptr; pImpl->serviceRef = nullptr;
} }
#endif // defined(__APPLE__)

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of // Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project. // the WPILib BSD license file in the root directory of this project.
#if defined(__APPLE__)
#include "ResolverThread.h" #include "ResolverThread.h"
#include <algorithm> #include <algorithm>
@@ -109,3 +111,5 @@ std::shared_ptr<ResolverThread> ResolverThread::Get() {
} }
return locked; return locked;
} }
#endif // defined(__APPLE__)

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of // Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project. // the WPILib BSD license file in the root directory of this project.
#if defined(__APPLE__)
#pragma once #pragma once
#include <netinet/in.h> #include <netinet/in.h>
@@ -44,3 +46,5 @@ class ResolverThread {
std::atomic_bool running; std::atomic_bool running;
}; };
} // namespace wpi } // namespace wpi
#endif // defined(__APPLE__)

View File

@@ -8,6 +8,8 @@
#include "wpi/ConvertUTF.h" #include "wpi/ConvertUTF.h"
#include "wpi/SmallString.h" #include "wpi/SmallString.h"
#if defined(_MSC_VER)
namespace { namespace {
class StackTraceWalker : public StackWalker { class StackTraceWalker : public StackWalker {
public: public:
@@ -40,3 +42,5 @@ std::string GetStackTraceDefault(int offset) {
} }
} // namespace wpi } // namespace wpi
#endif // defined(_MSC_VER)