Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to fmt 8.0.1 #6179

Merged
merged 5 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/action/dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct dot_t : private noncopyable
void last_tick();
bool channel_interrupt();

friend void format_to( const dot_t&, fmt::format_context::iterator );
friend void sc_format_to( const dot_t&, fmt::format_context::iterator );

void reschedule_tick();
private:
Expand Down
2 changes: 1 addition & 1 deletion engine/action/sc_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4497,7 +4497,7 @@ double action_t::last_tick_factor(const dot_t* /* d */, timespan_t time_to_tick,
return std::min(1.0, duration / time_to_tick);
}

void format_to( const action_t& action, fmt::format_context::iterator out )
void sc_format_to( const action_t& action, fmt::format_context::iterator out )
{
if ( action.sim->log_spell_id )
{
Expand Down
2 changes: 1 addition & 1 deletion engine/action/sc_action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ struct action_t : private noncopyable
return( r == BLOCK_RESULT_BLOCKED || r == BLOCK_RESULT_CRIT_BLOCKED );
}

friend void format_to( const action_t&, fmt::format_context::iterator );
friend void sc_format_to( const action_t&, fmt::format_context::iterator );
};

struct call_action_list_t : public action_t
Expand Down
2 changes: 1 addition & 1 deletion engine/action/sc_dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ void dot_t::dot_end_event_t::execute()
dot->last_tick();
}

void format_to( const dot_t& dot, fmt::format_context::iterator out )
void sc_format_to( const dot_t& dot, fmt::format_context::iterator out )
{
fmt::format_to( out, "Dot {}", dot.name_str );
}
2 changes: 1 addition & 1 deletion engine/buff/sc_buff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ void buff_t::update_stack_uptime_array( timespan_t current_time, int old_stacks
uptime_array.add( end_time, end_partial.total_seconds() * mul );
}

