From patchwork Mon Feb 14 19:14:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 83152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 78F40B6EE8 for ; Tue, 15 Feb 2011 06:17:55 +1100 (EST) Received: (qmail 23203 invoked by alias); 14 Feb 2011 19:17:53 -0000 Received: (qmail 23193 invoked by uid 22791); 14 Feb 2011 19:17:52 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 19:17:46 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 29699CB0275 for ; Mon, 14 Feb 2011 20:17:44 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ANhD1d9BKsqT for ; Mon, 14 Feb 2011 20:17:35 +0100 (CET) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 9C54BCB023F for ; Mon, 14 Feb 2011 20:17:35 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix error detection for -I Date: Mon, 14 Feb 2011 20:14:00 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201102142014.00673.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This is a regression present on the mainline. The Ada compiler fails to diagnose a missing argument for -I when there is a -gnat switch next. Fixed thusly, tested on i586-suse-linux, applied on the mainline. 2011-02-14 Eric Botcazou * gcc-interface/misc.c (gnat_init_options): Do not concatenate -I and its argument, except for the special -I- switch. 2011-02-14 Eric Botcazou * gnat.dg/include.adb: New test. Index: gcc-interface/misc.c =================================================================== --- gcc-interface/misc.c (revision 169914) +++ gcc-interface/misc.c (working copy) @@ -195,13 +195,12 @@ gnat_init_options (unsigned int decoded_ || num_elements == 0) continue; - if (decoded_options[i].opt_index == OPT_I) - { - gcc_assert (num_elements == 2); - save_argv[save_argc++] - = concat (decoded_options[i].canonical_option[0], - decoded_options[i].canonical_option[1], NULL); - } + /* Deal with -I- specially since it must be a single switch. */ + if (decoded_options[i].opt_index == OPT_I + && num_elements == 2 + && decoded_options[i].canonical_option[1][0] == '-' + && decoded_options[i].canonical_option[1][1] == '\0') + save_argv[save_argc++] = "-I-"; else { gcc_assert (num_elements >= 1 && num_elements <= 2);