From patchwork Sat Jul 14 19:11:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 171013 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 6983E2C00D1 for ; Sun, 15 Jul 2012 05:12:26 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342897947; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:From:Date:Message-ID:Subject:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=nHYwD5y mtYlZuA5hZNbDUPm2dUU=; b=kUnCw7P8XwPgOGwtecuPVbyyok1SjeUANVS1iUY IbcAwWyJ4uYBiwKDM6OicbjjPZhuPq+hYoWFbaoGAQF/IOmMW+IxYDirBqiAMMKV dKDlzjd02uwYGklKjw2rdlNyGCVHXPI9hJsin3WZphQ5rUTSO5uECB7fveMGQfzK 3ePM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:MIME-Version:Received:From:Date:Message-ID:Subject:To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=PszsVb5Cl3Up8jOadWGO/g0Ih7g6Bimcrzc1EyTWUl//UArsemm0HUbVQEx5bI gmvsOSzrEE9dkOtalqnbNXHLNoQBUVpAfa6LAm+lGAAo9wJUwHV0h1t40ErRpLd/ ++/4VGfOf5tNR+B0KlK7R557jtBJXTGXqXPWvHF5jKqc8=; Received: (qmail 21231 invoked by alias); 14 Jul 2012 19:12:22 -0000 Received: (qmail 21221 invoked by uid 22791); 14 Jul 2012 19:12:21 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-lb0-f175.google.com (HELO mail-lb0-f175.google.com) (209.85.217.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 Jul 2012 19:12:08 +0000 Received: by lbol5 with SMTP id l5so6499252lbo.20 for ; Sat, 14 Jul 2012 12:12:07 -0700 (PDT) Received: by 10.112.42.164 with SMTP id p4mr2850345lbl.54.1342293127030; Sat, 14 Jul 2012 12:12:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.4.229 with HTTP; Sat, 14 Jul 2012 12:11:46 -0700 (PDT) From: Steven Bosscher Date: Sat, 14 Jul 2012 21:11:46 +0200 Message-ID: Subject: [patch] Move 'tree' accessor macros from flags.h to tree.h To: GCC Patches X-IsSubscribed: yes 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 Hello, tree.h can depend on flags.h (and includes it) but flags.h should not depend on tree.h. The attached patch moves some macros from flags.h to tree.h because they use tree accessor macros. Looks quite obvious to me. Bootstrapped&tested on powerpc64-unknown-linux-gnu and on x86_64-unknown-linux-gnu. Will commit in a few days if no-one objects. Ciao! Steven * flags.h (TYPE_OVERFLOW_WRAPS, TYPE_OVERFLOW_UNDEFINED, TYPE_OVERFLOW_TRAPS, POINTER_TYPE_OVERFLOW_UNDEFINED): Move to tree.h. * tree.h (TYPE_OVERFLOW_WRAPS, TYPE_OVERFLOW_UNDEFINED, TYPE_OVERFLOW_TRAPS, POINTER_TYPE_OVERFLOW_UNDEFINED): New home. Index: flags.h =================================================================== --- flags.h (revision 189482) +++ flags.h (working copy) @@ -106,30 +106,6 @@ #define abi_version_at_least(N) \ (flag_abi_version == 0 || flag_abi_version >= (N)) -/* True if overflow wraps around for the given integral type. That - is, TYPE_MAX + 1 == TYPE_MIN. */ -#define TYPE_OVERFLOW_WRAPS(TYPE) \ - (TYPE_UNSIGNED (TYPE) || flag_wrapv) - -/* True if overflow is undefined for the given integral type. We may - optimize on the assumption that values in the type never overflow. - - IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED - must issue a warning based on warn_strict_overflow. In some cases - it will be appropriate to issue the warning immediately, and in - other cases it will be appropriate to simply set a flag and let the - caller decide whether a warning is appropriate or not. */ -#define TYPE_OVERFLOW_UNDEFINED(TYPE) \ - (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow) - -/* True if overflow for the given integral type should issue a - trap. */ -#define TYPE_OVERFLOW_TRAPS(TYPE) \ - (!TYPE_UNSIGNED (TYPE) && flag_trapv) - -/* True if pointer types have undefined overflow. */ -#define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow) - /* Whether to emit an overflow warning whose code is C. */ #define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c)) Index: tree.h =================================================================== --- tree.h (revision 189482) +++ tree.h (working copy) @@ -1,4 +1,4 @@ -/* Front-end tree definitions for GNU compiler. +/* Definiitions for the ubiquitous 'tree' type for GNU compiler. Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. @@ -1348,6 +1348,30 @@ /* In integral and pointer types, means an unsigned type. */ #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.unsigned_flag) +/* True if overflow wraps around for the given integral type. That + is, TYPE_MAX + 1 == TYPE_MIN. */ +#define TYPE_OVERFLOW_WRAPS(TYPE) \ + (TYPE_UNSIGNED (TYPE) || flag_wrapv) + +/* True if overflow is undefined for the given integral type. We may + optimize on the assumption that values in the type never overflow. + + IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED + must issue a warning based on warn_strict_overflow. In some cases + it will be appropriate to issue the warning immediately, and in + other cases it will be appropriate to simply set a flag and let the + caller decide whether a warning is appropriate or not. */ +#define TYPE_OVERFLOW_UNDEFINED(TYPE) \ + (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow) + +/* True if overflow for the given integral type should issue a + trap. */ +#define TYPE_OVERFLOW_TRAPS(TYPE) \ + (!TYPE_UNSIGNED (TYPE) && flag_trapv) + +/* True if pointer types have undefined overflow. */ +#define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow) + /* Nonzero in a VAR_DECL or STRING_CST means assembler code has been written. Nonzero in a FUNCTION_DECL means that the function has been compiled. This is interesting in an inline function, since it might not need