From c4c2550b296a8d2e45a4b5148c1ed3464c6e7938 Mon Sep 17 00:00:00 2001 From: Florian Dang Date: Fri, 31 Mar 2017 11:16:06 +0200 Subject: [PATCH] Ignore GCC warnings. * 4.9 missing initializer warnings * pedantic for __int128 case * Wrap diagnostic push and pop in tz.cpp and date.h. --- date.h | 26 ++++++++++++++++---------- tz.cpp | 21 +++++++++++---------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/date.h b/date.h index dc7fadf..9bfa5f0 100644 --- a/date.h +++ b/date.h @@ -5,6 +5,7 @@ // // Copyright (c) 2015, 2016, 2017 Howard Hinnant // Copyright (c) 2016 Adrian Colomitchi +// Copyright (c) 2017 Florian Dang // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -50,6 +51,15 @@ #include #include +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +# if __GNUC__ < 5 + // GCC 4.9 Bug 61489 Wrong warning with -Wmissing-field-initializers +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +# endif +#endif + namespace date { @@ -902,12 +912,6 @@ public: {} }; -#ifdef __GNUC__ -// GCC complains about __int128 with -pedantic or -pedantic-errors -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#endif - template struct choose_trunc_type { @@ -929,10 +933,6 @@ struct choose_trunc_type >::type; }; -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - template CONSTCD11 inline @@ -6590,4 +6590,10 @@ parse(const CharT* format, Parsable& tp, } // namespace date + +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif + + #endif // DATE_H diff --git a/tz.cpp b/tz.cpp index 83430a9..328736d 100644 --- a/tz.cpp +++ b/tz.cpp @@ -141,6 +141,12 @@ static CONSTDATA char folder_delimiter = '/'; #endif +#if __GNUC__ < 5 +// GCC 4.9 Bug 61489 Wrong warning with -Wmissing-field-initializers +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + #ifdef _WIN32 namespace @@ -3100,12 +3106,6 @@ current_zone() #else // !WIN32 -#ifdef __GNUC__ -// GCC complains about unused return from strerror_r -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-result" -#endif - const time_zone* current_zone() { @@ -3183,10 +3183,6 @@ current_zone() throw std::runtime_error("Could not get current timezone"); } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - #endif // !WIN32 #if defined(TZ_TEST) && defined(TIMEZONE_MAPPING) @@ -3208,4 +3204,9 @@ locate_native_zone(const std::string& native_tz_name) #endif // TZ_TEST && TIMEZONE_MAPPING + } // namespace date + +#if __GNUC__ < 5 +# pragma GCC diagnostic pop +#endif