From bc007f5291015621514e7a3727a0be53551e6bec Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Fri, 10 Aug 2018 20:52:19 +0000 Subject: [PATCH] smartctl.cpp, os_win32/wmiquery.h: Add missing printf() format checks. This also silences -Wformat-nonliteral warnings from clang++ 5.0. git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@4751 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/ChangeLog | 3 +++ smartmontools/os_win32/wmiquery.h | 8 +++++--- smartmontools/smartctl.cpp | 7 ++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog index 35095af12..d5fd26385 100644 --- a/smartmontools/ChangeLog +++ b/smartmontools/ChangeLog @@ -2,6 +2,9 @@ $Id$ 2018-08-10 Christian Franke <franke@computer.org> + smartctl.cpp, os_win32/wmiquery.h: Add missing printf() format checks. + This also silences -Wformat-nonliteral warnings from clang++ 5.0. + os_win32.cpp: Increase IOCTL_ATA_PASS_THROUGH timeout to 60 seconds. 2018-08-10 Zhdan Bybin <zhdan.bybin@intel.com> diff --git a/smartmontools/os_win32/wmiquery.h b/smartmontools/os_win32/wmiquery.h index 408fd171c..5db0e0736 100644 --- a/smartmontools/os_win32/wmiquery.h +++ b/smartmontools/os_win32/wmiquery.h @@ -3,7 +3,7 @@ * * Home page of code is: http://www.smartmontools.org * - * Copyright (C) 2011-15 Christian Franke + * Copyright (C) 2011-18 Christian Franke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -168,11 +168,13 @@ public: /// Execute query, get result list. /// Return false on error. - bool vquery(wbem_enumerator & result, const char * qstr, va_list args) /*const*/; + bool vquery(wbem_enumerator & result, const char * qstr, va_list args) /*const*/ + __attribute_format_printf(3, 0); /// Execute query, get single result object. /// Return false on error or result size != 1. - bool vquery1(wbem_object & obj, const char * qstr, va_list args) /*const*/; + bool vquery1(wbem_object & obj, const char * qstr, va_list args) /*const*/ + __attribute_format_printf(3, 0); /// Version of vquery() with printf() formatting. bool query(wbem_enumerator & result, const char * qstr, ...) /*const*/ diff --git a/smartmontools/smartctl.cpp b/smartmontools/smartctl.cpp index 3747ed779..a4e07fa73 100644 --- a/smartmontools/smartctl.cpp +++ b/smartmontools/smartctl.cpp @@ -1278,6 +1278,7 @@ static const char * parse_options(int argc, char** argv, // Printing functions +__attribute_format_printf(3, 0) static void vjpout(bool is_js_impl, const char * msg_severity, const char *fmt, va_list ap) { @@ -1330,7 +1331,7 @@ static void vjpout(bool is_js_impl, const char * msg_severity, // Default: print to stdout // --json: ignore -// --json=a: append to "output" array +// --json=o: append to "output" array // --json=u: add "smartctl_NNNN_u" element(s) void pout(const char *fmt, ...) { @@ -1348,7 +1349,7 @@ void pout(const char *fmt, ...) // Default: Print to stdout // --json: ignore -// --json=a: append to "output" array +// --json=o: append to "output" array // --json=i: add "smartctl_NNNN_i" element(s) void jout(const char *fmt, ...) { @@ -1366,7 +1367,7 @@ void jout(const char *fmt, ...) // Default: print to stdout // --json: append to "messages" -// --json=a: append to "output" array +// --json=o: append to "output" array // --json=i: add "smartctl_NNNN_i" element(s) void jinf(const char *fmt, ...) { -- GitLab