[cscore, wpilibcExamples] Use double-quote includes for wpi/ (#8346)

Use ERR and WARN in cscore to avoid conflict with Windows headers.
This commit is contained in:
Peter Johnson
2025-11-08 16:58:51 -08:00
committed by GitHub
parent fc4e922206
commit 5c9c45fadb
226 changed files with 868 additions and 951 deletions

View File

@@ -41,5 +41,4 @@ includeOtherLibs {
^imgui
^support/
^tcpsockets/
^wpi/net/
}

View File

@@ -10,7 +10,6 @@
#include <vector>
#include <fmt/format.h>
#include <wpi/net/TCPConnector.h>
#include "Instance.hpp"
#include "JpegUtil.hpp"
@@ -18,6 +17,7 @@
#include "Notifier.hpp"
#include "Telemetry.hpp"
#include "c_util.hpp"
#include "wpi/net/TCPConnector.h"
#include "wpi/util/MemAlloc.hpp"
#include "wpi/util/StringExtras.hpp"
#include "wpi/util/timestamp.h"

View File

@@ -15,10 +15,9 @@
#include <thread>
#include <vector>
#include <wpi/net/HttpUtil.hpp>
#include "SourceImpl.hpp"
#include "wpi/cs/cscore_cpp.hpp"
#include "wpi/net/HttpUtil.hpp"
#include "wpi/util/StringMap.hpp"
#include "wpi/util/condition_variable.hpp"
#include "wpi/util/raw_istream.hpp"

View File

@@ -8,8 +8,6 @@
#include <memory>
#include <utility>
#include <wpi/net/EventLoopRunner.hpp>
#include "Log.hpp"
#include "NetworkListener.hpp"
#include "Notifier.hpp"
@@ -18,6 +16,7 @@
#include "Telemetry.hpp"
#include "UnlimitedHandleResource.hpp"
#include "UsbCameraListener.hpp"
#include "wpi/net/EventLoopRunner.hpp"
#include "wpi/util/Logger.hpp"
namespace wpi::cs {

View File

@@ -30,10 +30,8 @@ inline void NamedLog(wpi::util::Logger& logger, unsigned int level,
#define LOG(level, format, ...) \
WPI_LOG(m_logger, level, format __VA_OPT__(, ) __VA_ARGS__)
#undef ERROR
#define ERROR(format, ...) \
WPI_ERROR(m_logger, format __VA_OPT__(, ) __VA_ARGS__)
#define WARNING(format, ...) \
#define ERR(format, ...) WPI_ERROR(m_logger, format __VA_OPT__(, ) __VA_ARGS__)
#define WARN(format, ...) \
WPI_WARNING(m_logger, format __VA_OPT__(, ) __VA_ARGS__)
#define INFO(format, ...) WPI_INFO(m_logger, format __VA_OPT__(, ) __VA_ARGS__)

View File

@@ -9,11 +9,6 @@
#include <string>
#include <utility>
#include <wpi/net/HttpUtil.hpp>
#include <wpi/net/TCPAcceptor.h>
#include <wpi/net/raw_socket_istream.hpp>
#include <wpi/net/raw_socket_ostream.hpp>
#include "Instance.hpp"
#include "JpegUtil.hpp"
#include "Log.hpp"
@@ -21,6 +16,10 @@
#include "SourceImpl.hpp"
#include "c_util.hpp"
#include "wpi/cs/cscore_cpp.hpp"
#include "wpi/net/HttpUtil.hpp"
#include "wpi/net/TCPAcceptor.h"
#include "wpi/net/raw_socket_istream.hpp"
#include "wpi/net/raw_socket_ostream.hpp"
#include "wpi/util/SmallString.hpp"
#include "wpi/util/StringExtras.hpp"
#include "wpi/util/fmt/raw_ostream.hpp"

View File

@@ -12,11 +12,10 @@
#include <thread>
#include <vector>
#include <wpi/net/NetworkAcceptor.hpp>
#include <wpi/net/NetworkStream.hpp>
#include <wpi/net/raw_socket_ostream.hpp>
#include "SinkImpl.hpp"
#include "wpi/net/NetworkAcceptor.hpp"
#include "wpi/net/NetworkStream.hpp"
#include "wpi/net/raw_socket_ostream.hpp"
#include "wpi/util/SafeThread.hpp"
#include "wpi/util/SmallVector.hpp"
#include "wpi/util/raw_istream.hpp"

View File

@@ -8,8 +8,6 @@
#include <string>
#include <vector>
#include <wpi/net/hostname.hpp>
#include "Handle.hpp"
#include "Instance.hpp"
#include "NetworkListener.hpp"
@@ -18,6 +16,7 @@
#include "SinkImpl.hpp"
#include "SourceImpl.hpp"
#include "Telemetry.hpp"
#include "wpi/net/hostname.hpp"
#include "wpi/util/SmallString.hpp"
#include "wpi/util/json.hpp"

View File

@@ -70,15 +70,14 @@ void NetworkListener::Impl::Thread::Main() {
// Create event socket so we can be shut down
m_command_fd = ::eventfd(0, 0);
if (m_command_fd < 0) {
ERROR("NetworkListener: could not create eventfd: {}",
std::strerror(errno));
ERR("NetworkListener: could not create eventfd: {}", std::strerror(errno));
return;
}
// Create netlink socket
int sd = ::socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sd < 0) {
ERROR("NetworkListener: could not create socket: {}", std::strerror(errno));
ERR("NetworkListener: could not create socket: {}", std::strerror(errno));
::close(m_command_fd);
m_command_fd = -1;
return;
@@ -91,7 +90,7 @@ void NetworkListener::Impl::Thread::Main() {
addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR;
// NOLINTNEXTLINE(modernize-avoid-bind)
if (bind(sd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) < 0) {
ERROR("NetworkListener: could not create socket: {}", std::strerror(errno));
ERR("NetworkListener: could not create socket: {}", std::strerror(errno));
::close(sd);
::close(m_command_fd);
m_command_fd = -1;
@@ -114,7 +113,7 @@ void NetworkListener::Impl::Thread::Main() {
int nfds = std::max(m_command_fd, sd) + 1;
if (::select(nfds, &readfds, nullptr, nullptr, &tv) < 0) {
ERROR("NetworkListener: select(): {}", std::strerror(errno));
ERR("NetworkListener: select(): {}", std::strerror(errno));
break; // XXX: is this the right thing to do here?
}
@@ -135,8 +134,7 @@ void NetworkListener::Impl::Thread::Main() {
if (errno == EWOULDBLOCK || errno == EAGAIN) {
continue;
}
ERROR("NetworkListener: could not read netlink: {}",
std::strerror(errno));
ERR("NetworkListener: could not read netlink: {}", std::strerror(errno));
break; // XXX: is this the right thing to do here?
}
if (len == 0) {

View File

@@ -6,11 +6,10 @@
#include <memory>
#include <wpi/net/EventLoopRunner.hpp>
#include <wpi/net/uv/FsEvent.hpp>
#include <wpi/net/uv/Timer.hpp>
#include "Notifier.hpp"
#include "wpi/net/EventLoopRunner.hpp"
#include "wpi/net/uv/FsEvent.hpp"
#include "wpi/net/uv/Timer.hpp"
#include "wpi/util/StringExtras.hpp"
using namespace wpi::cs;