This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Use TBAA for lto-symtab decl merging warnings
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>,gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Nov 2015 20:33:30 +0100
- Subject: Re: Use TBAA for lto-symtab decl merging warnings
- Authentication-results: sourceware.org; auth=none
- References: <20151124062340 dot GB4494 at kam dot mff dot cuni dot cz> <BF7DCC96-9E3B-4CBB-986E-B96BFBD155BE at gmail dot com>
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,