RFR: 8342869: Errors related to unused code on Windows after 8339120 in awt

Julian Waters jwaters at openjdk.org
Mon Dec 23 12:27:43 UTC 2024


On Mon, 23 Dec 2024 08:18:40 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/java.desktop/share/native/common/awt/debug/debug_trace.h line 66:
>> 
>>> 64: /* each file includes this flag indicating module trace status */
>>> 65: #ifdef __cplusplus
>>> 66: [[maybe_unused]]
>> 
>> I don't really know what to do about this one. The solution is messy, but it's the only one I could come up with. A static global in a header is just begging for an unused-variable error to happen
>
> Can we move it to a cpp file and declare it extern here?

Hi Thomas, I don't think that is possible due to how it's used, from what I can tell from reading the code this global is meant to be unique to each file that the header is included in, as the comment says:

> /* each file includes this flag indicating module trace status */

I've been trying to think of alternatives to the current "Global unique to each file defined inside a header" approach currently taken here, but alas I couldn't really think of anything

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21655#discussion_r1895694701


More information about the build-dev mailing list