RFR: 8299592: Fix and reenable warnings in java.desktop native code compilation

Daniel Jeliński djelinski at openjdk.org
Fri Jan 20 11:52:26 UTC 2023


On Wed, 4 Jan 2023 12:44:39 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> Please review this patch that fixes and re-enables a few warnings in libawt compilation.
> 
> Verified that debug and release builds finish successfully on Win, Mac and Linux. Also verified that client libs tests still pass.

In case it helps with the review, most of the fixes do not change the behavior, but make the compiler happy:
- the changes to SAFE_TO_ALLOC: assuming that no negative values are passed to the macros, the end result will be the same (modulo that the SAFE_TO_ALLOC macros should probably use `>=` instead of `>`)
- adding `inline` to `static`: `inline` is a C11 thing, and is generally ignored by the compiler, but `static inline` functions may be unused and plain `static` trigger a warning when unused
- removed a few unused functions, moved `DTrace_PrintStdErr` into `#ifdef DEBUG`
- replaced `double` functions with `float` where the argument was a `float` and the result was stored in a `float`
- fixed the type of `PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT` (this was only reported as a warning when compiler was run with `-analyze` parameter) (given that we dropped support for Win7 and older, can we link to uxtheme instead of checking for function availability?)
- removed `extern` on `DMemStatePtr` definition; it is still present on the declaration in header file, and definitions should not be `extern`

The following fixes may change behavior:
- changed `DMem_DumpHeader` to use snprintf, adjusted the buffer size to use what gcc suggested (may avoid crashing on long input)
- fixed error handling in `D3DBlitTextureToSurface` (`d3dc->SetTexture` failures were ignored) (warning only reported with `-analyze`)

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

PR: https://git.openjdk.org/jdk/pull/11841



More information about the build-dev mailing list