This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Use TBAA for lto-symtab decl merging warnings


On November 24, 2015 8:29:10 PM GMT+01:00, Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
>On November 24, 2015 7:23:40 AM GMT+01:00, Jan Hubicka <hubicka@ucw.cz>
>wrote:
>>Hi,
>
>Doc talks about COMMON, parm is COMMON_OR_EXTERN.
>
>> static int
>>-warn_type_compatibility_p (tree prevailing_type, tree type)
>>+warn_type_compatibility_p (tree prevailing_type, tree type,
>>+			   bool common_or_extern)
>> {
>>   int lev = 0;
>>+  bool odr_p = odr_or_derived_type_p (prevailing_type)
>>+	       && odr_or_derived_type_p (type);
>> 
>>-  /* Get complete type.
>>-     ???  We might want to emit a warning here if type qualification
>>-     differences were spotted.  Do not do this unconditionally
>though.
>> */
>>-  type = TYPE_MAIN_VARIANT (type);
>>-  prevailing_type = TYPE_MAIN_VARIANT (prevailing_type);
>>   if (prevailing_type == type)
>>     return 0;
>> 
>>-  bool odr_p = odr_or_derived_type_p (prevailing_type)
>>-	       && odr_or_derived_type_p (type);
>>/* C++ provide a robust way to check for type compatibility via the
>ODR
>>      rule.  */
>>   if (odr_p && !odr_types_equivalent_p (prevailing_type, type))
>>-    lev = 2;
>>+    lev |= 2;
>> 
>> /* Function types needs special care, because types_compatible_p
>never
>>      thinks prototype is compatible to non-prototype.  */
>>-  if ((TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) ==
>>METHOD_TYPE)
>>-      && TREE_CODE (type) == TREE_CODE (prevailing_type))
>>+  if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) ==
>>METHOD_TYPE)
>>     {
>>+      if (TREE_CODE (type) != TREE_CODE (prevailing_type))
>>+	lev |= 1;
>>       lev |= warn_type_compatibility_p (TREE_TYPE (prevailing_type),
>>-				        TREE_TYPE (type));
>>-      if (TREE_CODE (type) == METHOD_TYPE)
>>+				        TREE_TYPE (type), false);
>>+      if (TREE_CODE (type) == METHOD_TYPE
>>+	  && TREE_CODE (prevailing_type))
>
>== what?
>
>Do we have warn_unused_result for macros?

respectively that the result of the expansion is supposed to be used in an explicit comparison that is.

>Thanks,



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]