[Piglit] [PATCH v8] Port basic GL rendering test from Glean to Piglit

Brian Paul brianp at vmware.com
Thu Sep 17 12:01:47 PDT 2015


On 09/17/2015 12:58 PM, Emil Velikov wrote:
> Hi Brian,
>
> On 17 September 2015 at 18:12, Brian Paul <brianp at vmware.com> wrote:
>> Just a few more minor things...
>>
>>
>>
>> On 09/16/2015 03:23 PM, Juliet Fru wrote:
>
>>> --- /dev/null
>>> +++ b/tests/spec/gl-1.0/no-op-paths.c
>>> @@ -0,0 +1,305 @@
>
>>> +enum path
>>> +{
>>> +       ALPHA,
>>> +       BLEND,
>>> +       COLOR_MASK,
>>> +       DEPTH,
>>> +       LOGIC,
>>> +       SCISSOR,
>>> +       STENCIL,
>>> +       STIPPLE,
>>> +       TEXTURE,
>>> +       NUM_PATHS               /* end-of-list token */
>>> +};
>>> +
>
>>> +const char *
>>> +path_name(enum path paths)
>>> +{
>>> +       switch (paths) {
>>> +       case ALPHA:
>>> +               return "Alpha Test";
>>> +       case BLEND:
>>> +               return "Blending";
>>> +       case COLOR_MASK:
>>> +               return "Color Mask";
>>> +       case DEPTH:
>>> +               return "Depth Test";
>>> +       case LOGIC:
>>> +               return "LogicOp";
>>> +       case SCISSOR:
>>> +               return "Scissor Test";
>>> +       case STENCIL:
>>> +               return "Stencil Test";
>>> +       case STIPPLE:
>>> +               return "Polygon Stipple";
>>> +       case TEXTURE:
>>> +               return "Modulated Texture";
>>> +       case NUM_PATHS:
>>> +               return "paths";
>>
>>
>> We need a default case here just to silence a compiler warning. Something
>> like:
>>
>>          default:
>>                  return "BAD PATH VALUE!";
>>
> I believe I'm the one to blame for the missing default statement here.
> Afaics every value of the enum is handled so if the compiler is
> throwing a warning, it has gone bonkers :-)
>
> Just throwing it out there.
>
> -Emil
>

Without the default clause I see:

/home/brianp/pig/tests/spec/gl-1.0/no-op-paths.c: In function ‘path_name’:
/home/brianp/pig/tests/spec/gl-1.0/no-op-paths.c:107:1: warning: control 
reaches end of non-void function [-Wreturn-type]
  }
  ^

Adding a return "BAD PATH VALUE!"; after the switch would also work.

-Brian


More information about the Piglit mailing list