Skip to content

Commit c340dcc

Browse files
bm1549claude
andcommitted
fix: rename ParseResult::ERROR to avoid Windows macro conflict
windows.h defines ERROR as a macro which conflicts with enum values. Rename to PARSE_ERROR and add #undef ERROR after the include. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent d6e7ed8 commit c340dcc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/datadog/stable_config.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#ifdef _WIN32
99
#include <windows.h>
10+
// windows.h defines ERROR as a macro which conflicts with our enum.
11+
#undef ERROR
1012
#endif
1113

1214
namespace datadog {
@@ -119,7 +121,7 @@ std::string strip_inline_comment(const std::string& s) {
119121
return s;
120122
}
121123

122-
enum class ParseResult { OK, ERROR };
124+
enum class ParseResult { OK, PARSE_ERROR };
123125

124126
// Parse a YAML file's contents into a StableConfig.
125127
// Returns OK on success (including empty/missing apm_configuration_default).
@@ -152,7 +154,7 @@ ParseResult parse_yaml(const std::string& content, StableConfig& out) {
152154
auto colon_pos = trimmed.find(':');
153155
if (colon_pos == std::string::npos) {
154156
// Malformed line at top level.
155-
return ParseResult::ERROR;
157+
return ParseResult::PARSE_ERROR;
156158
}
157159

158160
auto key = trim(trimmed.substr(0, colon_pos));
@@ -167,7 +169,7 @@ ParseResult parse_yaml(const std::string& content, StableConfig& out) {
167169
// The value after the colon should be empty (map follows on next
168170
// lines). If it's not empty, that's malformed for our purposes.
169171
if (!value.empty()) {
170-
return ParseResult::ERROR;
172+
return ParseResult::PARSE_ERROR;
171173
}
172174
} else if (key == "config_id") {
173175
out.config_id = unquote(value);
@@ -178,7 +180,7 @@ ParseResult parse_yaml(const std::string& content, StableConfig& out) {
178180
auto colon_pos = trimmed.find(':');
179181
if (colon_pos == std::string::npos) {
180182
// Malformed entry.
181-
return ParseResult::ERROR;
183+
return ParseResult::PARSE_ERROR;
182184
}
183185

184186
auto key = trim(trimmed.substr(0, colon_pos));

0 commit comments

Comments
 (0)