From 4adbbefabd7e770c59bbc0a554a582ea5974320e Mon Sep 17 00:00:00 2001 From: Sebastian Hiebl Date: Sun, 5 Nov 2023 19:31:54 +0100 Subject: [PATCH] fix clang warning --- CMakeLists.txt | 2 ++ src/NcWindow.hpp | 27 +++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fcce98..72bd77d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ project(jess) include(CTest) set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") diff --git a/src/NcWindow.hpp b/src/NcWindow.hpp index 5c093e2..0741402 100644 --- a/src/NcWindow.hpp +++ b/src/NcWindow.hpp @@ -38,14 +38,19 @@ class NcWindow { [[nodiscard]] size_t cursorPosX() const { return getcurx(handle.get()); } void setKeypad(bool bEnable) { NC_CHECK_RC(::keypad(handle.get(), bEnable)); } void move(size_t uPosY, size_t uPosX) { NC_CHECK_RC(::wmove(handle.get(), uPosY, uPosX)); } - template void printw(const char *formatStr, Args... args) { - NC_CHECK_RC(::wprintw(handle.get(), formatStr, std::forward(args)...)); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-security" + void printw(const char *formatStr, auto... args) { + NC_CHECK_RC(::wprintw(handle.get(), formatStr, std::forward(args)...)); } +#pragma clang diagnostic pop + void clear() { NC_CHECK_RC(::wclear(handle.get())); } void clearToEol() { -// if(cursorPosX() + 10 >= width()) { -// return; -// } + // if(cursorPosX() + 10 >= width()) { + // return; + // } ::wclrtoeol(handle.get()); } void clearToBot() { NC_CHECK_RC(::wclrtobot(handle.get())); } @@ -59,15 +64,9 @@ class NcWindow { ret.resize(uActualLength); return ret; } - void setNodelay(bool bNodelay) { - ::nodelay(handle.get(), bNodelay); - } - void enableAttributes(int attributes) { - NC_CHECK_RC(::wattron(handle.get(), attributes)); - } - void disableAttributes(int attributes) { - NC_CHECK_RC(::wattroff(handle.get(), attributes)); - } + void setNodelay(bool bNodelay) { ::nodelay(handle.get(), bNodelay); } + void enableAttributes(int attributes) { NC_CHECK_RC(::wattron(handle.get(), attributes)); } + void disableAttributes(int attributes) { NC_CHECK_RC(::wattroff(handle.get(), attributes)); } }; } // namespace jess