RFR [XS]: 8236709: struct SwitchRange in HS violates C++ One Definition Rule - was RE: struct SwitchRange and C++ One Definition Rule [-Wodr]
David Holmes
david.holmes at oracle.com
Wed Jan 8 09:51:11 UTC 2020
On 8/01/2020 6:10 pm, Baesken, Matthias wrote:
> Hello, thanks for the input .
>
> I renamed SwitchRangeC1 to C1SwitchRange and removed the unnecessary forward declaration .
>
> New webrev :
>
> http://cr.openjdk.java.net/~mbaesken/webrevs/8236709.1/
Seems fine.
Thanks,
David
>
> Best regards, Matthias
>
>
>
>
>>>
>>> Hello, please review this small fix for an issue that I was running into when
>> experimenting with gcc8 and the -flto compiler flag .
>>> When building with those flags, the gcc8 warns that the SwitchRange
>> classes in HS code violate the C++ One Definition Rule .
>>> So I renamed one of those 2 SwitchRange classes .
>>>
>>> Bug/webrev :
>>>
>>> https://bugs.openjdk.java.net/browse/JDK-8236709
>>>
>>> http://cr.openjdk.java.net/~mbaesken/webrevs/8236709.0/
>>
>> I think I would prefer the C1 "namespace" disambiguator to be a prefix
>> rather than a suffix, to be consistent with usage in other parts of
>> HotSpot. (GC code does that somewhat consistently, for example.) I
>> don't recall seeing "namespace" suffixes used anywhere in HotSpot.
>>
>> I've occasionally considered proposing that C2 code be wrapped in a
>> namespace. It grabs a bunch of very generic global type names ("Type",
>> "Block", &etc; really!?) that can be annoying. (Though the diet for
>> precompiled.hpp helped with that.) But anything like that is probably
>> out of scope for the immediate problem.
>>
>> Giving C2 primacy of place (renaming the C1 class and letting C2 keep
>> the "good" name) seems consistent with existing practice.
>
More information about the hotspot-dev
mailing list