[PATCH] scanner: Add GCC pragmas to disable -Wredundant-decls

2014-02-15 Thread Jasper St. Pierre
The code very intentionally emits a lot of redundant declarations
to simplify the scanner code. Somebody building with -Wredundant-decls
would have compile errors, so emit special pragmas to turn those
warnings off.

These pragmas should be ignored outside of gcc/clang.
---
 src/scanner.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/scanner.c b/src/scanner.c
index 243ddfd..e8bfc7c 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1165,11 +1165,13 @@ emit_code(struct protocol *protocol)
   "#include \n"
   "#include \"wayland-util.h\"\n\n");
 
+   printf("#pragma GCC diagnostic push\n"
+  "#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n");
wl_list_for_each(i, &protocol->interface_list, link) {
emit_types_forward_declarations(protocol, &i->request_list);
emit_types_forward_declarations(protocol, &i->event_list);
}
-   printf("\n");
+   printf("#pragma GCC diagnostic pop\n\n");
 
printf("static const struct wl_interface *types[] = {\n");
emit_null_run(protocol);
-- 
1.8.5.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] scanner: Add GCC pragmas to disable -Wredundant-decls

2014-02-18 Thread Kristian Høgsberg
On Sat, Feb 15, 2014 at 01:29:16PM -0500, Jasper St. Pierre wrote:
> The code very intentionally emits a lot of redundant declarations
> to simplify the scanner code. Somebody building with -Wredundant-decls
> would have compile errors, so emit special pragmas to turn those
> warnings off.
> 
> These pragmas should be ignored outside of gcc/clang.

Looks good, applied.

Kristian

> ---
>  src/scanner.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/scanner.c b/src/scanner.c
> index 243ddfd..e8bfc7c 100644
> --- a/src/scanner.c
> +++ b/src/scanner.c
> @@ -1165,11 +1165,13 @@ emit_code(struct protocol *protocol)
>  "#include \n"
>  "#include \"wayland-util.h\"\n\n");
>  
> + printf("#pragma GCC diagnostic push\n"
> +"#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n");
>   wl_list_for_each(i, &protocol->interface_list, link) {
>   emit_types_forward_declarations(protocol, &i->request_list);
>   emit_types_forward_declarations(protocol, &i->event_list);
>   }
> - printf("\n");
> + printf("#pragma GCC diagnostic pop\n\n");
>  
>   printf("static const struct wl_interface *types[] = {\n");
>   emit_null_run(protocol);
> -- 
> 1.8.5.3
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel