<AWT Dev> <Swing Dev> RFR(XXS): 8163408: Fix wrong prototype of getNativeScaleFactor() in systemScale.h

Volker Simonis volker.simonis at gmail.com
Wed Aug 10 16:43:03 UTC 2016


Thanks Sergey!

Finally I also found out why I couldn't see this problem with other compilers.

-Wunprototyped-calls seems to be an undocumented Suse extension which
is only available on SLES/OpenSuse GCC builds. Somehow it  never made
its way into upstream GCC. The only reference I could find is the
following mail thread on the GCC mailing list:

https://gcc.gnu.org/ml/gcc-patches/2013-04/threads.html#00363

Regards,
Volker


On Wed, Aug 10, 2016 at 4:31 PM, Sergey Bylokhov
<Sergey.Bylokhov at oracle.com> wrote:
> Looks fine.
>
>
> On 09.08.16 10:37, Volker Simonis wrote:
>>
>> I've just send the RFR to the same list on which the offending change
>> 8149115 has been reviewed.
>>
>> But I'm fine with any list, as long as the change gets reviewed :)
>>
>> Regards,
>> Volker
>>
>> On Mon, Aug 8, 2016 at 10:39 PM, Alexander Scherbatiy
>> <alexandr.scherbatiy at oracle.com> wrote:
>>>
>>> The fix should be reviewed on the awt-dev alias.
>>>
>>>
>>> On 08/08/16 22:36, Volker Simonis wrote:
>>>>
>>>>
>>>> Hi,
>>>>
>>>> can I please have a review for the following trivial fix:
>>>>
>>>> http://cr.openjdk.java.net/~simonis/webrevs/2016/8163408/
>>>> https://bugs.openjdk.java.net/browse/JDK-8163408
>>>>
>>>> I'd like to push this directly to jdk9/dev if possible because the
>>>> problem has already spread across all the other repos and I'd like to
>>>> fix it as fast as possible in all repos.
>>>>
>>>> The fix for "8149115: [hidpi] Linux: display-wise scaling factor
>>>> should probably be taken into account" changed the prototype for
>>>> getNativeScaleFactor() in systemScale.h from:
>>>>
>>>> int getNativeScaleFactor();
>>>>
>>>> to
>>>>
>>>> double getNativeScaleFactor();
>>>>
>>>> But forgot to add the "char*" parameter to the signature which is
>>>> required by the implementation in systemScale.c (and the various call
>>>> sites):
>>>>
>>>> double getNativeScaleFactor(char *output_name) {
>>>>
>>>> This leads to the following waring/error:
>>>>
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c:
>>>> In function ‘Ja
>>>> va_sun_awt_X11GraphicsDevice_getNativeScaleFactor’:
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c:2185:5:
>>>> error: c
>>>> all to function ‘getNativeScaleFactor’ without a real prototype
>>>> [-Werror=unprototyped-calls]
>>>>       double scale = getNativeScaleFactor(name);
>>>>       ^
>>>> In file included from
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Graphics
>>>> Env.c:46:0:
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/common/awt/systemscale/systemScale.h:29:8:
>>>> note: ‘
>>>> getNativeScaleFactor’ was declared here
>>>>   double getNativeScaleFactor();
>>>>          ^
>>>> cc1: all warnings being treated as errors
>>>>
>>>> If we fix that we will get:
>>>>
>>>>
>>>>
>>>> /usr/work/d046063/OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c:
>>>> In function ‘S
>>>> plashGetScaledImageName’:
>>>>
>>>>
>>>> /usr/work/d046063/OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c:809:5:
>>>> error: t
>>>> oo few arguments to function ‘getNativeScaleFactor’
>>>>       *scaleFactor = getNativeScaleFactor();
>>>>       ^
>>>>
>>>> I observed these warnings/errors with 4.8.5 and it is a miracle for me
>>>> why newer versions of GCC (apparently 4.9.2 which seems to be Oracles
>>>> officially supported compiler according to
>>>> https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms)
>>>> or gcc 5.4.0 whiohc I've tried on Ubuntu 16.04 don't detect this
>>>> problem?
>>>>
>>>> Thank you and best regards,
>>>> Volker
>>>
>>>
>>>
>
>
> --
> Best regards, Sergey.


More information about the awt-dev mailing list