diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-09-27 16:06:29 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-09-27 16:06:29 +0200 |
commit | ddc72ba6c6c2c84a1a95340840bd5fde1f2bde44 (patch) | |
tree | e815c156673dab95a460daa6799efbc90cbaf662 /gcc/java/decl.c | |
parent | a72108920805a024b6bbee5acdd32914382c47a1 (diff) | |
download | gcc-ddc72ba6c6c2c84a1a95340840bd5fde1f2bde44.zip gcc-ddc72ba6c6c2c84a1a95340840bd5fde1f2bde44.tar.gz gcc-ddc72ba6c6c2c84a1a95340840bd5fde1f2bde44.tar.bz2 |
diagnostic: Use vec instead of custom array reallocations for m_classification_history/m_push_list [PR116847]
diagnostic.h already relies on vec.h, it uses auto_vec in one spot.
The following patch converts m_classification_history and m_push_list
hand-managed arrays to vec templates.
The main advantage is exponential rather than linear reallocation,
e.g. with current libstdc++ headers if one includes all the standard
headers there could be ~ 300 reallocations of the m_classification_history
array (sure, not all of them will result in actually copying the data, but
still).
In addition to that it fixes some formatting issues in the code.
2024-09-26 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/116847
* diagnostic.h (diagnostic_option_classifier): Change type
of m_classification_history from diagnostic_classification_change_t *
to vec<diagnostic_classification_change_t>. Change type of
m_push_list from int * to vec<int>. Remove m_n_classification_history
and m_n_push members.
* diagnostic.cc (diagnostic_option_classifier::init): Set m_push_list
to vNULL rather than nullptr. Don't initialize m_n_push. Initialize
m_classification_history to vNULL.
(diagnostic_option_classifier::fini): Call release () method on
m_push_list instead of free on it. Call release () on
m_classification_history. Don't clear m_n_push.
(diagnostic_option_classifier::push): Adjust for m_push_list and
m_classification_history being vectors rather than custom allocated
arrays with counter.
(diagnostic_option_classifier::pop): Likewise.
(classify_diagnostic): Adjust for m_classification_history being
vector rather than custom allocated array with counter.
(update_effective_level_from_pragmas): Likewise.
Diffstat (limited to 'gcc/java/decl.c')
0 files changed, 0 insertions, 0 deletions