Skip to content

Commit

Permalink
Enable clang-tidy misc-static-assert (#32202)
Browse files Browse the repository at this point in the history
* Convert assert to static_assert

This is better when the condition is a compile-time constant.

* Enable misc-static-assert and cert-dcl03-c

Two clang-tidy names for the same check.
  • Loading branch information
jbytheway authored and ZhilkinSerg committed Jul 6, 2019
1 parent 40aed17 commit 595fee4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ readability-*,\
-bugprone-undefined-memory-manipulation,\
-bugprone-unused-return-value,\
-bugprone-use-after-move,\
-cert-dcl03-c,\
-cert-dcl16-c,\
-cert-dcl21-cpp,\
-cert-dcl50-cpp,\
Expand All @@ -42,7 +41,6 @@ readability-*,\
-misc-definitions-in-headers,\
-misc-non-private-member-variables-in-classes,\
-misc-redundant-expression,\
-misc-static-assert,\
-misc-unconventional-assign-operator,\
-modernize-avoid-c-arrays,\
-modernize-deprecated-headers,\
Expand Down
4 changes: 2 additions & 2 deletions src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2049,9 +2049,9 @@ bool advanced_inventory::query_destination( aim_location &def )
menu.pad_left = 9; /* free space for advanced_inventory::menu_square */

{
// the direction locations should be contiguous in the enum
std::vector <aim_location> ordered_locs;
assert( AIM_NORTHEAST - AIM_SOUTHWEST == 8 );
static_assert( AIM_NORTHEAST - AIM_SOUTHWEST == 8,
"Expected 9 contiguous directions in the aim_location enum" );
for( int i = AIM_SOUTHWEST; i <= AIM_NORTHEAST; i++ ) {
ordered_locs.push_back( screen_relative_location( static_cast <aim_location>( i ) ) );
}
Expand Down

0 comments on commit 595fee4

Please sign in to comment.