From 2d50984185c7902d37783a98f19637c86694a452 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 26 Oct 2018 01:18:54 +0100 Subject: Fix a bunch of harmless compiler warnings on recent GCC releases. --- make/template/main.mk | 2 +- src/command_parse.cpp | 2 +- src/configparser.cpp | 3 ++- src/modules/extra/m_geoip.cpp | 6 +++++- src/modules/extra/m_ssl_gnutls.cpp | 4 +++- src/modules/m_httpd.cpp | 6 +++++- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/make/template/main.mk b/make/template/main.mk index a67c14f73..74b5b066c 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -55,7 +55,7 @@ INSTMODE_LIB = 0640 ifneq ($(COMPILER), ICC) CORECXXFLAGS += -Woverloaded-virtual -Wshadow ifneq ($(SYSTEM), openbsd) - CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute + CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute -Wno-format-nonliteral endif endif diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d4dd7da21..c2ae39d49 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -452,7 +452,7 @@ void CommandParser::TranslateSingleParam(TranslateType to, const std::string& it } // If no custom translator was given, fall through } - case TR_TEXT: + /*@fallthrough@*/ default: /* Do nothing */ dest.append(item); diff --git a/src/configparser.cpp b/src/configparser.cpp index 825053044..437b3cdb0 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -286,7 +286,8 @@ struct Parser break; case 0xFE: case 0xFF: - stack.errstr << "Do not save your files as UTF-16; use ASCII!\n"; + stack.errstr << "Do not save your files as UTF-16 or UTF-32, use UTF-8!\n"; + /*@fallthrough@*/ default: throw CoreException("Syntax error - start of tag expected"); } diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index 6272a5c24..e4299a1c2 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -34,7 +34,11 @@ #if defined __clang__ # pragma clang diagnostic ignored "-Wc++11-extensions" #elif defined __GNUC__ -# pragma GCC diagnostic ignored "-pedantic" +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) +# pragma GCC diagnostic ignored "-Wpedantic" +# else +# pragma GCC diagnostic ignored "-pedantic" +# endif #endif #include diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 8bd73b2bb..f5711cbd7 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -41,7 +41,9 @@ #if defined __clang__ # pragma clang diagnostic ignored "-Wc++11-extensions" #elif defined __GNUC__ -# if __GNUC__ < 6 +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) +# pragma GCC diagnostic ignored "-Wpedantic" +# else # pragma GCC diagnostic ignored "-pedantic" # endif #endif diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index f67f4cb81..3a0d4f861 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -32,7 +32,11 @@ #if defined __clang__ # pragma clang diagnostic ignored "-Wc++11-extensions" #elif defined __GNUC__ -# pragma GCC diagnostic ignored "-pedantic" +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) +# pragma GCC diagnostic ignored "-Wpedantic" +# else +# pragma GCC diagnostic ignored "-pedantic" +# endif #endif // Fix warnings about shadowing in http_parser. -- cgit v1.2.3