https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116847

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:ddc72ba6c6c2c84a1a95340840bd5fde1f2bde44

commit r15-3928-gddc72ba6c6c2c84a1a95340840bd5fde1f2bde44
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Sep 27 16:06:29 2024 +0200

    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  <ja...@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.

Reply via email to