Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8223264

jpackage warning cleanup on linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 15
    • 14
    • tools

      reviewer says:
      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());
                                                              ^
      The attached patch should fix this:

            asemenyuk Alexey Semenyuk
            herrick Andy Herrick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: