Ignore GCC warnings.

* 4.9 missing initializer warnings
* pedantic for __int128 case
* Wrap diagnostic push and pop in tz.cpp and date.h.
This commit is contained in:
Florian Dang
2017-03-31 11:16:06 +02:00
committed by Howard Hinnant
parent f30450b4c5
commit c4c2550b29
2 changed files with 27 additions and 20 deletions

26
date.h
View File

@@ -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 <utility>
#include <type_traits>
#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 <class T>
struct choose_trunc_type
{
@@ -929,10 +933,6 @@ struct choose_trunc_type
>::type;
};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
template <class T>
CONSTCD11
inline
@@ -6590,4 +6590,10 @@ parse(const CharT* format, Parsable& tp,
} // namespace date
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
#endif // DATE_H

21
tz.cpp
View File

@@ -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