From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22769 invoked by alias); 5 Nov 2014 20:02:02 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 22745 invoked by uid 89); 5 Nov 2014 20:02:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Message-ID: <545A8234.9060001@redhat.com> Date: Wed, 01 Jan 2014 00:00:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: David Malcolm CC: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Subject: Re: [jit] Use ISALPHA and ISALNUM rather than writing our own References: <545947AE.2070606@redhat.com> <1415202488-1461-1-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1415202488-1461-1-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-SW-Source: 2014-q4/txt/msg00127.txt.bz2 On 11/05/14 08:48, David Malcolm wrote: > On Tue, 2014-11-04 at 14:39 -0700, Jeff Law wrote: >> On 11/04/14 09:57, David Malcolm wrote: >>>>> +#define IS_ASCII_DIGIT(CHAR) \ >>>>> + ((CHAR) >= '0' && (CHAR) <='9') >>>>> + >>>>> +#define IS_ASCII_ALNUM(CHAR) \ >>>>> + (IS_ASCII_ALPHA (CHAR) || IS_ASCII_DIGIT (CHAR)) >>>> Can't we rely on the C library to give us equivalents? >>> >>> I've been burned in the past by the C library using locales, in >>> particular the two lowercase "i" variants in Turkish. >>> >>> These macros are used by gcc_jit_context_new_function to enforce C's >>> naming restrictions, to avoid errors from the assembler. The comment I >>> put there was: >>> >>> /* The assembler can only handle certain names, so for now, enforce >>> C's rules for identifiers upon the name. >>> Eventually we'll need some way to interact with e.g. C++ name mangling. */ >>> >>> Am I right in thinking that for the assembler we need to enforce the C >>> naming rules specifically on *ASCII*. >>> >>> (clearly another comment is needed here). >> I guess you've got to do it somewhere. Presumably there isn't something >> already in GCC that enforces an input character set? I guess I just >> dislike seeing something that feels like it ought to already be available. > > It turns out that locale-independent tests for this did already exist in > libiberty, in safe-ctype.h, so I've committed this to the jit branch: > > gcc/jit/ChangeLog.jit: > * libgccjit.c: Include safe-ctype.h from libiberty. > (IS_ASCII_ALPHA): Delete. > (IS_ASCII_DIGIT): Delete. > (IS_ASCII_ALNUM): Delete. > (gcc_jit_context_new_function): Replace use of IS_ASCII_ALPHA and > IS_ASCII_ALNUM with ISALPHA and ISALNUM respectively, from > libiberty. Excellent. Thanks for the cleanup. Jeff