mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:50:09 +08:00
Add -Wuseless-cast to FTXUI_DEV_WARNINGS (#728)
Add the -Wuseless-cast to the FTXUI_DEV_WARNINGS and fix the compiler complaints about useless casts
This commit is contained in:
parent
1e6df78ec2
commit
eb9a701fd7
@ -77,6 +77,10 @@ function(ftxui_set_options library)
|
|||||||
target_compile_options(${library} PRIVATE "-Wpedantic")
|
target_compile_options(${library} PRIVATE "-Wpedantic")
|
||||||
target_compile_options(${library} PRIVATE "-Wshadow")
|
target_compile_options(${library} PRIVATE "-Wshadow")
|
||||||
target_compile_options(${library} PRIVATE "-Wunused")
|
target_compile_options(${library} PRIVATE "-Wunused")
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(${library} PRIVATE "-Wuseless-cast")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ class ContainerBase : public ComponentBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (size_t offset = 1; offset < children_.size(); ++offset) {
|
for (size_t offset = 1; offset < children_.size(); ++offset) {
|
||||||
const size_t i = ((size_t(*selector_ + offset * dir + children_.size())) %
|
const size_t i =
|
||||||
children_.size());
|
(*selector_ + offset * dir + children_.size()) % children_.size();
|
||||||
if (children_[i]->Focusable()) {
|
if (children_[i]->Focusable()) {
|
||||||
*selector_ = int(i);
|
*selector_ = int(i);
|
||||||
return;
|
return;
|
||||||
|
@ -201,7 +201,7 @@ TerminalInputParser::Output TerminalInputParser::Parse() {
|
|||||||
// Then some sequences are illegal if it exist a shorter representation of the
|
// Then some sequences are illegal if it exist a shorter representation of the
|
||||||
// same codepoint.
|
// same codepoint.
|
||||||
TerminalInputParser::Output TerminalInputParser::ParseUTF8() {
|
TerminalInputParser::Output TerminalInputParser::ParseUTF8() {
|
||||||
auto head = static_cast<unsigned char>(Current());
|
auto head = Current();
|
||||||
unsigned char selector = 0b1000'0000; // NOLINT
|
unsigned char selector = 0b1000'0000; // NOLINT
|
||||||
|
|
||||||
// The non code-point part of the first byte.
|
// The non code-point part of the first byte.
|
||||||
@ -234,7 +234,7 @@ TerminalInputParser::Output TerminalInputParser::ParseUTF8() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Invalid continuation byte.
|
// Invalid continuation byte.
|
||||||
head = static_cast<unsigned char>(Current());
|
head = Current();
|
||||||
if ((head & 0b1100'0000) != 0b1000'0000) { // NOLINT
|
if ((head & 0b1100'0000) != 0b1000'0000) { // NOLINT
|
||||||
return DROP;
|
return DROP;
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ TerminalInputParser::Output TerminalInputParser::ParseCSI() {
|
|||||||
|
|
||||||
if (Current() >= '0' && Current() <= '9') {
|
if (Current() >= '0' && Current() <= '9') {
|
||||||
argument *= 10; // NOLINT
|
argument *= 10; // NOLINT
|
||||||
argument += int(Current() - '0');
|
argument += Current() - '0';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user