JDK-8223264 <https://bugs.openjdk.java.net/browse/JDK-8223264> has been filed to address this.

/Andy


On 5/2/2019 2:25 PM, Phil Race wrote:
Although our build system doesn't complain, my local Linux gcc generates several warnings which prevent jpackage from building. The attached patch makes it happy.


There are several of these :-

jpackage/open/src/jdk.jpackage/share/native/libapplauncher/IniFile.cpp: In member function ‘virtual bool IniFile::GetSection(TString, OrderedMap<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)’: /home/prrace/jpackage/open/src/jdk.jpackage/share/native/libapplauncher/IniFile.cpp:192:25: error: ‘section’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
         IniSectionData* section;

A couple of complains about not checking the return value of chdir. My patch throws an exception
which I think is better than ignoring it and using the wrong directory.
jpackage/open/src/jdk.jpackage/linux/native/libapplauncher/LinuxPlatform.cpp: In member function ‘virtual void LinuxPlatform::SetCurrentDirectory(TString)’: /home/prrace/jpackage/open/src/jdk.jpackage/linux/native/libapplauncher/LinuxPlatform.cpp:129:52: error: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Werror=unused-result]
     chdir(PlatformString(Value).toPlatformString());

                                                    ^

And this :
jpackage/open/src/jdk.jpackage/unix/native/libapplauncher/PosixPlatform.cpp: In member function ‘virtual void PosixProcess::SetInput(TString)’: /home/prrace/jpackage/open/src/jdk.jpackage/unix/native/libapplauncher/PosixPlatform.cpp:313:56: error: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
         write(FInputHandle, Value.data(), Value.size());
                                                        ^
cc1plus: all warnings being treated as errors


-phil.

Reply via email to