+2002-08-23 Phil Edwards <pme@gcc.gnu.org>
+
+ * config/linker-map.gnu: Verbose comments, clean up spacing.
+ * include/bits/stl_alloc.h: Fix indentation of 'if' bodies, return
+ statements.
+ __allocator: Change class declaration to struct.
+ * docs/html/17_intro/C++STYLE: Fix typo.
+ * include/bits/stl_deque.h, include/bits/stl_list.h,
+ include/bits/stl_map.h, include/bits/stl_multimap.h,
+ include/bits/stl_vector.h: Fix fallout from typo.
+
2002-08-22 Benjamin Kosnik <bkoz@redhat.com>
* acinclude.m4 (GLIBCPP_CONFIGURE_TESTSUITE): Set
};
# Names not in an 'extern' block are mangled names.
+
+ # std::has_facet*
_ZSt9has_facet*;
# operator new(unsigned)
# operator delete[](void*, std::nothrow_t const&)
_ZdaPvRKSt9nothrow_t;
- # vtable
- _ZTV*;
+ # vtable
+ _ZTV*;
_ZTT*;
# typeinfo
int foo;
13. Spacing WRT return statements.
- no extra spacing before returns
+ no extra spacing before returns, no parenthesis
ie
}
return __ret;
+ -NOT-
+
+ }
+ return (__ret);
+
+
14. Location of global variables.
All global variables of class type, whether in the "user visable"
space (e.g., cin) or the implementation namespace, must be defined
int
two_lines(const char* arg)
- { return strchr(arg, 'a'); }
+ { return strchr(arg, 'a'); }
inline int
three_lines(); // inline, but defined below.
}
} // namespace std
-
-
-
-
{ ::operator delete(__p); }
};
+
/**
* @if maint
* A malloc-based allocator. Typically slower than the
{
void (* __old)() = __malloc_alloc_oom_handler;
__malloc_alloc_oom_handler = __f;
- return(__old);
+ return __old;
}
};
{
__my_malloc_handler = __malloc_alloc_oom_handler;
if (0 == __my_malloc_handler)
- std::__throw_bad_alloc();
+ std::__throw_bad_alloc();
(*__my_malloc_handler)();
__result = malloc(__n);
if (__result)
- return(__result);
+ return __result;
}
}
(*__my_malloc_handler)();
__result = realloc(__p, __n);
if (__result)
- return(__result);
+ return __result;
}
}
#endif
* (See @link Allocators allocators info @endlink for more.)
*/
template<typename _Tp, typename _Alloc>
- class __simple_alloc
- {
- public:
- static _Tp*
- allocate(size_t __n)
- { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
-
- static _Tp*
- allocate()
- { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
-
- static void
- deallocate(_Tp* __p, size_t __n)
- { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
-
- static void
- deallocate(_Tp* __p)
- { _Alloc::deallocate(__p, sizeof (_Tp)); }
- };
+ class __simple_alloc
+ {
+ public:
+ static _Tp*
+ allocate(size_t __n)
+ { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
+
+ static _Tp*
+ allocate()
+ { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
+
+ static void
+ deallocate(_Tp* __p, size_t __n)
+ { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
+
+ static void
+ deallocate(_Tp* __p)
+ { _Alloc::deallocate(__p, sizeof (_Tp)); }
+ };
/**
{
__result = _S_start_free;
_S_start_free += __total_bytes;
- return(__result);
+ return __result ;
}
else if (__bytes_left >= __size)
{
__total_bytes = __size * __nobjs;
__result = _S_start_free;
_S_start_free += __total_bytes;
- return(__result);
+ return __result;
}
else
{
*__my_free_list = __p -> _M_free_list_link;
_S_start_free = (char*)__p;
_S_end_free = _S_start_free + __i;
- return(_S_chunk_alloc(__size, __nobjs));
+ return _S_chunk_alloc(__size, __nobjs);
// Any leftover piece will eventually make it to the
// right free list.
}
}
_S_heap_size += __bytes_to_get;
_S_end_free = _S_start_free + __bytes_to_get;
- return(_S_chunk_alloc(__size, __nobjs));
+ return _S_chunk_alloc(__size, __nobjs);
}
}
int __i;
if (1 == __nobjs)
- return(__chunk);
+ return __chunk;
__my_free_list = _S_free_list + _S_freelist_index(__n);
// Build free list in chunk.
};
template<typename _Alloc>
- class __allocator<void, _Alloc>
+ struct __allocator<void, _Alloc>
{
typedef size_t size_type;
typedef ptrdiff_t difference_type;
*/
inline size_t
__deque_buf_size(size_t __size)
- { return __size < 512 ? size_t(512 / __size) : size_t(1); }
+ { return __size < 512 ? size_t(512 / __size) : size_t(1); }
/**
*/
iterator
insert(iterator __position)
- { return insert(__position, value_type()); }
+ { return insert(__position, value_type()); }
#endif
/**
*/
void
insert(iterator __position, size_type __n, const value_type& __x)
- { _M_fill_insert(__position, __n, __x); }
+ { _M_fill_insert(__position, __n, __x); }
/**
* @brief Inserts a range into the %deque.
/// Walk the %list forward.
void
_M_incr()
- { _M_node = _M_node->_M_next; }
+ { _M_node = _M_node->_M_next; }
/// Walk the %list backward.
void
_M_decr()
- { _M_node = _M_node->_M_prev; }
+ { _M_node = _M_node->_M_prev; }
bool
operator==(const _List_iterator_base& __x) const
- { return _M_node == __x._M_node; }
+ { return _M_node == __x._M_node; }
bool
operator!=(const _List_iterator_base& __x) const
- { return _M_node != __x._M_node; }
+ { return _M_node != __x._M_node; }
};
/**
reference
operator*() const
- { return static_cast<_Node*>(_M_node)->_M_data; }
- // Must downcast from List_node_base to _List_node to get to _M_data.
+ { return static_cast<_Node*>(_M_node)->_M_data; }
+ // Must downcast from List_node_base to _List_node to get to _M_data.
pointer
operator->() const
- { return &(operator*()); }
+ { return &(operator*()); }
_Self&
operator++()
protected:
_List_node<_Tp>*
_M_get_node()
- { return _M_node_allocator.allocate(1); }
+ { return _M_node_allocator.allocate(1); }
void
_M_put_node(_List_node<_Tp>* __p)
- { _M_node_allocator.deallocate(__p, 1); }
+ { _M_node_allocator.deallocate(__p, 1); }
// NOTA BENE
// The stored instance is not actually of "allocator_type"'s type. Instead
_List_node<_Tp>*
_M_get_node()
- { return _Alloc_type::allocate(1); }
+ { return _Alloc_type::allocate(1); }
void
_M_put_node(_List_node<_Tp>* __p)
- { _Alloc_type::deallocate(__p, 1); }
+ { _Alloc_type::deallocate(__p, 1); }
_List_node<_Tp>* _M_node;
};
*/
void
insert(iterator __pos, size_type __n, const value_type& __x)
- { _M_fill_insert(__pos, __n, __x); }
+ { _M_fill_insert(__pos, __n, __x); }
/**
* @brief Inserts a range into the %list.
value_compare(_Compare __c) : comp(__c) {}
public:
bool operator()(const value_type& __x, const value_type& __y) const
- { return comp(__x.first, __y.first); }
+ { return comp(__x.first, __y.first); }
};
private:
*/
pair<iterator,bool>
insert(const value_type& __x)
- { return _M_t.insert_unique(__x); }
+ { return _M_t.insert_unique(__x); }
/**
* @brief Attempts to insert a std::pair into the %map.
*/
iterator
insert(iterator position, const value_type& __x)
- { return _M_t.insert_unique(position, __x); }
+ { return _M_t.insert_unique(position, __x); }
/**
* @brief A template function that attemps to insert a range of elements.
template <typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
- { _M_t.insert_unique(__first, __last); }
+ { _M_t.insert_unique(__first, __last); }
/**
* @brief Erases an element from a %map.
*/
size_type
count(const key_type& __x) const
- { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
+ { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
/**
* @brief Finds the beginning of a subsequence matching given key.
*/
const_iterator
upper_bound(const key_type& __x) const
- { return _M_t.upper_bound(__x); }
+ { return _M_t.upper_bound(__x); }
/**
* @brief Finds a subsequence matching given key.
*/
pair<iterator,iterator>
equal_range(const key_type& __x)
- { return _M_t.equal_range(__x); }
+ { return _M_t.equal_range(__x); }
/**
* @brief Finds a subsequence matching given key.
*/
pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
- { return _M_t.equal_range(__x); }
+ { return _M_t.equal_range(__x); }
template <typename _K1, typename _T1, typename _C1, typename _A1>
friend bool operator== (const map<_K1,_T1,_C1,_A1>&,
value_compare(_Compare __c) : comp(__c) {}
public:
bool operator()(const value_type& __x, const value_type& __y) const
- { return comp(__x.first, __y.first); }
+ { return comp(__x.first, __y.first); }
};
private:
*/
iterator
insert(iterator __position, const value_type& __x)
- { return _M_t.insert_equal(__position, __x); }
+ { return _M_t.insert_equal(__position, __x); }
/**
* @brief A template function that attemps to insert a range of elements.
template <typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
- { _M_t.insert_equal(__first, __last); }
+ { _M_t.insert_equal(__first, __last); }
/**
* @brief Erases an element from a %multimap.
void
_M_deallocate(_Tp* __p, size_t __n)
- { if (__p) _M_data_allocator.deallocate(__p, __n); }
+ { if (__p) _M_data_allocator.deallocate(__p, __n); }
};
/// @if maint Specialization for instanceless allocators. @endif
*/
size_type
capacity() const
- { return size_type(const_iterator(_M_end_of_storage) - begin()); }
+ { return size_type(const_iterator(_M_end_of_storage) - begin()); }
/**
* Returns true if the %vector is empty. (Thus begin() would equal end().)
*/
iterator
insert(iterator __position)
- { return insert(__position, value_type()); }
+ { return insert(__position, value_type()); }
#endif
/**
*/
void
insert (iterator __pos, size_type __n, const value_type& __x)
- { _M_fill_insert(__pos, __n, __x); }
+ { _M_fill_insert(__pos, __n, __x); }
/**
* @brief Inserts a range into the %vector.