[Mesa-dev] [PATCH] mesa: fix no return in two format functions

Jan Vesely jan.vesely at rutgers.edu
Fri Jan 16 06:05:58 PST 2015


On Thu, 2015-01-15 at 20:49 +0100, Tobias Klausmann wrote:
> On 15.01.2015 19:35, Jan Vesely wrote:
> > On Thu, 2015-01-15 at 19:26 +0100, Tobias Klausmann wrote:
> >> I: Program returns random data in a function
> >> E: Mesa no-return-in-nonvoid-function ../../src/mesa/main/format_utils.c:180
> >> E: Mesa no-return-in-nonvoid-function ../../src/mesa/main/glformats.c:2714
> > Are these errors generated by a compiler or some kind of analysis tool?
> > Does using unreachable() instead of assert(!) fix the problem?
> >
> > jan
> 
> Thats put out by 'osc'/obs http://openbuildservice.org/ while compiling 
> Mesa for openSuSE, i think that analyzer is just looking for an return 
> if the function has a return type...

In that case it's OK. Though it would be nice to fix the tool to
recognize dead branches.
FWIW, you can add my acked-by, thought you might want to run it by
somebody who is better versed in this code.

jan

> 
> Greetings,
> Tobias
> 
> >
> >> ---
> >>   src/mesa/main/format_utils.c | 1 +
> >>   src/mesa/main/glformats.c    | 1 +
> >>   2 files changed, 2 insertions(+)
> >>
> >> diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
> >> index eb650a2..caf0880 100644
> >> --- a/src/mesa/main/format_utils.c
> >> +++ b/src/mesa/main/format_utils.c
> >> @@ -176,6 +176,7 @@ _mesa_compute_rgba2base2rgba_component_mapping(GLenum baseFormat, uint8_t *map)
> >>         }
> >>      default:
> >>         assert(!"Unexpected base format");
> >> +      return false;
> >>      }
> >>   }
> >>   
> >> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> >> index 3e913ed..2e16607 100644
> >> --- a/src/mesa/main/glformats.c
> >> +++ b/src/mesa/main/glformats.c
> >> @@ -2711,4 +2711,5 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
> >>       * format in that case.
> >>       */
> >>      assert(!"Unsupported format");
> >> +   return MESA_FORMAT_NONE;
> >>   }
> 

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150116/08173770/attachment.sig>


More information about the mesa-dev mailing list