From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id C5429393BC3D for ; Mon, 30 Nov 2020 19:58:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5429393BC3D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-528-NpROB0HEOlqlJ8RuqahJIA-1; Mon, 30 Nov 2020 14:58:47 -0500 X-MC-Unique: NpROB0HEOlqlJ8RuqahJIA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CFC23E74A for ; Mon, 30 Nov 2020 19:58:46 +0000 (UTC) Received: from localhost.localdomain (ovpn-114-226.phx2.redhat.com [10.3.114.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57CA85D6A8; Mon, 30 Nov 2020 19:58:46 +0000 (UTC) From: Tom Stellard To: systemtap@sourceware.org Subject: [PATCH 7/8] Fix -Wformat-nonliteral and -Wformat warnings with clang Date: Mon, 30 Nov 2020 19:58:40 +0000 Message-Id: <20201130195841.26142-8-tstellar@redhat.com> In-Reply-To: <20201130195841.26142-1-tstellar@redhat.com> References: <20201130195841.26142-1-tstellar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-15.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 19:58:50 -0000 --- stapbpf/stapbpf.cxx | 4 ++-- staprun/common.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stapbpf/stapbpf.cxx b/stapbpf/stapbpf.cxx index 933164851..7b614015a 100644 --- a/stapbpf/stapbpf.cxx +++ b/stapbpf/stapbpf.cxx @@ -246,7 +246,7 @@ static std::vector 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) @@ -773,7 +773,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(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); } } diff --git a/staprun/common.c b/staprun/common.c index 6a603cd2b..6f1b3d683 100644 --- a/staprun/common.c +++ b/staprun/common.c @@ -683,6 +683,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; @@ -712,7 +713,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); } -- 2.26.2