Skip to content

Commit ec18d09

Browse files
committed
Ensure HAS_STRPTIME is defined by default
Builds now always have a default value of 0 or 1 for HAS_STRPTIME, but it can be overridden on the commandline. This is to address -Wundef warnings, and the feedback from google#330.
1 parent 46d62c0 commit ec18d09

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/time_zone_format.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
#if !defined(HAS_STRPTIME)
1616
# if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__VXWORKS__)
1717
# define HAS_STRPTIME 1 // Assume everyone else has strptime().
18+
# else
19+
# define HAS_STRPTIME 0
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)