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

jpackage warning cleanup on linux

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 14
    • Fix Version/s: 15
    • Component/s: tools
    • Labels:

      Description

      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:

        Attachments

          Activity

            People

            • Assignee:
              asemenyuk Alexey Semenyuk
              Reporter:
              herrick Andy Herrick
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: