]> sourceware.org Git - systemtap.git/commitdiff
Fix -Wformat-nonliteral and -Wformat warnings with clang
authorTimm Bäder <tbaeder@redhat.com>
Wed, 19 May 2021 20:59:35 +0000 (16:59 -0400)
committerAaron Merey <amerey@redhat.com>
Wed, 19 May 2021 20:59:35 +0000 (16:59 -0400)
stapbpf/stapbpf.cxx
staprun/common.c
tapsets.cxx

index 59f794718688abafb503876d9122b57e9abf9ae6..153186adf110b1056f7de26fa1922437adad9c0a 100644 (file)
@@ -269,7 +269,7 @@ static std::vector<uprobe_data> uprobes;
 
 // TODO: Move fatal() to bpfinterp.h and replace abort() calls in the interpreter.
 // TODO: Add warn() option.
-static void __attribute__((noreturn))
+static void __attribute__((noreturn))  __attribute__ ((format (printf, 1, 2)))
 fatal(const char *str, ...)
 {
   if (module_name)
@@ -796,7 +796,7 @@ kprobe_collect_from_syms(Elf_Data *sym_data, Elf_Data *str_data)
       if (syms[i].st_name < str_data->d_size)
        name = static_cast<char *>(str_data->d_buf) + syms[i].st_name;
       else
-       fatal("symbol %u has invalid string index\n", i);
+       fatal("symbol %zu has invalid string index\n", i);
       maybe_collect_kprobe(name, i, syms[i].st_shndx, syms[i].st_value);
     }
 }
index 42c18b7d18f8fd78ff5ef04f257d3f2c61e16fda..e8b54266215e22dfcf2d5224593478d1bad42c66 100644 (file)
@@ -679,6 +679,7 @@ int send_request(int type, void *data, int len)
 
 static int use_syslog = 0;
 
+ __attribute__ ((format (printf, 1, 2)))
 void eprintf(const char *fmt, ...)
 {
        va_list va;
@@ -708,7 +709,7 @@ void print_color(const char *type)
                char *seq = parse_stap_color(type);
                if (seq != NULL) {
                        eprintf("\033[");
-                       eprintf(seq);
+                       eprintf("%s", seq);
                        eprintf("m\033[K");
                        free(seq);
                }
index 9f28612b92522258300107af5ce88b91a2863a1f..86eaf1a65ffb09d374ec80237487363f30e3481f 100644 (file)
@@ -10360,12 +10360,9 @@ kprobe_derived_probe::kprobe_derived_probe (systemtap_session& sess,
 
 void kprobe_derived_probe::printsig (ostream& o) const
 {
-  bool nest = true;
   sole_location()->print (o);
   o << " /* " << " name = " << symbol_name << "*/";
-
-  if (nest)
-    printsig_nested (o);
+  printsig_nested (o);
 }
 
 void kprobe_derived_probe::join_group (systemtap_session& s)
This page took 0.045123 seconds and 5 git commands to generate.