]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++, analyzer: Expand CAN_HAVE_LOCATION_P macro.
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Thu, 1 Jun 2023 17:44:19 +0000 (19:44 +0200)
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Wed, 15 Nov 2023 17:38:45 +0000 (18:38 +0100)
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.

gcc/cp/tree.cc
gcc/gcc-rich-location.cc

index 0736e8d8f485b166ef48ae5eda3165aa889b1183..5279579c20104c6ce5fc90df280f8eeec0794312 100644 (file)
@@ -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
index 068df1c51a8c03880374745b4f0f44d5c19b7ffb..2fb0cc7ce92b4ba0d27ec4ca8d9afabce8b5384f 100644 (file)
@@ -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);