Skip to content

Commit

Permalink
Use clang-tidy 7 [skip appveyor]
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelkryukov authored Aug 30, 2018
1 parent 51de9e1 commit 12984c6
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
Checks: '*,-*braces-around-statements,-cppcoreguidelines-pro-type-union-access,-llvm-header-guard,-cert-err58-cpp,-fuchsia-default-arguments,-fuchsia-overloaded-operator'
Checks: '*,-*braces-around-statements,-cppcoreguidelines-pro-type-union-access,-llvm-header-guard,-cert-err58-cpp,-fuchsia-default-arguments,-fuchsia-overloaded-operator,-fuchsia-statically-constructed-objects'
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- sourceline: deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main
- sourceline: deb http://www.emdebian.org/debian/ squeeze main
update: true
packages:
- lcov
- g++-7
- clang-tidy-6.0
- libboost-program-options1.54-dev

install:
Expand Down Expand Up @@ -66,7 +64,8 @@ after_success:
- ./mipt-mips -b $TRAVIS_BUILD_DIR/traces/fib.out -n 1000000 # Run a trace to see simulation frequency
- |
if [ $CXX == clang++ ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
run-clang-tidy-6.0.py -header-filter='.*'
sudo apt-get install clang-tidy-7 --allow-unauthenticated
run-clang-tidy-7.py -header-filter='.*'
fi
- |
if [ $CXX == g++-7 ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
Expand Down
14 changes: 7 additions & 7 deletions simulator/infra/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BaseTValue : public BaseValue
friend std::ostream& operator<<( std::ostream& out, const BaseTValue& rhs)
{
if constexpr (std::is_same_v<T, bool>)
return out << std::boolalpha << rhs.value << std::noboolalpha; // NOLINT(misc-suspicious-semicolon)
return out << std::boolalpha << rhs.value << std::noboolalpha; // NOLINT(bugprone-suspicious-semicolon)

return out << std::dec << rhs.value;
}
Expand All @@ -53,7 +53,7 @@ class BaseTValue : public BaseValue
template<typename T>
struct AliasedRequiredValue : BaseTValue<T>
{
AliasedRequiredValue<T>( const std::string& alias, const std::string& name, const std::string& desc) noexcept
AliasedRequiredValue<T>( const std::string& alias, const std::string& name, const std::string& desc)
: BaseTValue<T>( )
{
this->options().template add<popl::Value<T>, popl::Attribute::required>(alias, name, desc, T(), &this->value);
Expand All @@ -63,7 +63,7 @@ struct AliasedRequiredValue : BaseTValue<T>
template<typename T>
struct AliasedValue : BaseTValue<T>
{
AliasedValue<T>( const std::string& alias, const std::string& name, const T& val, const std::string& desc) noexcept
AliasedValue<T>( const std::string& alias, const std::string& name, const T& val, const std::string& desc)
: BaseTValue<T>( val)
{
this->options().template add<popl::Value<T>>(alias, name, desc, val, &this->value);
Expand All @@ -72,7 +72,7 @@ struct AliasedValue : BaseTValue<T>

struct AliasedSwitch : BaseTValue<bool>
{
AliasedSwitch( const std::string& alias, const std::string& name, const std::string& desc) noexcept
AliasedSwitch( const std::string& alias, const std::string& name, const std::string& desc)
: BaseTValue<bool>( false)
{
options().add<popl::Switch>(alias, name, desc, &this->value);
Expand All @@ -82,22 +82,22 @@ struct AliasedSwitch : BaseTValue<bool>
template<typename T>
struct Value : AliasedValue<T>
{
Value( const std::string& name, const T& val, const std::string& desc) noexcept
Value( const std::string& name, const T& val, const std::string& desc)
: AliasedValue<T>( "", name, val, desc)
{ }
};

template<typename T>
struct RequiredValue : AliasedRequiredValue<T>
{
RequiredValue( const std::string& name, const std::string& desc) noexcept
RequiredValue( const std::string& name, const std::string& desc)
: AliasedRequiredValue<T>( "", name, desc)
{ }
};

struct Switch : AliasedSwitch
{
Switch( const std::string& name, const std::string& desc) noexcept
Switch( const std::string& name, const std::string& desc)
: AliasedSwitch( "", name, desc)
{ }
};
Expand Down
2 changes: 1 addition & 1 deletion simulator/infra/macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static constexpr T arithmetic_rs(const T& value, size_t shamt)
if constexpr ((static_cast<ST>(-2) >> 1u) == static_cast<ST>(-1))
// Compiler does arithmetic shift for signed values, trust it
// Clang warns about implementation defined code, but we ignore that
// NOLINTNEXTLINE(hicpp-signed-bitwise, misc-suspicious-semicolon)
// NOLINTNEXTLINE(hicpp-signed-bitwise, bugprone-suspicious-semicolon)
return static_cast<ST>(value) >> shamt;

return (value & msb_set<T>()) == 0 // check MSB
Expand Down
8 changes: 4 additions & 4 deletions simulator/infra/memory/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ T FuncMemory::read( Addr addr, T mask) const
if (( mask & 0xFFu) == 0xFFu)
value |= static_cast<T>(static_cast<T>(check_and_read_byte( addr + i)) << (i * 8));
if constexpr ( bitwidth<T> > 8)
mask >>= 8u; // NOLINT(misc-suspicious-semicolon)
mask >>= 8u; // NOLINT(bugprone-suspicious-semicolon)
}

return value;
Expand All @@ -113,9 +113,9 @@ void FuncMemory::write( T value, Addr addr, T mask)
for ( size_t i = 0; i < bitwidth<T> / 8; ++i) {
if ((mask & 0xFFu) == 0xFFu)
alloc_and_write_byte( addr + i, static_cast<Byte>( static_cast<uint8>( value & 0xFFu)));
if constexpr ( bitwidth<T> > 8) { // NOLINT(misc-suspicious-semicolon)
mask >>= 8;
value >>= 8;
if constexpr ( bitwidth<T> > 8) { // NOLINT(bugprone-suspicious-semicolon)
mask >>= 8u;
value >>= 8u;
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions simulator/infra/ports/t/unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ namespace ports {
void process_data ( int data, Cycle cycle);
};




static Logic logic{};
} // namespace testing
} // namespace ports
Expand Down
2 changes: 1 addition & 1 deletion simulator/mips/mips_instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ auto mips_division(T x, T y) {
if ( y == 0)
return ReturnType();

if constexpr( !std::is_same_v<T, unsign_t<T>>) // signed type NOLINTNEXTLINE(misc-suspicious-semicolon)
if constexpr( !std::is_same_v<T, unsign_t<T>>) // signed type NOLINTNEXTLINE(bugprone-suspicious-semicolon)
if ( y == -1 && x == static_cast<T>(msb_set<unsign_t<T>>())) // x86 has an exception here
return ReturnType();

Expand Down
2 changes: 1 addition & 1 deletion simulator/modules/fetch/bpu/bpentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class BPEntryAdaptive final : public BPEntry
void update( bool is_taken)
{
/* updating pattern, simulating shift register */
value <<= 1;
value <<= 1u;
value += static_cast<uint32>( is_taken);
value &= pattern_mask;
}
Expand Down

0 comments on commit 12984c6

Please sign in to comment.