qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] qemu/compiler: Simplify as all compilers support attribu


From: Peter Maydell
Subject: Re: [PATCH 1/3] qemu/compiler: Simplify as all compilers support attribute 'gnu_printf'
Date: Mon, 28 Sep 2020 14:43:03 +0100

On Mon, 28 Sep 2020 at 14:37, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Since commit efc6c070aca ("configure: Add a test for the minimum
> compiler version") the minimum compiler version required for GCC
> is 4.8, which supports the gnu_printf attribute.
>
> We can safely remove the code introduced in commit 9c9e7d51bf0
> ("Move macros GCC_ATTR and GCC_FMT_ATTR to common header file").

clang doesn't support the gnu_printf attribute, though:

$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ cat /tmp/zz9.c
#include <stdio.h>

int monitor_printf(void *mon, const char *fmt, ...)
__attribute__((format(gnu_printf, 2, 3)));

int main(void) {
  printf("hello\n");
  return 0;
}
$ clang -Wall -o /tmp/zz9  /tmp/zz9.c
/tmp/zz9.c:3:68: warning: 'format' attribute argument not supported:
gnu_printf [-Wignored-attributes]
int monitor_printf(void *mon, const char *fmt, ...)
__attribute__((format(gnu_printf, 2, 3)));
                                                                   ^
1 warning generated.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]