void format_to( const buff_t& buff, fmt::format_context::iterator out )
void sc_format_to( const buff_t& buff, fmt::format_context::iterator out )
{
if ( buff.sim->log_spell_id )
{
Expand Down
2 changes: 1 addition & 1 deletion engine/buff/sc_buff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ struct buff_t : private noncopyable
virtual buff_t* apply_affecting_conduit( const conduit_data_t& conduit, int effect_num = 1 );
virtual buff_t* apply_affecting_conduit_effect( const conduit_data_t& conduit, size_t effect_num );

friend void format_to( const buff_t&, fmt::format_context::iterator );
friend void sc_format_to( const buff_t&, fmt::format_context::iterator );
private:
void update_trigger_calculations();
void adjust_haste();
Expand Down
8 changes: 4 additions & 4 deletions engine/class_modules/sc_hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ static void print_affected_by( const action_t* a, const spelleffect_data_t& effe
const spell_data_t& spell = *effect.spell();
const auto& spell_text = a->player->dbc->spell_text( spell.id() );

fmt::format_to( out, "{} {} is affected by {}", *a->player, *a, spell.name_cstr() );
fmt::format_to( std::back_inserter(out), "{} {} is affected by {}", *a->player, *a, spell.name_cstr() );
if ( spell_text.rank() )
fmt::format_to( out, " (desc={})", spell_text.rank() );
fmt::format_to( out, " (id={}) effect#{}", spell.id(), effect.spell_effect_num() + 1 );
fmt::format_to( std::back_inserter(out), " (desc={})", spell_text.rank() );
fmt::format_to( std::back_inserter(out), " (id={}) effect#{}", spell.id(), effect.spell_effect_num() + 1 );
if ( !label.empty() )
fmt::format_to( out, ": {}", label );
fmt::format_to( std::back_inserter(out), ": {}", label );

a -> sim -> print_debug( "{}", util::string_view( out.data(), out.size() ) );
}
Expand Down
2 changes: 1 addition & 1 deletion engine/class_modules/sc_mage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7450,7 +7450,7 @@ class mage_report_t : public player_report_extension_t
if ( !data->active() )
continue;

auto nonzero = [] ( const char* fmt, double d ) { return d != 0.0 ? fmt::format( fmt, d ) : ""; };
auto nonzero = [] ( const char* fmt, double d ) { return d != 0.0 ? fmt::format( fmt::runtime(fmt), d ) : ""; };
auto cells = [ &, total = data->count_total() ] ( double mean, bool util = false )
{
std::string format_str = "<td class=\"right\">{}</td><td class=\"right\">{}</td>";
Expand Down
6 changes: 3 additions & 3 deletions engine/dbc/sc_item_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1273,10 +1273,10 @@ static std::string get_bonus_mod_stat( util::span<const item_bonus_entry_t> entr

if ( b.size() > 0 )
{
fmt::format_to( b, ", " );
fmt::format_to( std::back_inserter( b ), ", " );
}

fmt::format_to( b, "{} ({})",
fmt::format_to( std::back_inserter( b ), "{} ({})",
util::stat_type_abbrev( util::translate_item_mod( entries[ i ].value_1 ) ),
entries[ i ].value_2 );

Expand Down Expand Up @@ -1407,7 +1407,7 @@ std::string dbc::bonus_ids_str( const dbc_t& dbc )
fields.emplace_back( fmt::format( "mod_to_stat={{ {} }}", item_mod_stat ) );
}

fmt::format_to( s, "{}\n", fmt::join( fields, ", " ) );
fmt::format_to( std::back_inserter(s), "{}\n", fmt::join( fields, ", " ) );
}

return to_string( s );
Expand Down
18 changes: 9 additions & 9 deletions engine/dbc/sc_spell_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,24 @@ void print_hotfixes( fmt::memory_buffer& buf,
for ( const auto& hotfix : hotfixes )
{
if ( buf.size() > 0 )
fmt::format_to( buf, ", " );
fmt::format_to( std::back_inserter(buf), ", " );

auto entry = map.find( hotfix.field_id );
if ( entry == map.end() )
fmt::format_to( buf, "Unknown({})", hotfix.field_id );
fmt::format_to( std::back_inserter(buf), "Unknown({})", hotfix.field_id );
else
fmt::format_to( buf, "{}", entry -> second );
fmt::format_to( std::back_inserter(buf), "{}", entry -> second );

switch ( hotfix.field_type )
{
case hotfix::UINT:
fmt::format_to( buf, " ({} -> {})", hotfix.orig_value.u, hotfix.hotfixed_value.u );
fmt::format_to( std::back_inserter(buf), " ({} -> {})", hotfix.orig_value.u, hotfix.hotfixed_value.u );
break;
case hotfix::INT:
fmt::format_to( buf, " ({} -> {})", hotfix.orig_value.i, hotfix.hotfixed_value.i );
fmt::format_to( std::back_inserter(buf), " ({} -> {})", hotfix.orig_value.i, hotfix.hotfixed_value.i );
break;
case hotfix::FLOAT:
fmt::format_to( buf, " ({} -> {})", hotfix.orig_value.f, hotfix.hotfixed_value.f );
fmt::format_to( std::back_inserter(buf), " ({} -> {})", hotfix.orig_value.f, hotfix.hotfixed_value.f );
break;
// Don't print out the changed string for now, seems pointless
case hotfix::STRING:
Expand Down Expand Up @@ -2123,10 +2123,10 @@ std::string spell_info::to_str( const dbc_t& dbc, const spell_data_t* spell, int
return fmt::format( "{} ({} effect#{})", spell->name_cstr(), spell->id(), effects.front()->index() + 1 );

fmt::memory_buffer s;
fmt::format_to( s, "{} ({} effects: ", spell->name_cstr(), spell->id() );
fmt::format_to( std::back_inserter(s), "{} ({} effects: ", spell->name_cstr(), spell->id() );
for ( size_t i = 0; i < effects.size(); i++ )
fmt::format_to( s, "{}#{}", i == 0 ? "" : ", ", effects[ i ]->index() + 1 );
fmt::format_to( s, ")" );
fmt::format_to( std::back_inserter(s), "{}#{}", i == 0 ? "" : ", ", effects[ i ]->index() + 1 );
fmt::format_to( std::back_inserter(s), ")" );
return to_string( s );
};

Expand Down
20 changes: 10 additions & 10 deletions engine/interfaces/bcp_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ void authorize( sim_t* sim, const std::string& region )
std::string oauth_endpoint;
if ( util::str_compare_ci( region, "eu" ) || util::str_compare_ci( region, "us" ) )
{
oauth_endpoint = fmt::format( GLOBAL_OAUTH_ENDPOINT_URI, region );
oauth_endpoint = fmt::format( fmt::runtime(GLOBAL_OAUTH_ENDPOINT_URI), region );
}
else if ( util::str_compare_ci( region, "kr" ) || util::str_compare_ci( region, "tw" ) )
{
oauth_endpoint = fmt::format( GLOBAL_OAUTH_ENDPOINT_URI, "apac" );
oauth_endpoint = fmt::format( fmt::runtime(GLOBAL_OAUTH_ENDPOINT_URI), "apac" );
}
else if ( util::str_compare_ci( region, "cn" ) )
{
Expand Down Expand Up @@ -341,11 +341,11 @@ void download_item( sim_t* sim,

if ( !util::str_compare_ci( region, "cn" ) )
{
url = fmt::format( GLOBAL_ITEM_ENDPOINT_URI, region, item_id, LOCALES[ region ][ 0 ] );
url = fmt::format( fmt::runtime(GLOBAL_ITEM_ENDPOINT_URI), region, item_id, LOCALES[ region ][ 0 ] );
}
else
{
url = fmt::format( CHINA_ITEM_ENDPOINT_URI, item_id );
url = fmt::format( fmt::runtime(CHINA_ITEM_ENDPOINT_URI), item_id );
}

download( sim, d, region, url, caching );
Expand Down Expand Up @@ -1077,11 +1077,11 @@ void download_roster( rapidjson::Document& d,
std::string url;
if ( !util::str_compare_ci( region, "cn" ) )
{
url = fmt::format( GLOBAL_GUILD_ENDPOINT_URI, region, server, name, LOCALES[ region ][ 0 ] );
url = fmt::format( fmt::runtime(GLOBAL_GUILD_ENDPOINT_URI), region, server, name, LOCALES[ region ][ 0 ] );
}
else
{
url = fmt::format( CHINA_GUILD_ENDPOINT_URI, server, name );
url = fmt::format( fmt::runtime(CHINA_GUILD_ENDPOINT_URI), server, name );
}

download( sim, d, region, url, caching );
Expand Down Expand Up @@ -1162,13 +1162,13 @@ player_t* bcp_api::download_player( sim_t* sim, const std::string& region, const

if (!util::str_compare_ci(region, "cn"))
{
player.url = fmt::format(GLOBAL_PLAYER_ENDPOINT_URI, region, normalized_server, normalized_name, region, LOCALES[region][0]);
player.origin = fmt::format(GLOBAL_ORIGIN_URI, LOCALES[region][1], normalized_server, normalized_name);
player.url = fmt::format(fmt::runtime(GLOBAL_PLAYER_ENDPOINT_URI), region, normalized_server, normalized_name, region, LOCALES[region][0]);
player.origin = fmt::format(fmt::runtime(GLOBAL_ORIGIN_URI), LOCALES[region][1], normalized_server, normalized_name);
}
else
{
player.url = fmt::format(CHINA_PLAYER_ENDPOINT_URI, normalized_server, normalized_name);
player.origin = fmt::format(CHINA_ORIGIN_URI, normalized_server, normalized_name);
player.url = fmt::format(fmt::runtime(CHINA_PLAYER_ENDPOINT_URI), normalized_server, normalized_name);
player.origin = fmt::format(fmt::runtime(CHINA_ORIGIN_URI), normalized_server, normalized_name);
}

#ifdef SC_DEFAULT_APIKEY
Expand Down
2 changes: 1 addition & 1 deletion engine/item/enchants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void enchant::initialize_item_enchant( item_t& item, std::vector<stat_pair_t>& s
{
if ( item.player->profession[ profession ] < static_cast<int>( enchant.req_skill_value ) )
{
item.sim->error( "Player {} attempting to use {) '{}' without {} skill level of {} (has {}), disabling enchant.",
item.sim->error( "Player {} attempting to use {} '{}' without {} skill level of {} (has {}), disabling enchant.",
item.player->name(), util::special_effect_source_string( source ), enchant.name,
util::profession_type_string( profession ), enchant.req_skill_value,
item.player->profession[ profession ] );
Expand Down
1 change: 1 addition & 0 deletions engine/item/enchants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "util/string_view.hpp"

#include <string>
#include <vector>

class dbc_t;
struct gem_property_data_t;
Expand Down
2 changes: 1 addition & 1 deletion engine/item/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ std::string item_t::socket_bonus_stats_str() const
return str;
}

void format_to( const item_t& item, fmt::format_context::iterator out )
void sc_format_to( const item_t& item, fmt::format_context::iterator out )
{
fmt::format_to( out, "name={} id={}", item.name_str, item.parsed.data.id );
if ( item.slot != SLOT_INVALID )
Expand Down
2 changes: 1 addition & 1 deletion engine/item/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,5 @@ struct item_t
const special_effect_t* special_effect( special_effect_source_e source = SPECIAL_EFFECT_SOURCE_NONE, special_effect_e type = SPECIAL_EFFECT_NONE ) const;
const special_effect_t* special_effect_with_name( util::string_view name, special_effect_source_e source = SPECIAL_EFFECT_SOURCE_NONE, special_effect_e type = SPECIAL_EFFECT_NONE ) const;

friend void format_to( const item_t&, fmt::format_context::iterator );
friend void sc_format_to( const item_t&, fmt::format_context::iterator );
};
2 changes: 1 addition & 1 deletion engine/item/special_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ std::string special_effect_t::name() const
return n;
}

void format_to( const special_effect_t& se, fmt::format_context::iterator out )
void sc_format_to( const special_effect_t& se, fmt::format_context::iterator out )
{
fmt::format_to( out, "{}", se.name() );
fmt::format_to( out, " type={}", se.type );
Expand Down
2 changes: 1 addition & 1 deletion engine/item/special_effect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@ struct special_effect_t
timespan_t duration() const;
timespan_t tick_time() const;

friend void format_to( const special_effect_t&, fmt::format_context::iterator );
friend void sc_format_to( const special_effect_t&, fmt::format_context::iterator );
};
2 changes: 1 addition & 1 deletion engine/lib/fmt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ std::string s = fmt::format("{0}{1}{0}", "abra", "cad");

SimC Integration:
-----------------
* Release 7.1.3 from https://github.com/fmtlib/fmt/releases/tag/7.1.3
* Release 8.0.0 from https://github.com/fmtlib/fmt/releases/tag/8.0.0
* rename .cc files to .cpp for simpler integration into our build systems.
Loading