[wpilibc] Remove Utility.h (#3376)

Change last 2 uses of wpi_assert to throw error instead.
This commit is contained in:
Peter Johnson
2021-05-23 15:25:08 -07:00
committed by GitHub
parent 87384ea684
commit 2385c2a430
9 changed files with 5 additions and 183 deletions

View File

@@ -1,65 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// 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.
#pragma once
/**
* @file Contains global utility functions
*/
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#define wpi_assert(condition) \
wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__)
#define wpi_assertWithMessage(condition, message) \
wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, \
__FUNCTION__)
#define wpi_assertEqual(a, b) \
wpi_assertEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
#define wpi_assertEqualWithMessage(a, b, message) \
wpi_assertEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, __FUNCTION__)
#define wpi_assertNotEqual(a, b) \
wpi_assertNotEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
#define wpi_assertNotEqualWithMessage(a, b, message) \
wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \
__FUNCTION__)
/**
* Assert implementation.
*
* This allows breakpoints to be set on an assert. The users don't call this,
* but instead use the wpi_assert macros in Utility.h.
*/
bool wpi_assert_impl(bool conditionValue, const wpi::Twine& conditionText,
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName);
/**
* Assert equal implementation.
*
* This determines whether the two given integers are equal. If not, the value
* of each is printed along with an optional message string. The users don't
* call this, but instead use the wpi_assertEqual macros in Utility.h.
*/
bool wpi_assertEqual_impl(int valueA, int valueB,
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName);
/**
* Assert not equal implementation.
*
* This determines whether the two given integers are equal. If so, the value of
* each is printed along with an optional message string. The users don't call
* this, but instead use the wpi_assertNotEqual macros in Utility.h.
*/
bool wpi_assertNotEqual_impl(int valueA, int valueB,
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName);