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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
set(NEEDED_COMPILER_FLAGS set(NEEDED_COMPILER_FLAGS
-Wall
-W
-Wcast-align -Wcast-align
-Wextra
-Wfloat-equal -Wfloat-equal
-Wformat
-Wformat-security -Wformat-security
-Winit-self
-Winline -Winline
-Wmissing-declarations
-Wmissing-format-attribute -Wmissing-format-attribute
-Wpointer-arith -Wpointer-arith
-Wredundant-decls -Wredundant-decls
-Wundef -Wundef
-Wunused-parameter -Wunused-parameter
-Wvariadic-macros
-Wwrite-strings) -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 set(NEEDED_C_COMPILER_FLAGS
${NEEDED_COMPILER_FLAGS} ${NEEDED_COMPILER_FLAGS}
-Wdeclaration-after-statement -Wmissing-declarations
-Wnested-externs -Wnested-externs
-Wstrict-prototypes) -Wstrict-prototypes)
string(REPLACE ";" " " NEEDED_C_COMPILER_FLAGS_STRING "${NEEDED_C_COMPILER_FLAGS}") 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 * It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC. * or any future license endorsed by Mnemosyne LLC.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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