libctf, testsuite: fix various warnings in tests
authorNick Alcock <nick.alcock@oracle.com>
Mon, 27 Sep 2021 19:31:21 +0000 (20:31 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 27 Sep 2021 19:31:26 +0000 (20:31 +0100)
These warnings are all off by default, but if they do fire you get
spurious ERRORs when running make check-libctf.

libctf/ChangeLog
2021-09-27  Nick Alcock  <nick.alcock@oracle.com>

* testsuite/libctf-lookup/enum-symbol.c: Remove unused label.
* testsuite/libctf-lookup/conflicting-type-syms.c: Remove unused
variables.
* testsuite/libctf-regression/pptrtab.c: Likewise.
* testsuite/libctf-regression/type-add-unnamed-struct.c: Likewise.
* testsuite/libctf-writable/pptrtab.c: Likewise.
* testsuite/libctf-writable/reserialize-strtab-corruption.c:
Likewise.
* testsuite/libctf-regression/nonstatic-var-section-ld-r.c: Fix
format string.
* testsuite/libctf-regression/nonstatic-var-section-ld.c:
Likewise.
* testsuite/libctf-regression/nonstatic-var-section-ld.lk: Adjust.
* testsuite/libctf-writable/symtypetab-nonlinker-writeout.c: Fix
initializer.

libctf/ChangeLog
libctf/testsuite/libctf-lookup/conflicting-type-syms.c
libctf/testsuite/libctf-lookup/enum-symbol.c
libctf/testsuite/libctf-regression/nonstatic-var-section-ld-r.c
libctf/testsuite/libctf-regression/nonstatic-var-section-ld.c
libctf/testsuite/libctf-regression/nonstatic-var-section-ld.lk
libctf/testsuite/libctf-regression/pptrtab.c
libctf/testsuite/libctf-regression/type-add-unnamed-struct.c
libctf/testsuite/libctf-writable/pptrtab.c
libctf/testsuite/libctf-writable/reserialize-strtab-corruption.c
libctf/testsuite/libctf-writable/symtypetab-nonlinker-writeout.c

index 66423cfa48c69b3c54cb545660d415fe629899dd..e66cf2a88ea4d8b7cdca3f733bc0282d94e003e1 100644 (file)
@@ -1,3 +1,21 @@
+2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
+
+       * testsuite/libctf-lookup/enum-symbol.c: Remove unused label.
+       * testsuite/libctf-lookup/conflicting-type-syms.c: Remove unused
+       variables.
+       * testsuite/libctf-regression/pptrtab.c: Likewise.
+       * testsuite/libctf-regression/type-add-unnamed-struct.c: Likewise.
+       * testsuite/libctf-writable/pptrtab.c: Likewise.
+       * testsuite/libctf-writable/reserialize-strtab-corruption.c:
+       Likewise.
+       * testsuite/libctf-regression/nonstatic-var-section-ld-r.c: Fix
+       format string.
+       * testsuite/libctf-regression/nonstatic-var-section-ld.c:
+       Likewise.
+       * testsuite/libctf-regression/nonstatic-var-section-ld.lk: Adjust.
+       * testsuite/libctf-writable/symtypetab-nonlinker-writeout.c: Fix
+       initializer.
+
 2021-09-27  Nick Alcock  <nick.alcock@oracle.com>
 
        * ctf-open.c (ctf_bufopen_internal): Don't complain about corrupt
index ffe6983e250598defb5b8ff9cecb10bed86236e8..239b8775964b41bf32483c9e192dbcd5b70dd800 100644 (file)
@@ -12,9 +12,6 @@ main (int argc, char *argv[])
   int err;
   ctf_id_t a, b, ignore1, ignore2, tmp;
   char *foo;
-  ctf_next_t *i = NULL;
-  const char *name;
-  int val;
 
   if (argc != 2)
     {
index c67478fe780f3d2b2082089da80e5aca40526ba0..1244c9004345bf901a35d4544a9d67d8ba70f5f0 100644 (file)
@@ -57,9 +57,6 @@ main (int argc, char *argv[])
   fprintf (stderr, "%s: Symbol re-lookup error (caching bug): %s\n", argv[0],
           ctf_errmsg (err));
   return 1;
- err:
-  fprintf (stderr, "Lookup failed: %s\n", ctf_errmsg (ctf_errno (fp)));
-  return 1;
  nerr:
   fprintf (stderr, "iteration failed: %s\n", ctf_errmsg (ctf_errno (fp)));
   return 1;
index 2fa761a1d03d5cc3f781563fded434f88ebcdef8..6ae2ea53042db059f316c1220273fd002e91a2fd 100644 (file)
@@ -31,12 +31,12 @@ main (int argc, char *argv[])
      ld -r link.  */
 
   if ((foo_type = ctf_lookup_variable (fp, "foo")) == CTF_ERR)
-    printf ("Cannot look up foo\n", ctf_errmsg (ctf_errno (fp)));
+    printf ("Cannot look up foo: %s\n", ctf_errmsg (ctf_errno (fp)));
   else
     printf ("foo is of type %lx\n", foo_type);
 
   if ((bar_type = ctf_lookup_variable (fp, "bar")) == CTF_ERR)
-    printf ("Cannot look up bar\n", ctf_errmsg (ctf_errno (fp)));
+    printf ("Cannot look up bar: %s\n", ctf_errmsg (ctf_errno (fp)));
   else
     printf ("bar is of type %lx\n", bar_type);
 
index 4e3a74842b293bb22784b9f72f0cd920b19e8d7f..93988eb1e8d87e135d32fc948c66f2bc9294dd5b 100644 (file)
@@ -30,12 +30,12 @@ main (int argc, char *argv[])
      should have been erased.  */
 
   if ((foo_type = ctf_lookup_variable (fp, "foo")) == CTF_ERR)
-    printf ("Cannot look up foo\n", ctf_errmsg (ctf_errno (fp)));
+    printf ("Cannot look up foo: %s\n", ctf_errmsg (ctf_errno (fp)));
   else
     printf ("foo is of type %lx\n", foo_type);
 
   if ((bar_type = ctf_lookup_variable (fp, "bar")) == CTF_ERR)
-    printf ("Cannot look up bar\n", ctf_errmsg (ctf_errno (fp)));
+    printf ("Cannot look up bar: %s\n", ctf_errmsg (ctf_errno (fp)));
   else
     printf ("bar is of type %lx\n", bar_type);
 
index edb397a333a3ff2ab3390fa5f5db5048cabb681d..2ea4d323bfcfcb9389074bbe758752393c73c137 100644 (file)
@@ -2,5 +2,5 @@
 # link: on
 # link_flags: -Wl,--ctf-variables
 foo is of type [0-9a-f]*
-Cannot look up bar
+Cannot look up bar: No type information available for symbol.
 foo missing from the data object section
index fe1b8fe2b4344f676237417614e505f110f74a98..2ef5f9c5cc07310a7db58c6c6e0f468c717d29dc 100644 (file)
@@ -10,7 +10,6 @@ main (int argc, char *argv[])
   ctf_next_t *i = NULL;
   ctf_id_t type;
   const char *arcname;
-  char *type_name;
   int err;
 
   if (argc != 2)
index 16ff0948b1710a194ebc3539fc3c655e7a399103..cf10804814ccccd7c89723be1de5f810af8de7ad 100644 (file)
@@ -8,10 +8,8 @@ main (int argc, char *argv[])
   ctf_dict_t *fp;
   ctf_archive_t *ctf;
   ctf_dict_t *dyn;
-  ctf_next_t *i = NULL;
   ctf_id_t type;
   ctf_id_t newtype;
-  const char *memb;
   ctf_membinfo_t mi;
   const char *membs[] = { "bar", "baz", "foo", NULL };
   const char **walk;
index 68c356352d7c626c59cb2eef06e95f1f80e51b21..b8d1e63b9975353bebfbb0bfe0b6e960d4ae0b99 100644 (file)
@@ -7,7 +7,7 @@ main (int argc, char *argv[])
 {
   ctf_dict_t *pfp;
   ctf_dict_t *cfp;
-  ctf_id_t base, base2, ptr, ptr2, type, last_type;
+  ctf_id_t base, base2, ptr, type, last_type;
   ctf_encoding_t encoding = { CTF_INT_SIGNED, 0, sizeof (int) };
   ctf_encoding_t encoding2 = { CTF_INT_SIGNED, 0, sizeof (long) };
   char *type_name;
index 1593325da7771b31dddc97ada88fa159008bae8c..2c9ec8d9ed2d27d6c9353079baa3d28144c4b045 100644 (file)
@@ -13,7 +13,6 @@ main (int argc, char *argv[])
   ctf_snapshot_id_t snap;
   unsigned char *foo;
   size_t foo_size;
-  const char *bar;
   int err;
   char name[64];
 
index bdc3faa944ca729cc84dd80b1132540293f20a88..7a2b88d6dfa124764626083bc68a47a580902939 100644 (file)
@@ -174,10 +174,12 @@ try_maybe_reporting (int report)
   } *expected;
   struct ctf_symtype_expected expected_obj[] = { { "data_a", base2 },
                                                 { "data_b", base3 },
-                                                { "data_c", base }, NULL };
+                                                { "data_c", base },
+                                                { NULL, 0 } };
   struct ctf_symtype_expected expected_func[] = { { "func_a", func2 },
                                                  { "func_b", func3 },
-                                                 { "func_c", func }, NULL };
+                                                 { "func_c", func },
+                                                 { NULL, 0 } };
   expected = expected_obj;
 
   while ((symtype = ctf_symbol_next (fp, &i, &symname, 0)) != CTF_ERR)