From patchwork Mon Dec 5 22:38:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 702922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tXfnR53tfz9sfH for ; Tue, 6 Dec 2016 09:39:07 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 30D5FB6E; Mon, 5 Dec 2016 22:39:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 32037B6D for ; Mon, 5 Dec 2016 22:39:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1857E1A7 for ; Mon, 5 Dec 2016 22:39:02 +0000 (UTC) Received: from mfilter16-d.gandi.net (mfilter16-d.gandi.net [217.70.178.144]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 6595DC5A65; Mon, 5 Dec 2016 23:39:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter16-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter16-d.gandi.net (mfilter16-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id grKEqHJ-nzZp; Mon, 5 Dec 2016 23:38:59 +0100 (CET) X-Originating-IP: 208.91.2.3 Received: from sigabrt.benpfaff.org (unknown [208.91.2.3]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 9C292C5A4F; Mon, 5 Dec 2016 23:38:58 +0100 (CET) From: Ben Pfaff To: dev@openvswitch.org Date: Mon, 5 Dec 2016 14:38:50 -0800 Message-Id: <20161205223853.29234-1-blp@ovn.org> X-Mailer: git-send-email 2.10.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 1/4] acinclude: Fix -Wstrict-prototypes and -Wold-style-definition detection. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org AC_LANG_PROGRAM(,) uses a program like this: int main() { return 0; } but that triggers warnings for -Wstrict-prototypes and for -Wold-style-definition, since this definition of main() lacks a prototype and is therefore old-style. This meant that -Wstrict-prototypes and -Wold-style-definition weren't being turned on for new-enough GCC. This commit fixes the problem by changing the program that is test-compiled to: int x; which doesn't make any compilers mad, as far as I know. I recently upgraded to GCC 6.1 and just now noticed the issue, so I think that GCC somewhere between version 4.9 and version 6.1 must have started warning about main() when it's declared this way. Also, fix a few functions that lacked prototypes. Signed-off-by: Ben Pfaff Acked-by: Andy Zhou --- acinclude.m4 | 12 ++++++++++-- lib/perf-counter.c | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index c4f331c..d253dee 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,6 +1,6 @@ # -*- autoconf -*- -# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. +# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -784,7 +784,15 @@ AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl dnl 0 dnl % CFLAGS="$CFLAGS $WERROR $1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [if test -s conftest.err && grep "unrecognized option" conftest.err; then ovs_cv_name[]=no; else ovs_cv_name[]=yes; fi], [ovs_cv_name[]=no]) + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int x;])], + [if test -s conftest.err && grep "unrecognized option" conftest.err + then + ovs_cv_name[]=no + else + ovs_cv_name[]=yes + fi], + [ovs_cv_name[]=no]) CFLAGS="$ovs_save_CFLAGS"]) if test $ovs_cv_name = yes; then m4_if([$2], [], [:], [$2]) diff --git a/lib/perf-counter.c b/lib/perf-counter.c index da60df7..c4458d2 100644 --- a/lib/perf-counter.c +++ b/lib/perf-counter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Nicira, Inc. + * Copyright (c) 2015, 2016 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,7 +146,7 @@ perf_counters_to_ds(struct ds *ds) * Caller is responsible for free memory. */ char * -perf_counters_to_string() +perf_counters_to_string(void) { struct ds ds; @@ -176,7 +176,7 @@ perf_counters_clear(void) } void -perf_counters_destroy() +perf_counters_destroy(void) { struct shash_node *node, *next;