On 01/02/2015 11:50 AM, Matt Turner wrote:
On Fri, Jan 2, 2015 at 9:38 AM, Brian Paul <[email protected]> wrote:
On 12/20/2014 10:51 AM, Matt Turner wrote:

On Sat, Dec 20, 2014 at 4:34 AM, Brian Paul <[email protected]> wrote:

---
   src/mesa/drivers/common/meta.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/common/meta.c
b/src/mesa/drivers/common/meta.c
index 87532c1..f479b1c 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3177,7 +3177,7 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
   {
      if (_mesa_is_format_compressed(texImage->TexFormat)) {
         GLuint slice;
-      bool result;
+      bool result = true;


This looks like a case where I'd put an

      assume(texImage->Depth > 0)

immediately above the for loop.

         for (slice = 0; slice < texImage->Depth; slice++) {
            void *dst;


That way, the compiler gets the information it needs, and we don't add
any extra .data.


I'm not sure that'd help.  In a release build, assert will be a no-op and I
doubt all compilers use assertions to figure out this sort of thing anyway.

I'm suggesting using assume() rather than assert(). assume() will work
in release builds too so I think we should be fine.

Ugh, I misread what you wrote.  Sorry.

Unfortunately, I still get the warning when I use assume(). The compiler in question is MinGW gcc 4.6.3 which apparently doesn't have __builtin_assume().

I think I'd like to go with my original patch as-is for now. The MinGW build has very few warnings otherwise.

-Brian

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to