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

Turn on the -Wreturn-type warning

XMLWordPrintable

    • gc
    • b42

        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. "

              stefank Stefan Karlsson
              stefank Stefan Karlsson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: