Fix a bunch of unused-but-set-variable compiler warnings with gcc 4.6
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 8 Jul 2011 23:27:31 +0000 (00:27 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 8 Jul 2011 23:27:31 +0000 (00:27 +0100)
Which cause compilation with -Werror to fail.

orc-test/orctest.c
orc/orcparse.c
testsuite/generate_xml_table2.c
testsuite/memcpy_speed.c

index 061bb78..71c701f 100644 (file)
 
 #define MIN_NONDENORMAL (1.1754944909521339405e-38)
 
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define ORC_GNUC_UNUSED __attribute__((__unused__))
+#else
+#define ORC_GNUC_UNUSED
+#endif
+
 void _orc_profile_init(void);
 
 OrcRandomContext rand_context;
@@ -535,7 +541,7 @@ orc_test_compare_output_full (OrcProgram *program, int flags)
   int i;
   int j;
   int k;
-  int have_dest = FALSE;
+  int have_dest ORC_GNUC_UNUSED = FALSE;
   OrcCompileResult result;
   int have_acc = FALSE;
   int acc_exec = 0, acc_emul = 0;
@@ -776,7 +782,7 @@ orc_test_get_program_for_opcode (OrcStaticOpcode *opcode)
 {
   OrcProgram *p;
   char s[40];
-  int flags = 0;
+  int flags ORC_GNUC_UNUSED = 0;
   int args[4] = { -1, -1, -1, -1 };
   int n_args = 0;
 
@@ -833,7 +839,7 @@ orc_test_get_program_for_opcode_const (OrcStaticOpcode *opcode)
   OrcProgram *p;
   char s[40];
   int args[4] = { -1, -1, -1, -1 };
-  int flags;
+  int flags ORC_GNUC_UNUSED;
   int n_args = 0;
 
   p = orc_program_new ();
@@ -882,7 +888,7 @@ orc_test_get_program_for_opcode_param (OrcStaticOpcode *opcode)
   OrcProgram *p;
   char s[40];
   int args[4] = { -1, -1, -1, -1 };
-  int flags;
+  int flags ORC_GNUC_UNUSED;
   int n_args = 0;
 
   if (opcode->src_size[1] == 0) {
index 975e766..ae61867 100644 (file)
@@ -285,8 +285,8 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log)
 
         for(i=offset+1;i<n_tokens;i++){
           char *end;
-          double d;
-          d = strtod (token[i], &end);
+
+          (void) strtod (token[i], &end);
           if (end != token[i]) {
             orc_program_add_constant_str (parser->program, 0, token[i],
                 token[i]);
index 750d840..3d978c3 100644 (file)
@@ -19,29 +19,9 @@ main (int argc, char *argv[])
 {
   int i;
   OrcOpcodeSet *opcode_set;
-  OrcTarget *targets[10];
-  unsigned int target_flags[10];
-  int n_targets;
 
   orc_init();
   orc_test_init();
-
-  targets[0] = orc_target_get_by_name("sse");
-  target_flags[0] = orc_target_get_default_flags(targets[0]);
-
-  targets[1] = orc_target_get_by_name("mmx");
-  target_flags[1] = orc_target_get_default_flags(targets[1]);
-
-  targets[2] = orc_target_get_by_name("altivec");
-  target_flags[2] = orc_target_get_default_flags(targets[2]);
-
-  targets[3] = orc_target_get_by_name("arm");
-  target_flags[3] = orc_target_get_default_flags(targets[3]);
-
-  targets[4] = orc_target_get_by_name("c64x-c");
-  target_flags[4] = orc_target_get_default_flags(targets[4]);
-
-  n_targets=5;
   
   printf(
 "<table frame=\"all\" id=\"table-basictypes\" xreflabel=\"Table of Opcodes\">\n"
index 73b1ec0..dda3de7 100644 (file)
@@ -82,6 +82,11 @@ main(int argc, char *argv[])
     orc_program_append (p, "copyb", ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1);
 
     result = orc_program_compile (p);
+
+    if (ORC_COMPILE_RESULT_IS_FATAL (result)) {
+      fprintf (stderr, "Failed to compile orc_memcpy\n");
+      return -1;
+    }
   }
 
 #ifndef M_LN2