public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5508] c++, analyzer: Expand CAN_HAVE_LOCATION_P macro.
@ 2023-11-15 17:41 Bernhard Reutner-Fischer
  0 siblings, 0 replies; only message in thread
From: Bernhard Reutner-Fischer @ 2023-11-15 17:41 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:186331063dfbcf1eacb445c473d92634c9baa90f

commit r14-5508-g186331063dfbcf1eacb445c473d92634c9baa90f
Author: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Date:   Thu Jun 1 19:44:19 2023 +0200

    c++, analyzer: Expand CAN_HAVE_LOCATION_P macro.
    
    r14-985-gca2007a9bb3074 used the collapsed macro definition
    CAN_HAVE_LOCATION_P in gcc-rich-location.cc and r14-977-g8861c80733da5c
    in c++'s build_cplus_array_type ().
    However, although otherwise correct, the usage of CAN_HAVE_LOCATION_P
    in these two spots is misleading, so this patch reverts aforementioned
    two hunks.
    
    gcc/cp/ChangeLog:
    
            * tree.cc (build_cplus_array_type): Revert using the macro
            CAN_HAVE_LOCATION_P.
    
    gcc/ChangeLog:
    
            * gcc-rich-location.cc (maybe_range_label_for_tree_type_mismatch::get_text):
            Revert using the macro CAN_HAVE_LOCATION_P.

Diff:
---
 gcc/cp/tree.cc           | 2 +-
 gcc/gcc-rich-location.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index 0736e8d8f48..5279579c201 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -1171,7 +1171,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent)
     }
 
   /* Avoid spurious warnings with VLAs (c++/54583).  */
-  if (CAN_HAVE_LOCATION_P (TYPE_SIZE (t)))
+  if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t)))
     suppress_warning (TYPE_SIZE (t), OPT_Wunused);
 
   /* Push these needs up to the ARRAY_TYPE so that initialization takes
diff --git a/gcc/gcc-rich-location.cc b/gcc/gcc-rich-location.cc
index 068df1c51a8..2fb0cc7ce92 100644
--- a/gcc/gcc-rich-location.cc
+++ b/gcc/gcc-rich-location.cc
@@ -203,7 +203,7 @@ maybe_range_label_for_tree_type_mismatch::get_text (unsigned range_idx) const
   tree expr_type = TREE_TYPE (m_expr);
 
   tree other_type = NULL_TREE;
-  if (CAN_HAVE_LOCATION_P (m_other_expr))
+  if (m_other_expr && EXPR_P (m_other_expr))
     other_type = TREE_TYPE (m_other_expr);
 
   range_label_for_type_mismatch inner (expr_type, other_type);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-15 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 17:41 [gcc r14-5508] c++, analyzer: Expand CAN_HAVE_LOCATION_P macro Bernhard Reutner-Fischer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).