Commit 82c2f1bb by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/44630 (profiler_trace.h defines functions __max and __min which…

re PR libstdc++/44630 (profiler_trace.h defines functions __max and __min which causes portability problems)

2010-06-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/44630
	* include/profile/impl/profiler_trace.h (__min, __max): Remove,
	use std::min, std::max everywhere.
	* include/profile/impl/profiler_container_size.h: Use std::min and
	std::max.
	* include/profile/impl/profiler_hash_func.h: Likewise.
	* include/profile/impl/profiler_list_to_vector.h: Likewise.

From-SVN: r161192
parent 41195c94
2010-06-22 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/44630
* include/profile/impl/profiler_trace.h (__min, __max): Remove,
use std::min, std::max everywhere.
* include/profile/impl/profiler_container_size.h: Use std::min and
std::max.
* include/profile/impl/profiler_hash_func.h: Likewise.
* include/profile/impl/profiler_list_to_vector.h: Likewise.
2010-06-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2010-06-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc: * testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc:
......
// -*- C++ -*- // -*- C++ -*-
// //
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms // software; you can redistribute it and/or modify it under the terms
...@@ -102,14 +102,14 @@ inline const char* __container_size_info::__advice() const ...@@ -102,14 +102,14 @@ inline const char* __container_size_info::__advice() const
inline void __container_size_info::__destruct(size_t __num, size_t __inum) inline void __container_size_info::__destruct(size_t __num, size_t __inum)
{ {
_M_max = __max(_M_max, __num); _M_max = std::max(_M_max, __num);
_M_item_max = __max(_M_item_max, __inum); _M_item_max = std::max(_M_item_max, __inum);
if (_M_min == 0) { if (_M_min == 0) {
_M_min = __num; _M_min = __num;
_M_item_min = __inum; _M_item_min = __inum;
} else { } else {
_M_min = __min(_M_min, __num); _M_min = std::min(_M_min, __num);
_M_item_min = __min(_M_item_min, __inum); _M_item_min = std::min(_M_item_min, __inum);
} }
_M_total += __num; _M_total += __num;
_M_item_total += __inum; _M_item_total += __inum;
...@@ -120,7 +120,7 @@ inline void __container_size_info::__resize(size_t __from, size_t __to) ...@@ -120,7 +120,7 @@ inline void __container_size_info::__resize(size_t __from, size_t __to)
{ {
_M_cost += this->__resize_cost(__from, __to); _M_cost += this->__resize_cost(__from, __to);
_M_resize += 1; _M_resize += 1;
_M_max = __max(_M_max, __to); _M_max = std::max(_M_max, __to);
} }
inline __container_size_info::__container_size_info(__stack_t __stack, inline __container_size_info::__container_size_info(__stack_t __stack,
...@@ -138,11 +138,11 @@ inline __container_size_info::__container_size_info(__stack_t __stack, ...@@ -138,11 +138,11 @@ inline __container_size_info::__container_size_info(__stack_t __stack,
inline void __container_size_info::__merge(const __container_size_info& __o) inline void __container_size_info::__merge(const __container_size_info& __o)
{ {
_M_init = __max(_M_init, __o._M_init); _M_init = std::max(_M_init, __o._M_init);
_M_max = __max(_M_max, __o._M_max); _M_max = std::max(_M_max, __o._M_max);
_M_item_max = __max(_M_item_max, __o._M_item_max); _M_item_max = std::max(_M_item_max, __o._M_item_max);
_M_min = __min(_M_min, __o._M_min); _M_min = std::min(_M_min, __o._M_min);
_M_item_min = __min(_M_item_min, __o._M_item_min); _M_item_min = std::min(_M_item_min, __o._M_item_min);
_M_total += __o._M_total; _M_total += __o._M_total;
_M_item_total += __o._M_item_total; _M_item_total += __o._M_item_total;
_M_count += __o._M_count; _M_count += __o._M_count;
......
// -*- C++ -*- // -*- C++ -*-
// //
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms // software; you can redistribute it and/or modify it under the terms
...@@ -87,7 +87,7 @@ inline __hashfunc_info::__hashfunc_info(const __hashfunc_info& __o) ...@@ -87,7 +87,7 @@ inline __hashfunc_info::__hashfunc_info(const __hashfunc_info& __o)
inline void __hashfunc_info::__merge(const __hashfunc_info& __o) inline void __hashfunc_info::__merge(const __hashfunc_info& __o)
{ {
_M_longest_chain = __max(_M_longest_chain, __o._M_longest_chain); _M_longest_chain = std::max(_M_longest_chain, __o._M_longest_chain);
_M_accesses += __o._M_accesses; _M_accesses += __o._M_accesses;
_M_hops += __o._M_hops; _M_hops += __o._M_hops;
} }
...@@ -95,7 +95,7 @@ inline void __hashfunc_info::__merge(const __hashfunc_info& __o) ...@@ -95,7 +95,7 @@ inline void __hashfunc_info::__merge(const __hashfunc_info& __o)
inline void __hashfunc_info::__destruct(size_t __chain, size_t __accesses, inline void __hashfunc_info::__destruct(size_t __chain, size_t __accesses,
size_t __hops) size_t __hops)
{ {
_M_longest_chain = __max(_M_longest_chain, __chain); _M_longest_chain = std::max(_M_longest_chain, __chain);
_M_accesses += __accesses; _M_accesses += __accesses;
_M_hops += __hops; _M_hops += __hops;
} }
......
// -*- C++ -*- // -*- C++ -*-
// //
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms // software; you can redistribute it and/or modify it under the terms
...@@ -124,13 +124,13 @@ inline void __list2vector_info::__merge(const __list2vector_info& __o) ...@@ -124,13 +124,13 @@ inline void __list2vector_info::__merge(const __list2vector_info& __o)
_M_list_cost += __o._M_list_cost; _M_list_cost += __o._M_list_cost;
_M_valid &= __o._M_valid; _M_valid &= __o._M_valid;
_M_resize += __o._M_resize; _M_resize += __o._M_resize;
_M_max_size = __max( _M_max_size, __o._M_max_size); _M_max_size = std::max( _M_max_size, __o._M_max_size);
} }
inline void __list2vector_info::__opr_insert(size_t __shift, size_t __size) inline void __list2vector_info::__opr_insert(size_t __shift, size_t __size)
{ {
_M_shift_count += __shift; _M_shift_count += __shift;
_M_max_size = __max(_M_max_size, __size); _M_max_size = std::max(_M_max_size, __size);
} }
inline void __list2vector_info::__resize(size_t __from, size_t __to) inline void __list2vector_info::__resize(size_t __from, size_t __to)
......
...@@ -122,17 +122,6 @@ void __trace_list_to_slist_report(FILE*, __warning_vector_t&); ...@@ -122,17 +122,6 @@ void __trace_list_to_slist_report(FILE*, __warning_vector_t&);
void __trace_list_to_vector_report(FILE*, __warning_vector_t&); void __trace_list_to_vector_report(FILE*, __warning_vector_t&);
void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&); void __trace_map_to_unordered_map_report(FILE*, __warning_vector_t&);
// Utility functions.
inline size_t __max(size_t __a, size_t __b)
{
return __a >= __b ? __a : __b;
}
inline size_t __min(size_t __a, size_t __b)
{
return __a <= __b ? __a : __b;
}
struct __cost_factor struct __cost_factor
{ {
const char* __env_var; const char* __env_var;
...@@ -439,8 +428,8 @@ inline void __report(void) ...@@ -439,8 +428,8 @@ inline void __report(void)
fclose(__raw_file); fclose(__raw_file);
// Sort data by magnitude, keeping just top N. // Sort data by magnitude, keeping just top N.
size_t __cutoff = __min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count), size_t __cutoff = std::min(_GLIBCXX_PROFILE_DATA(_S_max_warn_count),
__warnings.size()); __warnings.size());
__top_n(__warnings, __top_warnings, __cutoff); __top_n(__warnings, __top_warnings, __cutoff);
FILE* __warn_file = __open_output_file("txt"); FILE* __warn_file = __open_output_file("txt");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment