From patchwork Fri Sep 24 14:49:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 65653 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 74D39B7103 for ; Sat, 25 Sep 2010 00:50:00 +1000 (EST) Received: (qmail 23627 invoked by alias); 24 Sep 2010 14:49:57 -0000 Received: (qmail 23616 invoked by uid 22791); 24 Sep 2010 14:49:55 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Sep 2010 14:49:50 +0000 Received: (qmail 16080 invoked from network); 24 Sep 2010 14:49:48 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Sep 2010 14:49:48 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.69) (envelope-from ) id 1Oz9at-0004VZ-8F for gcc-patches@gcc.gnu.org; Fri, 24 Sep 2010 14:49:47 +0000 Date: Fri, 24 Sep 2010 14:49:47 +0000 (UTC) From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org Subject: Fix -undef option handling Message-ID: MIME-Version: 1.0 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 My patch broke building glibc because it taught the .opt machinery about the -u option, as a driver option, causing the driver to treat "-undef" as "-u ndef", so breaking the -undef option and causing the glibc build process, when preprocessing shlib-versions files, to expand "linux" to "1". (In cases where an option on the command line matches multiple .opt entries, one with the language matching is preferred to one where it does not match.) This patch fixes this by adding a "Driver" entry for the -undef option. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to commit? 2010-09-24 Joseph Myers * common.opt (undef): New. testsuite: 2010-09-24 Joseph Myers * gcc.dg/cpp/undef-opt-1.c: New test. Index: gcc/testsuite/gcc.dg/cpp/undef-opt-1.c =================================================================== --- gcc/testsuite/gcc.dg/cpp/undef-opt-1.c (revision 0) +++ gcc/testsuite/gcc.dg/cpp/undef-opt-1.c (revision 0) @@ -0,0 +1,8 @@ +/* Test -undef. A bug in its handling broke glibc builds because + "linux" was wrongly defined. */ +/* { dg-do preprocess } */ +/* { dg-options "-undef" } */ + +#ifdef linux +#error -undef broken +#endif Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 164532) +++ gcc/common.opt (working copy) @@ -1924,6 +1924,10 @@ u Driver Joined Separate +undef +Driver +; C option, but driver must not handle as "-u ndef". + v Driver