Fix a couple of ordinary and pedantic warnings

Add previously missing -Wall to warning flags in CMake. Remove -Wformat
and -Wvariadic-macros (enabled by default; latter is not meaningful in
C99 mode we use), -Wdeclaration-after-statement (again, not needed as
we use C99). Move -Wmissing-declarations to C-only flags (GCC man says
so).

Add copyrights year to crypto-utils-fallback.c.
This commit is contained in:
Mike Gelfand
2014-12-11 05:11:02 +00:00
parent bb09ad5a50
commit fed15dc29d
9 changed files with 25 additions and 18 deletions

View File

@@ -271,25 +271,28 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
set(NEEDED_COMPILER_FLAGS
-Wall
-W
-Wcast-align
-Wextra
-Wfloat-equal
-Wformat
-Wformat-security
-Winit-self
-Winline
-Wmissing-declarations
-Wmissing-format-attribute
-Wpointer-arith
-Wredundant-decls
-Wundef
-Wunused-parameter
-Wvariadic-macros
-Wwrite-strings)
if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_VERSION VERSION_GREATER "3.3")
list(APPEND NEEDED_COMPILER_FLAGS
-Wextra
-Winit-self)
endif()
set(NEEDED_C_COMPILER_FLAGS
${NEEDED_COMPILER_FLAGS}
-Wdeclaration-after-statement
-Wmissing-declarations
-Wnested-externs
-Wstrict-prototypes)
string(REPLACE ";" " " NEEDED_C_COMPILER_FLAGS_STRING "${NEEDED_C_COMPILER_FLAGS}")

View File

@@ -1,5 +1,5 @@
/*
* This file Copyright (C) Mnemosyne LLC
* This file Copyright (C) 2014 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.

View File

@@ -46,8 +46,12 @@
#endif
#ifdef __APPLE__
#define HAVE_SYS_STATVFS_H
#define HAVE_STATVFS
#ifndef HAVE_SYS_STATVFS_H
#define HAVE_SYS_STATVFS_H
#endif
#ifndef HAVE_STATVFS
#define HAVE_STATVFS
#endif
#endif
#ifdef HAVE_SYS_STATVFS_H

View File

@@ -117,8 +117,8 @@ test_utf8 (void)
check_streq ("hello", out);
tr_free (out);
/* this version is not utf-8 */
in = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>";
/* this version is not utf-8 (but cp866) */
in = "\x92\xE0\xE3\xA4\xAD\xAE \xA1\xEB\xE2\xEC \x81\xAE\xA3\xAE\xAC";
out = tr_utf8clean (in, 17);
check (out != NULL);
check ((strlen (out) == 17) || (strlen (out) == 32));
@@ -126,7 +126,7 @@ test_utf8 (void)
tr_free (out);
/* same string, but utf-8 clean */
in = "Òðóäíî áûòü Áîãîì";
in = "Трудно быть Богом";
out = tr_utf8clean (in, -1);
check (out != NULL);
check (tr_utf8_validate (out, -1, NULL));

View File

@@ -84,12 +84,12 @@ namespace
MyApp :: MyApp (int& argc, char ** argv):
QApplication (argc, argv),
myLastFullUpdateTime (0),
myPrefs(nullptr),
mySession(nullptr),
myModel(nullptr),
myWindow(nullptr),
myWatchDir(nullptr)
myWatchDir(nullptr),
myLastFullUpdateTime (0)
{
const QString MY_CONFIG_NAME = QString::fromUtf8 ("transmission");

View File

@@ -21,7 +21,7 @@ class QUrl;
class Favicons: public QObject
{
Q_OBJECT;
Q_OBJECT
public:

View File

@@ -33,7 +33,7 @@ class QStyle;
class FileTreeItem: public QObject
{
Q_OBJECT;
Q_OBJECT
enum { LOW=(1<<0), NORMAL=(1<<1), HIGH=(1<<2) };

View File

@@ -27,7 +27,7 @@ extern "C"
class Prefs: public QObject
{
Q_OBJECT;
Q_OBJECT
public:

View File

@@ -115,7 +115,7 @@ Q_DECLARE_METATYPE(FileList)
class Torrent: public QObject
{
Q_OBJECT;
Q_OBJECT
public: