From patchwork Wed Nov 21 20:21:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 200839 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 7CF862C0094 for ; Thu, 22 Nov 2012 07:22:21 +1100 (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=1354134142; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=QgvRg7p2GBhpBUMfq3xtwoVUUiI=; b=d1L+TdGKn4hZRh3ML/FjlIgzb5F4dLtEGL/ukT/vLOsHUSvtrcAaiMnI/X30kX nEWT6VmAFyzlh88j+t91OZJrWH/Tl5sMu02YrspZa+QHZTuqDix7uQxD+0DmJEqH hNdceUVdPHl7853hJ+y4gC0w2VyN3ee6vSKRWo2GND3QI= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Aca+u9yjvLDeYDNUgL+G9GafO5wdxsnbQAN387hwaUHDHlApSKDtQMBMWinFdk Lfm0nVmRX8HWYW799q/QHKG0xMpgAqGJ75oz56vuCKnpHehvbc6SRgYHdjO+VhMJ mJBuExRzB3GwohM+BYLy/5GfniE+HyNgRsD4ZnWBmFJHY=; Received: (qmail 13794 invoked by alias); 21 Nov 2012 20:22:06 -0000 Received: (qmail 13780 invoked by uid 22791); 21 Nov 2012 20:22:04 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qc0-f175.google.com (HELO mail-qc0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Nov 2012 20:21:57 +0000 Received: by mail-qc0-f175.google.com with SMTP id j3so5493092qcs.20 for ; Wed, 21 Nov 2012 12:21:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.201.73 with SMTP id ez9mr19667158qab.92.1353529315932; Wed, 21 Nov 2012 12:21:55 -0800 (PST) Received: by 10.49.12.210 with HTTP; Wed, 21 Nov 2012 12:21:55 -0800 (PST) In-Reply-To: <20121121201205.GE2315@tucnak.redhat.com> References: <20121121201205.GE2315@tucnak.redhat.com> Date: Wed, 21 Nov 2012 12:21:55 -0800 Message-ID: Subject: Re: What CPP macro should -fsanitize=address define? From: "H.J. Lu" To: Jakub Jelinek Cc: Konstantin Serebryany , 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 On Wed, Nov 21, 2012 at 12:12 PM, Jakub Jelinek wrote: > On Wed, Nov 21, 2012 at 11:25:35AM -0800, H.J. Lu wrote: >> 2012-11-21 H.J. Lu >> >> PR c/55397 >> * cppbuiltin.c (define_builtin_macros_for_compilation_flags): >> Define __SANITIZE_ADDRESS__ for flag_asan. > > Ok, thanks. > >> --- a/gcc/cppbuiltin.c >> +++ b/gcc/cppbuiltin.c >> @@ -91,6 +91,9 @@ define_builtin_macros_for_compilation_flags >> (cpp_reader *pfile) >> cpp_define_formatted (pfile, "__PIE__=%d", flag_pie); >> } >> >> + if (flag_asan) >> + cpp_define (pfile, "__SANITIZE_ADDRESS__"); >> + >> if (optimize_size) >> cpp_define (pfile, "__OPTIMIZE_SIZE__"); >> if (optimize) > > Jakub Here is a doc patch. OK to install? Thanks. diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index c463e7c..682ee9f 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -2352,6 +2352,10 @@ use. This macro is defined, with value 2, when @option{-fstack-protector-all} is in use. +@item __SANITIZE_ADDRESS__ +This macro is defined, with value 1, when @option{-fsanitize=address} is +in use. + @item __TIMESTAMP__ This macro expands to a string constant that describes the date and time of the last modification of the current source file. The string constant