From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88612 invoked by alias); 2 Mar 2018 23:58:19 -0000 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org Received: (qmail 87612 invoked by uid 89); 2 Mar 2018 23:58:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Apr, 2529, 1.35, cris X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pg0-f50.google.com Received: from mail-pg0-f50.google.com (HELO mail-pg0-f50.google.com) (74.125.83.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Mar 2018 23:58:17 +0000 Received: by mail-pg0-f50.google.com with SMTP id l131so4402949pga.2; Fri, 02 Mar 2018 15:58:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ooFUS9gtcEIQCT65GbD0wY4ddLhcFGuJwY/ShKWbbRQ=; b=GSBgZSkawydfzARW4DWp0YuKV9PRqGsouQaC0a75oWe21p4eHJqAW+D1qQMTezzsV+ y1HQpWvxOcWdbnMmW+9UJfE3rJzjROfB3VkFO8gagvChujBn9BfH+WmnYCBbiUsjymhs dRGhDWVmqPNCroWcKtITbNDy5sKZtbrzyc1YxD3RB0pgGPF68LzUQBWv4Q2OSIHLMqbQ QYEVwr9hRmjf2tOLKbqi/DIXBAj1a5nYeRiLMqsq0FzW2oHwbanCEkk11ARCTijNyvmC sWGJ5x7cxFYNvpSdUPlpz6rAPrgfGoCf7hjQVXNYbDteU9kQ8k7kAUsLMUxZ459xDT5x HWQA== X-Gm-Message-State: APf1xPCiCaafuSiVbOlpgqz5j6q87zklyxGiGCfgoXcfzFkGvsxqtZFU iwlp8VJr9jaEdh61KmCc1e2c0w== X-Google-Smtp-Source: AG47ELvgDLvhQEUNkxPDd6YUCMAKzdSnoa95k4XCoyHxZhmk1hM5amthm3Jz1oEdXg736X0vAtt9Tw== X-Received: by 10.98.76.26 with SMTP id z26mr7350203pfa.220.1520035095133; Fri, 02 Mar 2018 15:58:15 -0800 (PST) Received: from bubble.grove.modra.org (CPE-58-175-241-133.hdcz1.win.bigpond.net.au. [58.175.241.133]) by smtp.gmail.com with ESMTPSA id i125sm14276913pfe.176.2018.03.02.15.58.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Mar 2018 15:58:14 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 622B0C079E; Sat, 3 Mar 2018 10:28:09 +1030 (ACDT) Date: Fri, 02 Mar 2018 23:58:00 -0000 From: Alan Modra To: cgen@sourceware.org Cc: "Frank Ch. Eigler" Subject: binutils opcodes error messages Message-ID: <20180302235809.GE3812@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2018-q1/txt/msg00004.txt.bz2 This patch is aimed at making binutils/opcodes files comply with the GNU coding standard regarding error messages, that is, they should start with the program name followed by a colon, then a lower case message. Accomplished by calling opcodes_error_handler to output the program name (and final '\n'), rather than calling fprintf. Files used by the simulator, cris/cris-desc.c and sh64/sh-desc.c will continue to use fprintf via the fallback opcodes_error_handler define. I initially wrote a patch with a little scheme to select the right message output function for opcodes by comparing APPLICATION against 'OPCODES. That was before discovering that APPLICATION is 'OPCODES when cgen is invoked to create *-desc.c for the simulator. :-( OK to apply? * desc-cpu.scm (opcodes_error_handler): Define. (@arch@_cgen_rebuild_tables): Use opcodes_error_handler. (@arch@_cgen_cpu_open): Likewise. * opc-asmdis.scm (@arch@_cgen_parse_operand): Likewise. (@arch@_cgen_print_operand): Likewise. * opc-ibld.scm (@arch@_cgen_get_int_operand): Likewise. (@arch@_cgen_get_vma_operand): Likewise. (@arch@_cgen_set_int_operand): Likewise. (@arch@_cgen_set_vma_operand): Likewise. (@arch@_cgen_insert_operand): Likewise. (@arch@_cgen_extract_operand): Likewise. * utils.scm: Update emitted copyright dates. Index: cgen/desc-cpu.scm =================================================================== RCS file: /cvs/src/src/cgen/desc-cpu.scm,v retrieving revision 1.35 diff -u -p -r1.35 desc-cpu.scm --- cgen/desc-cpu.scm 13 Apr 2017 11:58:48 -0000 1.35 +++ cgen/desc-cpu.scm 2 Mar 2018 23:25:26 -0000 @@ -588,6 +588,11 @@ static const CGEN_IBASE @arch@_cgen_insn (define (/gen-cpu-open) (string-append "\ +#ifndef opcodes_error_handler +#define opcodes_error_handler(...) \\ + fprintf (stderr, __VA_ARGS__); fputc ('\\n', stderr) +#endif + static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *); static void build_hw_table (CGEN_CPU_TABLE *); static void build_ifield_table (CGEN_CPU_TABLE *); @@ -748,8 +753,11 @@ static void { if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize) { - fprintf (stderr, \"@arch@_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\\n\", - cd->insn_chunk_bitsize, mach->insn_chunk_bitsize); + opcodes_error_handler + (/* xgettext:c-format */ + _(\"internal error: @arch@_cgen_rebuild_tables: \" + \"conflicting insn-chunk-bitsize values: `%d' vs. `%d'\"), + cd->insn_chunk_bitsize, mach->insn_chunk_bitsize); abort (); } @@ -828,8 +836,11 @@ CGEN_CPU_DESC endian = va_arg (ap, enum cgen_endian); break; default : - fprintf (stderr, \"@arch@_cgen_cpu_open: unsupported argument `%d'\\n\", - arg_type); + opcodes_error_handler + (/* xgettext:c-format */ + _(\"internal error: @arch@_cgen_cpu_open: \" + \"unsupported argument `%d'\"), + arg_type); abort (); /* ??? return NULL? */ } arg_type = va_arg (ap, enum cgen_cpu_open_arg); @@ -844,7 +855,9 @@ CGEN_CPU_DESC if (endian == CGEN_ENDIAN_UNKNOWN) { /* ??? If target has only one, could have a default. */ - fprintf (stderr, \"@arch@_cgen_cpu_open: no endianness specified\\n\"); + opcodes_error_handler + (/* xgettext:c-format */ + _(\"internal error: @arch@_cgen_cpu_open: no endianness specified\")); abort (); } Index: cgen/opc-asmdis.scm =================================================================== RCS file: /cvs/src/src/cgen/opc-asmdis.scm,v retrieving revision 1.8 diff -u -p -r1.8 opc-asmdis.scm --- cgen/opc-asmdis.scm 7 Sep 2009 22:17:34 -0000 1.8 +++ cgen/opc-asmdis.scm 2 Mar 2018 23:25:26 -0000 @@ -41,7 +41,9 @@ const char * " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while parsing.\\n\"), opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while parsing\"), + opindex); abort (); } @@ -136,9 +138,10 @@ void " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while printing insn.\\n\"), - opindex); - abort (); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while printing insn\"), + opindex); + abort (); } }\n\n") ) Index: cgen/opc-ibld.scm =================================================================== RCS file: /cvs/src/src/cgen/opc-ibld.scm,v retrieving revision 1.9 diff -u -p -r1.9 opc-ibld.scm --- cgen/opc-ibld.scm 7 Sep 2009 22:17:34 -0000 1.9 +++ cgen/opc-ibld.scm 2 Mar 2018 23:25:26 -0000 @@ -30,8 +30,9 @@ int " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while getting int operand.\\n\"), - opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while getting int operand\"), + opindex); abort (); } @@ -52,8 +53,9 @@ bfd_vma " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while getting vma operand.\\n\"), - opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while getting vma operand\"), + opindex); abort (); } @@ -87,8 +89,9 @@ void " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while setting int operand.\\n\"), - opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while setting int operand\"), + opindex); abort (); } } @@ -106,8 +109,9 @@ void " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while setting vma operand.\\n\"), - opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while setting vma operand\"), + opindex); abort (); } } @@ -197,8 +201,9 @@ const char * " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while building insn.\\n\"), - opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while building insn\"), + opindex); abort (); } @@ -247,8 +252,9 @@ int " default : /* xgettext:c-format */ - fprintf (stderr, _(\"Unrecognized field %d while decoding insn.\\n\"), - opindex); + opcodes_error_handler + (_(\"internal error: unrecognized field %d while decoding insn\"), + opindex); abort (); } Index: cgen/utils.scm =================================================================== RCS file: /cvs/src/src/cgen/utils.scm,v retrieving revision 1.40 diff -u -p -r1.40 utils.scm --- cgen/utils.scm 7 Apr 2017 22:38:16 -0000 1.40 +++ cgen/utils.scm 2 Mar 2018 23:25:27 -0000 @@ -1310,7 +1310,7 @@ (cons "\ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright (C) 1996-2017 Free Software Foundation, Inc. +Copyright (C) 1996-2018 Free Software Foundation, Inc. " "\ This file is free software; you can redistribute it and/or modify @@ -1335,7 +1335,7 @@ Copyright (C) 1996-2017 Free Software Fo (cons "\ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright (C) 2000-2017 Red Hat, Inc. +Copyright (C) 2000-2018 Red Hat, Inc. " "\ ")) -- Alan Modra Australia Development Lab, IBM