From 6dd5eaceb1acd15136f53c35b251120e30025b77 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 10 Feb 2011 18:52:50 -0500 Subject: [PATCH] Don't print loop attributes if user didn't explicitly specify one. --- utils/mojoshader-compiler.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/utils/mojoshader-compiler.c b/utils/mojoshader-compiler.c index d5a6bf49..3258fe42 100644 --- a/utils/mojoshader-compiler.c +++ b/utils/mojoshader-compiler.c @@ -56,12 +56,24 @@ static void fail(const char *err) 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)