clang-tidy: modernize-use-using (NFC)

Excludes C-compatible headers
This commit is contained in:
Peter Johnson
2020-12-27 22:52:53 -08:00
parent 885f5a9781
commit 4cc0706b06
12 changed files with 76 additions and 79 deletions

View File

@@ -31,10 +31,10 @@ class BufferCallbackStore {
void InitializeBufferStore();
typedef int32_t (*RegisterBufferCallbackFunc)(int32_t index,
HAL_BufferCallback callback,
void* param);
typedef void (*FreeBufferCallbackFunc)(int32_t index, int32_t uid);
using RegisterBufferCallbackFunc = int32_t (*)(int32_t index,
HAL_BufferCallback callback,
void* param);
using FreeBufferCallbackFunc = void (*)(int32_t index, int32_t uid);
SIM_JniHandle AllocateBufferCallback(JNIEnv* env, jint index, jobject callback,
RegisterBufferCallbackFunc createCallback);

View File

@@ -31,20 +31,20 @@ class CallbackStore {
void InitializeStore();
typedef int32_t (*RegisterCallbackFunc)(int32_t index,
HAL_NotifyCallback callback,
void* param, HAL_Bool initialNotify);
typedef void (*FreeCallbackFunc)(int32_t index, int32_t uid);
typedef int32_t (*RegisterChannelCallbackFunc)(int32_t index, int32_t channel,
HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify);
typedef void (*FreeChannelCallbackFunc)(int32_t index, int32_t channel,
int32_t uid);
typedef int32_t (*RegisterCallbackNoIndexFunc)(HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify);
typedef void (*FreeCallbackNoIndexFunc)(int32_t uid);
using RegisterCallbackFunc = int32_t (*)(int32_t index,
HAL_NotifyCallback callback,
void* param, HAL_Bool initialNotify);
using FreeCallbackFunc = void (*)(int32_t index, int32_t uid);
using RegisterChannelCallbackFunc = int32_t (*)(int32_t index, int32_t channel,
HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify);
using FreeChannelCallbackFunc = void (*)(int32_t index, int32_t channel,
int32_t uid);
using RegisterCallbackNoIndexFunc = int32_t (*)(HAL_NotifyCallback callback,
void* param,
HAL_Bool initialNotify);
using FreeCallbackNoIndexFunc = void (*)(int32_t uid);
SIM_JniHandle AllocateCallback(JNIEnv* env, jint index, jobject callback,
jboolean initialNotify,

View File

@@ -32,9 +32,9 @@ class ConstBufferCallbackStore {
void InitializeConstBufferStore();
typedef int32_t (*RegisterConstBufferCallbackFunc)(
int32_t index, HAL_ConstBufferCallback callback, void* param);
typedef void (*FreeConstBufferCallbackFunc)(int32_t index, int32_t uid);
using RegisterConstBufferCallbackFunc =
int32_t (*)(int32_t index, HAL_ConstBufferCallback callback, void* param);
using FreeConstBufferCallbackFunc = void (*)(int32_t index, int32_t uid);
SIM_JniHandle AllocateConstBufferCallback(
JNIEnv* env, jint index, jobject callback,

View File

@@ -206,10 +206,10 @@ static hal::UnlimitedHandleResource<SIM_JniHandle, DeviceCallbackStore,
deviceCallbackHandles;
namespace {
typedef int32_t (*RegisterDeviceCallbackFunc)(const char* prefix, void* param,
HALSIM_SimDeviceCallback callback,
HAL_Bool initialNotify);
typedef void (*FreeDeviceCallbackFunc)(int32_t uid);
using RegisterDeviceCallbackFunc =
int32_t (*)(const char* prefix, void* param,
HALSIM_SimDeviceCallback callback, HAL_Bool initialNotify);
using FreeDeviceCallbackFunc = void (*)(int32_t uid);
} // namespace
static SIM_JniHandle AllocateDeviceCallback(
@@ -260,7 +260,7 @@ static hal::UnlimitedHandleResource<SIM_JniHandle, ValueCallbackStore,
valueCallbackHandles;
namespace {
typedef void (*FreeValueCallbackFunc)(int32_t uid);
using FreeValueCallbackFunc = void (*)(int32_t uid);
} // namespace
template <typename THandle>

View File

@@ -33,9 +33,9 @@ class SpiReadAutoReceiveBufferCallbackStore {
void InitializeSpiBufferStore();
typedef int32_t (*RegisterSpiBufferCallbackFunc)(
using RegisterSpiBufferCallbackFunc = int32_t (*)(
int32_t index, HAL_SpiReadAutoReceiveBufferCallback callback, void* param);
typedef void (*FreeSpiBufferCallbackFunc)(int32_t index, int32_t uid);
using FreeSpiBufferCallbackFunc = void (*)(int32_t index, int32_t uid);
SIM_JniHandle AllocateSpiBufferCallback(
JNIEnv* env, jint index, jobject callback,

View File

@@ -51,8 +51,8 @@ template <typename Derived, typename TUserInfo,
class CallbackThread : public wpi::SafeThread {
public:
typedef TUserInfo UserInfo;
typedef TNotifierData NotifierData;
typedef TListenerData ListenerData;
using NotifierData = TNotifierData;
using ListenerData = TListenerData;
~CallbackThread() {
// Wake up any blocked pollers

View File

@@ -39,11 +39,10 @@ class NetworkConnection : public INetworkConnection {
std::function<std::shared_ptr<Message>()> get_msg,
std::function<void(wpi::ArrayRef<std::shared_ptr<Message>>)> send_msgs)>
HandshakeFunc;
typedef std::function<void(std::shared_ptr<Message> msg,
NetworkConnection* conn)>
ProcessIncomingFunc;
typedef std::vector<std::shared_ptr<Message>> Outgoing;
typedef wpi::ConcurrentQueue<Outgoing> OutgoingQueue;
using ProcessIncomingFunc =
std::function<void(std::shared_ptr<Message>, NetworkConnection*)>;
using Outgoing = std::vector<std::shared_ptr<Message>>;
using OutgoingQueue = wpi::ConcurrentQueue<Outgoing>;
NetworkConnection(unsigned int uid,
std::unique_ptr<wpi::NetworkStream> stream,

View File

@@ -190,11 +190,11 @@ class Storage : public IStorage {
};
typedef wpi::StringMap<Entry*> EntriesMap;
typedef std::vector<Entry*> IdMap;
typedef std::vector<std::unique_ptr<Entry>> LocalMap;
typedef std::pair<unsigned int, unsigned int> RpcIdPair;
typedef wpi::DenseMap<RpcIdPair, std::string> RpcResultMap;
typedef wpi::SmallSet<RpcIdPair, 12> RpcBlockingCallSet;
using IdMap = std::vector<Entry*>;
using LocalMap = std::vector<std::unique_ptr<Entry>>;
using RpcIdPair = std::pair<unsigned int, unsigned int>;
using RpcResultMap = wpi::DenseMap<RpcIdPair, std::string>;
using RpcBlockingCallSet = wpi::SmallSet<RpcIdPair, 12>;
mutable wpi::mutex m_mutex;
EntriesMap m_entries;

View File

@@ -21,7 +21,7 @@ namespace {
class LoadPersistentImpl {
public:
typedef std::pair<std::string, std::shared_ptr<Value>> Entry;
typedef std::function<void(size_t line, const char* msg)> WarnFunc;
using WarnFunc = std::function<void(size_t, const char*)>;
LoadPersistentImpl(wpi::raw_istream& is, WarnFunc warn)
: m_is(is), m_warn(warn) {}

View File

@@ -777,9 +777,8 @@ bool WaitForEntryListenerQueue(NT_Inst inst, double timeout);
* @param connected true if event is due to connection being established
* @param conn connection info
*/
typedef std::function<void(NT_ConnectionListener conn_listener, bool connected,
const ConnectionInfo& conn)>
ConnectionListenerCallback;
using ConnectionListenerCallback =
std::function<void(NT_ConnectionListener, bool, const ConnectionInfo&)>;
/**
* Add a connection listener.
@@ -1481,9 +1480,8 @@ uint64_t Now();
* @param line origin source line number
* @param msg message
*/
typedef std::function<void(unsigned int level, const char* file,
unsigned int line, const char* msg)>
LogFunc;
using LogFunc =
std::function<void(unsigned int, const char*, unsigned int, const char*)>;
/**
* Set logger callback function. By default, log messages are sent to stderr;

View File

@@ -15,10 +15,10 @@ namespace sim {
using NotifyCallback = std::function<void(wpi::StringRef, const HAL_Value*)>;
using ConstBufferCallback = std::function<void(
wpi::StringRef, const unsigned char* buffer, unsigned int count)>;
typedef void (*CancelCallbackFunc)(int32_t index, int32_t uid);
typedef void (*CancelCallbackNoIndexFunc)(int32_t uid);
typedef void (*CancelCallbackChannelFunc)(int32_t index, int32_t channel,
int32_t uid);
using CancelCallbackFunc = void (*)(int32_t index, int32_t uid);
using CancelCallbackNoIndexFunc = void (*)(int32_t uid);
using CancelCallbackChannelFunc = void (*)(int32_t index, int32_t channel,
int32_t uid);
void CallbackStoreThunk(const char* name, void* param, const HAL_Value* value);
void ConstBufferCallbackStoreThunk(const char* name, void* param,

View File

@@ -3093,7 +3093,7 @@ TEST_F(CompileTimeArithmetic, unit_value_t) {
}
TEST_F(CompileTimeArithmetic, is_unit_value_t) {
typedef unit_value_t<meters, 3, 2> mRatio;
using mRatio = unit_value_t<meters, 3, 2>;
EXPECT_TRUE((traits::is_unit_value_t<mRatio>::value));
EXPECT_FALSE((traits::is_unit_value_t<meter_t>::value));
@@ -3105,7 +3105,7 @@ TEST_F(CompileTimeArithmetic, is_unit_value_t) {
}
TEST_F(CompileTimeArithmetic, is_unit_value_t_category) {
typedef unit_value_t<feet, 3, 2> mRatio;
using mRatio = unit_value_t<feet, 3, 2>;
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, mRatio>::value));
EXPECT_FALSE(
@@ -3117,14 +3117,14 @@ TEST_F(CompileTimeArithmetic, is_unit_value_t_category) {
}
TEST_F(CompileTimeArithmetic, unit_value_add) {
typedef unit_value_t<meters, 3, 2> mRatio;
using mRatio = unit_value_t<meters, 3, 2>;
using sum = unit_value_add<mRatio, mRatio>;
EXPECT_EQ(meter_t(3.0), sum::value());
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, sum>::value));
typedef unit_value_t<feet, 1> ftRatio;
using ftRatio = unit_value_t<feet, 1>;
using sumf = unit_value_add<ftRatio, mRatio>;
EXPECT_TRUE((
@@ -3134,8 +3134,8 @@ TEST_F(CompileTimeArithmetic, unit_value_add) {
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, sumf>::value));
typedef unit_value_t<celsius, 1> cRatio;
typedef unit_value_t<fahrenheit, 2> fRatio;
using cRatio = unit_value_t<celsius, 1>;
using fRatio = unit_value_t<fahrenheit, 2>;
using sumc = unit_value_add<cRatio, fRatio>;
EXPECT_TRUE((
@@ -3145,8 +3145,8 @@ TEST_F(CompileTimeArithmetic, unit_value_add) {
EXPECT_TRUE((traits::is_unit_value_t_category<category::temperature_unit,
sumc>::value));
typedef unit_value_t<angle::radian, 1> rRatio;
typedef unit_value_t<angle::degree, 3> dRatio;
using rRatio = unit_value_t<angle::radian, 1>;
using dRatio = unit_value_t<angle::degree, 3>;
using sumr = unit_value_add<rRatio, dRatio>;
EXPECT_TRUE((
@@ -3158,14 +3158,14 @@ TEST_F(CompileTimeArithmetic, unit_value_add) {
}
TEST_F(CompileTimeArithmetic, unit_value_subtract) {
typedef unit_value_t<meters, 3, 2> mRatio;
using mRatio = unit_value_t<meters, 3, 2>;
using diff = unit_value_subtract<mRatio, mRatio>;
EXPECT_EQ(meter_t(0), diff::value());
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, diff>::value));
typedef unit_value_t<feet, 1> ftRatio;
using ftRatio = unit_value_t<feet, 1>;
using difff = unit_value_subtract<ftRatio, mRatio>;
EXPECT_TRUE((std::is_same<
@@ -3175,8 +3175,8 @@ TEST_F(CompileTimeArithmetic, unit_value_subtract) {
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, difff>::value));
typedef unit_value_t<celsius, 1> cRatio;
typedef unit_value_t<fahrenheit, 2> fRatio;
using cRatio = unit_value_t<celsius, 1>;
using fRatio = unit_value_t<fahrenheit, 2>;
using diffc = unit_value_subtract<cRatio, fRatio>;
EXPECT_TRUE((std::is_same<
@@ -3186,8 +3186,8 @@ TEST_F(CompileTimeArithmetic, unit_value_subtract) {
EXPECT_TRUE((traits::is_unit_value_t_category<category::temperature_unit,
diffc>::value));
typedef unit_value_t<angle::radian, 1> rRatio;
typedef unit_value_t<angle::degree, 3> dRatio;
using rRatio = unit_value_t<angle::radian, 1>;
using dRatio = unit_value_t<angle::degree, 3>;
using diffr = unit_value_subtract<rRatio, dRatio>;
EXPECT_TRUE((std::is_same<
@@ -3199,8 +3199,8 @@ TEST_F(CompileTimeArithmetic, unit_value_subtract) {
}
TEST_F(CompileTimeArithmetic, unit_value_multiply) {
typedef unit_value_t<meters, 2> mRatio;
typedef unit_value_t<feet, 656168, 100000> ftRatio; // 2 meter
using mRatio = unit_value_t<meters, 2>;
using ftRatio = unit_value_t<feet, 656168, 100000>; // 2 meter
using product = unit_value_multiply<mRatio, mRatio>;
EXPECT_EQ(square_meter_t(4), product::value());
@@ -3233,7 +3233,7 @@ TEST_F(CompileTimeArithmetic, unit_value_multiply) {
EXPECT_TRUE((
traits::is_unit_value_t_category<category::area_unit, productF2>::value));
typedef unit_value_t<units::force::newton, 5> nRatio;
using nRatio = unit_value_t<units::force::newton, 5>;
using productN = unit_value_multiply<nRatio, ftRatio>;
EXPECT_FALSE(
@@ -3249,8 +3249,8 @@ TEST_F(CompileTimeArithmetic, unit_value_multiply) {
EXPECT_TRUE((traits::is_unit_value_t_category<category::torque_unit,
productN>::value));
typedef unit_value_t<angle::radian, 11, 10> r1Ratio;
typedef unit_value_t<angle::radian, 22, 10> r2Ratio;
using r1Ratio = unit_value_t<angle::radian, 11, 10>;
using r2Ratio = unit_value_t<angle::radian, 22, 10>;
using productR = unit_value_multiply<r1Ratio, r2Ratio>;
EXPECT_TRUE((std::is_same<
@@ -3265,8 +3265,8 @@ TEST_F(CompileTimeArithmetic, unit_value_multiply) {
}
TEST_F(CompileTimeArithmetic, unit_value_divide) {
typedef unit_value_t<meters, 2> mRatio;
typedef unit_value_t<feet, 656168, 100000> ftRatio; // 2 meter
using mRatio = unit_value_t<meters, 2>;
using ftRatio = unit_value_t<feet, 656168, 100000>; // 2 meter
using product = unit_value_divide<mRatio, mRatio>;
EXPECT_EQ(scalar_t(1), product::value());
@@ -3299,7 +3299,7 @@ TEST_F(CompileTimeArithmetic, unit_value_divide) {
EXPECT_TRUE((traits::is_unit_value_t_category<category::scalar_unit,
productF2>::value));
typedef unit_value_t<seconds, 10> sRatio;
using sRatio = unit_value_t<seconds, 10>;
using productMS = unit_value_divide<mRatio, sRatio>;
EXPECT_TRUE(
@@ -3310,7 +3310,7 @@ TEST_F(CompileTimeArithmetic, unit_value_divide) {
EXPECT_TRUE((traits::is_unit_value_t_category<category::velocity_unit,
productMS>::value));
typedef unit_value_t<angle::radian, 20> rRatio;
using rRatio = unit_value_t<angle::radian, 20>;
using productRS = unit_value_divide<rRatio, sRatio>;
EXPECT_TRUE(
@@ -3326,7 +3326,7 @@ TEST_F(CompileTimeArithmetic, unit_value_divide) {
}
TEST_F(CompileTimeArithmetic, unit_value_power) {
typedef unit_value_t<meters, 2> mRatio;
using mRatio = unit_value_t<meters, 2>;
using sq = unit_value_power<mRatio, 2>;
EXPECT_TRUE((std::is_convertible<
@@ -3336,7 +3336,7 @@ TEST_F(CompileTimeArithmetic, unit_value_power) {
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::area_unit, sq>::value));
typedef unit_value_t<angle::radian, 18, 10> rRatio;
using rRatio = unit_value_t<angle::radian, 18, 10>;
using sqr = unit_value_power<rRatio, 2>;
EXPECT_TRUE((std::is_convertible<
@@ -3350,7 +3350,7 @@ TEST_F(CompileTimeArithmetic, unit_value_power) {
}
TEST_F(CompileTimeArithmetic, unit_value_sqrt) {
typedef unit_value_t<square_meters, 10> mRatio;
using mRatio = unit_value_t<square_meters, 10>;
using root = unit_value_sqrt<mRatio>;
EXPECT_TRUE((std::is_convertible<
@@ -3360,7 +3360,7 @@ TEST_F(CompileTimeArithmetic, unit_value_sqrt) {
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, root>::value));
typedef unit_value_t<hectare, 51, 7> hRatio;
using hRatio = unit_value_t<hectare, 51, 7>;
using rooth = unit_value_sqrt<hRatio, 100000000>;
EXPECT_TRUE((std::is_convertible<
@@ -3372,7 +3372,7 @@ TEST_F(CompileTimeArithmetic, unit_value_sqrt) {
EXPECT_TRUE(
(traits::is_unit_value_t_category<category::length_unit, rooth>::value));
typedef unit_value_t<steradian, 18, 10> rRatio;
using rRatio = unit_value_t<steradian, 18, 10>;
using rootr = unit_value_sqrt<rRatio>;
EXPECT_TRUE((traits::is_angle_unit<decltype(rootr::value())>::value));