Use TBAA for lto-symtab decl merging warnings

Richard Biener richard.guenther@gmail.com
Wed Nov 25 12:41:00 GMT 2015


On Tue, Nov 24, 2015 at 8:29 PM, 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?

Yeah...

otherwise looks ok to me.

Thanks,
Richard.

> Do we have warn_unused_result for macros?
> Thanks,
>



More information about the Gcc-patches mailing list