From patchwork Wed Jul 23 10:57:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 4609921 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E5644C0515 for ; Wed, 23 Jul 2014 10:58:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB72A201CD for ; Wed, 23 Jul 2014 10:58:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AE3A5201E4 for ; Wed, 23 Jul 2014 10:58:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FBCF6E629; Wed, 23 Jul 2014 03:58:11 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 0435A6E628 for ; Wed, 23 Jul 2014 03:58:08 -0700 (PDT) Received: by mail-wi0-f175.google.com with SMTP id ho1so7554872wib.8 for ; Wed, 23 Jul 2014 03:58:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PfP7wOaIV9M/W2qa2Db1lJqQlRIGng7QKj5PvCyrdDU=; b=IMD6lSSPgT4NY8or4tz1NND1KQXabcKa4pOhDMW/ME/sXWvEMo7D3oY+rtdWLy1bGi 2i2A8CJLmyF4pFNczCNYvVHoW80NLcbpeZwAudxPsurXQQwhDQoMD8IlZ0SNLoennXhe 98wWqwHRakTVqrvEICjInhNg1DAt3HRU2REbb3+lC+hIfTZrgQTguwDBQHtm8tNpXlXS pvZ/cOG0luGsdoLb0TFvimaqDbeye1AnKEyzUp70wnu+AQoM91v9dXH+LvOmJw5TU78S wNO6Pp/uginwjbCF6wEyXgmycJjO7equOBd7J+YtbThNOeCiiSPnRJo69WbI/CIsoxdT hGfg== X-Gm-Message-State: ALoCoQkSQDCOvNIBBHZaaKCQGz9DNpAje10+SuawfAEVwbjG3fUARfYShZyrB3Q0IqyII2lF6RNR X-Received: by 10.194.62.167 with SMTP id z7mr665949wjr.112.1406113087426; Wed, 23 Jul 2014 03:58:07 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id de5sm7787760wib.18.2014.07.23.03.58.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jul 2014 03:58:06 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Wed, 23 Jul 2014 11:57:54 +0100 Message-Id: <1406113075-30860-8-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406113075-30860-1-git-send-email-thomas.wood@intel.com> References: <1406113075-30860-1-git-send-email-thomas.wood@intel.com> Cc: daniel.vetter@ffwll.ch Subject: [Intel-gfx] [PATCH i-g-t 7/8] lib: always warn about unknown options X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All tests can now register extra options, so there should not be any unknown options. Signed-off-by: Thomas Wood Reviewed-by: Tim Gore --- lib/igt_core.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index 0867c27..42b22fc 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -362,17 +362,9 @@ static int common_init(int argc, char **argv, ret = -1; goto out; case '?': - if (opterr) { - print_usage(command_str, help_str, true); - ret = -2; - goto out; - } - /* - * Just ignore the error, since the unknown argument - * can be something the caller understands and will - * parse by doing a second getopt scanning. - */ - break; + print_usage(command_str, help_str, true); + ret = -2; + goto out; default: ret = extra_opt_handler(c, option_index); if (ret) @@ -475,18 +467,7 @@ void igt_subtest_init(int argc, char **argv) */ void igt_simple_init(int argc, char **argv) { - int ret; - - /* supress getopt errors about unknown options */ - opterr = 0; - - ret = common_init(argc, argv, NULL, NULL, NULL, NULL); - if (ret < 0) - /* exit with no error for -h/--help */ - exit(ret == -1 ? 0 : ret); - - /* reset opt parsing */ - optind = 1; + common_init(argc, argv, NULL, NULL, NULL, NULL); } /**