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

Turn on the -Wreturn-type warning

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b42

      Backports

        Description

        I propose that we patch HotSpot and start compiling with the -Wreturn-type warning. This will help us catch missing return statements earlier in the development cycle.

        From:
        https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

        "-Wreturn-type
            Warn whenever a function is defined with a return type that defaults to int. Also warn about any return statement with no return value in a function whose return type is not void (falling off the end of the function body is considered returning without a value), and about a return statement with an expression in a function whose return type is void.

            For C++, a function without return type always produces a diagnostic message, even when -Wno-return-type is specified. The only exceptions are ‘main’ and functions defined in system headers.

            This warning is enabled by -Wall. "

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  stefank Stefan Karlsson
                  Reporter:
                  stefank Stefan Karlsson
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: