Skip to content

Commit de80123

Browse files
authored
Ensure HAS_STRPTIME is defined by default (#331)
Builds now always have a default value of 0 or 1 for HAS_STRPTIME, but it can be overridden on the command-line. This is to address -Wundef warnings, and the feedback from #330.
1 parent 46d62c0 commit de80123

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/time_zone_format.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
// limitations under the License.
1414

1515
#if !defined(HAS_STRPTIME)
16-
# if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__VXWORKS__)
16+
# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__VXWORKS__)
17+
# define HAS_STRPTIME 0
18+
# else
1719
# define HAS_STRPTIME 1 // Assume everyone else has strptime().
1820
# endif
1921
#endif
2022

21-
#if defined(HAS_STRPTIME) && HAS_STRPTIME
23+
#if HAS_STRPTIME
2224
# if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
2325
# define _XOPEN_SOURCE 500 // Exposes definitions for SUSv2 (UNIX 98).
2426
# endif
@@ -39,7 +41,7 @@
3941
#include <limits>
4042
#include <string>
4143
#include <vector>
42-
#if !defined(HAS_STRPTIME)
44+
#if !HAS_STRPTIME
4345
#include <iomanip>
4446
#include <sstream>
4547
#endif
@@ -52,7 +54,7 @@ namespace detail {
5254

5355
namespace {
5456

55-
#if !defined(HAS_STRPTIME)
57+
#if !HAS_STRPTIME
5658
// Build a strptime() using C++11's std::get_time().
5759
char* strptime(const char* s, const char* fmt, std::tm* tm) {
5860
std::istringstream input(s);

0 commit comments

Comments
 (0)