From patchwork Wed Jul 12 15:46:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 787322 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 3x73Gr3kkpz9ryQ for ; Thu, 13 Jul 2017 01:46:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="AEj4dH72"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=FzSS/dPO3FMDDESLQe6sKG5cSG5LMF6WZqR8DXG/cyFOEvUFvB e6AtdZ4S01HUzV+ICPv9bgn71uv51KJpvypU6u+nsEMxysiZ/2vayytX+0AMDPQQ ICu5EODitlUeDID3cs6dUJoHipvZkR6oZamIM3gxj/hqN2XGX5Mt1Fo9A= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=1o9dVR/iwtBb0lkZsmIAX/7+XIU=; b=AEj4dH72ywKHyiAmP6Ql y9axtZ7kuZxZWRt3QNrF64sibW56329wpRfNnR+Ef/LCWlK6c79h7qlTFNkBh/DM D1s2YHEGyIjWFQ9cEELR1snt9bw0c93Hmb1qmihEXNrc7JjHw6yNlAH7NxiqcLfd Xc/CF90dpfEqRIOQyx8Wk1w= Received: (qmail 10490 invoked by alias); 12 Jul 2017 15:46:51 -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 10475 invoked by uid 89); 12 Jul 2017 15:46:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=start-up, reserved X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.219) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Jul 2017 15:46:49 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 41.1 DYNA|AUTH) with ESMTPSA id I0bdeat6CFkkKVV (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 12 Jul 2017 17:46:46 +0200 (CEST) To: gcc-patches Cc: Denis Chertykov From: Georg-Johann Lay Subject: [patch,avr,committed] Fix PR79883: Quote key words in diagnostics. Message-ID: Date: Wed, 12 Jul 2017 17:46:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 X-IsSubscribed: yes This patchlet fixes a complaint from translation projects because some non-quoted key words like "interrupt" or "signal" caused problems there. Enclosed the sequence in "WITH_AVRLIBC" because that is only relevant when AVR-LibC start-up code is in use. Also warns for functions named "ISR", "SIGNAL" and "INTERRUPT". Such names indicate missing system include. Applied as obvious. Johann PR target/79883 * config/avr/avr.c (avr_set_current_function): In diagnostic messages: Quote keywords and (parts of) identifiers. [WITH_AVRLIBC]: Warn for functions named "ISR", "SIGNAL" or "INTERRUPT". Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 250155) +++ config/avr/avr.c (revision 250156) @@ -1076,12 +1076,6 @@ avr_set_current_function (tree decl) name = default_strip_name_encoding (name); - /* Silently ignore 'signal' if 'interrupt' is present. AVR-LibC startet - using this when it switched from SIGNAL and INTERRUPT to ISR. */ - - if (cfun->machine->is_interrupt) - cfun->machine->is_signal = 0; - /* Interrupt handlers must be void __vector (void) functions. */ if (args && TREE_CODE (TREE_VALUE (args)) != VOID_TYPE) @@ -1090,14 +1084,36 @@ avr_set_current_function (tree decl) if (TREE_CODE (ret) != VOID_TYPE) error_at (loc, "%qs function cannot return a value", isr); +#if defined WITH_AVRLIBC + /* Silently ignore 'signal' if 'interrupt' is present. AVR-LibC startet + using this when it switched from SIGNAL and INTERRUPT to ISR. */ + + if (cfun->machine->is_interrupt) + cfun->machine->is_signal = 0; + /* If the function has the 'signal' or 'interrupt' attribute, ensure that the name of the function is "__vector_NN" so as to catch when the user misspells the vector name. */ if (!STR_PREFIX_P (name, "__vector")) warning_at (loc, OPT_Wmisspelled_isr, "%qs appears to be a misspelled " - "%s handler, missing __vector prefix", name, isr); + "%qs handler, missing %<__vector%> prefix", name, isr); +#endif // AVR-LibC naming conventions + } + +#if defined WITH_AVRLIBC + // Common problem is using "ISR" without first including avr/interrupt.h. + const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); + name = default_strip_name_encoding (name); + if (0 == strcmp ("ISR", name) + || 0 == strcmp ("INTERRUPT", name) + || 0 == strcmp ("SIGNAL", name)) + { + warning_at (loc, OPT_Wmisspelled_isr, "%qs is a reserved indentifier" + " in AVR-LibC. Consider %<#include %>" + " before using the %qs macro", name, name); } +#endif // AVR-LibC naming conventions /* Don't print the above diagnostics more than once. */