Don't print loop attributes if user didn't explicitly specify one.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 10 Feb 2011 18:52:50 -0500
changeset 992 a951ce8bf2ec
parent 991 8999b4b9eaa6
child 993 426ab31f27d1
Don't print loop attributes if user didn't explicitly specify one.
utils/mojoshader-compiler.c
--- a/utils/mojoshader-compiler.c	Thu Feb 10 18:37:29 2011 -0500
+++ b/utils/mojoshader-compiler.c	Thu Feb 10 18:52:50 2011 -0500
@@ -56,12 +56,24 @@
 
 static void print_unroll_attr(FILE *io, const int unroll)
 {
-    if (unroll == 0)
-        fprintf(io, "[loop] ");
-    else if (unroll < 0)
-        fprintf(io, "[unroll] ");
-    else
-        fprintf(io, "[unroll(%d)] ", unroll);
+    // -1 means "unroll at compiler's discretion",
+    // -2 means user didn't specify the attribute.
+    switch (unroll)
+    {
+        case 0:
+            fprintf(io, "[loop] ");
+            break;
+        case -1:
+            fprintf(io, "[unroll] ");
+            break;
+        case -2:
+            /* no-op. */
+            break;
+        default:
+            assert(unroll > 0);
+            fprintf(io, "[unroll(%d)] ", unroll);
+            break;
+    } // case
 } // print_unroll_attr
 
 static void print_ast_datatype(FILE *io, const MOJOSHADER_astDataType *dt)