Skip to content

Commit

Permalink
Capitalize UNREACHABLE() macro
Browse files Browse the repository at this point in the history
Avoids conflict with C++23 std::unreachable()
  • Loading branch information
Fabian Leditzky committed Dec 5, 2024
1 parent 12b2d37 commit 4469242
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Log.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ToSyslog(LogLevel log_level) noexcept
return LOG_DEBUG;
}

unreachable();
UNREACHABLE();
}

static void
Expand Down
2 changes: 1 addition & 1 deletion src/ReadConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ load_ignore_list(const std::string& path, Config::IgnoreListMap& ignore_lists)
case 0: entry_non_empty = true; entry.artist = token; break;
case 1: entry_non_empty = true; entry.album = token; break;
case 2: entry_non_empty = true; entry.title = token; break;
default: unreachable();
default: UNREACHABLE();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/curl/Global.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CurlSocket final {
}

assert(false);
unreachable();
UNREACHABLE();
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/util/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
#endif

#if defined(__GNUC__) || defined(__clang__)
#define unreachable() __builtin_unreachable()
#define UNREACHABLE() __builtin_unreachable()
#elif defined(_MSVC_VER)
#define unreachable() __assume(false)
#define UNREACHABLE() __assume(false)
#else
#define unreachable()
#define UNREACHABLE()
#endif

#endif

0 comments on commit 4469242

Please sign in to comment.