From d56df58f3fd81d890fd83ce235d9bc5369ccaea9 Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Thu, 15 Oct 2020 06:07:48 +0900 Subject: [PATCH] kernel: Fix -Wformat-security MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie07933315c055ba1e6896e0bf69b12bb6bec62f9 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3343 Reviewed-by: Jérôme Duval --- src/system/kernel/debug/debug_variables.cpp | 6 +++--- src/system/kernel/util/kernel_cpp.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/debug/debug_variables.cpp b/src/system/kernel/debug/debug_variables.cpp index 92ae27c820..52b5b5df7a 100644 --- a/src/system/kernel/debug/debug_variables.cpp +++ b/src/system/kernel/debug/debug_variables.cpp @@ -180,7 +180,7 @@ get_variable(const char* variableName, bool create) static int cmd_unset_variable(int argc, char **argv) { - static const char* usage = "usage: unset \n" + static const char* const usage = "usage: unset \n" "Unsets the given variable, if it exists.\n"; if (argc != 2 || strcmp(argv[1], "--help") == 0) { kprintf(usage); @@ -199,7 +199,7 @@ cmd_unset_variable(int argc, char **argv) static int cmd_unset_all_variables(int argc, char **argv) { - static const char* usage = "usage: %s\n" + static const char* const usage = "usage: %s\n" "Unsets all variables.\n"; if (argc == 2 && strcmp(argv[1], "--help") == 0) { kprintf(usage, argv[0]); @@ -215,7 +215,7 @@ cmd_unset_all_variables(int argc, char **argv) static int cmd_variables(int argc, char **argv) { - static const char* usage = "usage: vars\n" + static const char* const usage = "usage: vars\n" "Unsets the given variable, if it exists.\n"; if (argc != 1) { kprintf(usage); diff --git a/src/system/kernel/util/kernel_cpp.cpp b/src/system/kernel/util/kernel_cpp.cpp index db28cb958f..6de5e6948b 100644 --- a/src/system/kernel/util/kernel_cpp.cpp +++ b/src/system/kernel/util/kernel_cpp.cpp @@ -392,7 +392,10 @@ extern "C" void debugger(const char *message) { +// this is a wrapper, disable format diagnostics. +#pragma GCC diagnostic ignored "-Wformat-security" kernel_debugger(message); +#pragma GCC diagnostic pop } #endif // #ifndef _BOOT_MODE