From patchwork Wed Jul 30 07:19:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Senthil Kumar Selvaraj X-Patchwork-Id: 374683 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7B8EC140189 for ; Wed, 30 Jul 2014 17:20:20 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=qfZLFp3wT4Os/cUPSrvd/YVWf1F31y Hf5qnoymRsvSPxKvta/eXzKz0ghXmSf9NenHbvcwPwH1AmMoOGnJcbLqbkjz4vWL SzGalMAlfIUOngJYLy8jLuMBJF0qu6DdQkz/ahUriXJpBQ2utsvQcm+S2tbH0N7c YjD8OgW9pZzcs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=TRbCZgfdpJwrek03P/O3Ow5JHfk=; b=tfFI 9A7tLd7qQ31WW2l98/Qydnjl/pXDUJ4z97FQGGRYoil2ELATyPre+MHEkUErTL8P dmw/RySqGYqwSxRU7P4B5YliQp/Wo9a0TW2SKUGEB9BNF9RQNbQ7w0fa3TKtE3on 6hQvzreZ7W9beIkJecXUzUpKD11lCbAykhih0N8= Received: (qmail 13978 invoked by alias); 30 Jul 2014 07:20:12 -0000 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 Received: (qmail 13915 invoked by uid 89); 30 Jul 2014 07:20:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_50, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.242) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 30 Jul 2014 07:20:05 +0000 Received: from apsmtp01.atmel.com (10.168.254.30) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.2.347.0; Wed, 30 Jul 2014 09:19:51 +0200 Received: from PENCHT02.corp.atmel.com (10.168.5.162) by apsmtp01.corp.atmel.com (10.168.254.30) with Microsoft SMTP Server (TLS) id 14.2.347.0; Wed, 30 Jul 2014 15:21:23 +0800 Received: from atmel.com (10.168.5.13) by cas-ap.atmel.com (10.168.5.162) with Microsoft SMTP Server (TLS) id 14.2.342.3; Wed, 30 Jul 2014 15:19:07 +0800 Date: Wed, 30 Jul 2014 12:49:17 +0530 From: Senthil Kumar Selvaraj To: Georg-Johann Lay , , Subject: Re: [Patch, avr] Add device name to cpp_builtins Message-ID: <20140730071917.GA1287@atmel.com> References: <20140723080440.GA28575@atmel.com> <53D691D8.9090809@gcc.gnu.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53D691D8.9090809@gcc.gnu.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Mon, Jul 28, 2014 at 08:09:28PM +0200, Georg-Johann Lay wrote: > Senthil Kumar Selvaraj schrieb: > >The below patch adds a new preprocessor define for the device name > >(__AVR_DEVICE_NAME__) that was passed to the compiler. > > > >While the device name macro (say __AVR_ATmega128__) can be used to check > >for a specific device, there is no way right now for code to get the > >device name it is being compiled against (without checking > >for every possible device). > > Shouldn't this also be added to the documentation? > There's a section "AVR Built-in Macros" in the manual. Thanks for reminding me, Johann. Here's the patch - if ok, could someone commit please? Regards Senthil 2014-07-30 Senthil Kumar Selvaraj * doc/invoke.texi (AVR Options): Add documentation about __AVR_DEVICE_NAME__ built-in macro. diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index 7cebb9e..e201496 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -13114,6 +13114,14 @@ the device name as from the AVR user manual. The difference between If @var{device} is not a device but only a core architecture like @code{avr51}, this macro will not be defined. +@item __AVR_DEVICE_NAME__ +Setting @code{-mmcu=@var{device}} defines this built-in macro to +the device's name. For example, with @code{-mmcu=atmega8} the macro +will be defined to @code{atmega8}. + +If @var{device} is not a device but only a core architecture like +@code{avr51}, this macro will not be defined. + @item __AVR_XMEGA__ The device / architecture belongs to the XMEGA family of devices.