From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13594 invoked by alias); 3 Nov 2004 03:01:55 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 13585 invoked from network); 3 Nov 2004 03:01:54 -0000 Received: from unknown (HELO krynn.se.axis.com) (212.209.10.221) by sourceware.org with SMTP; 3 Nov 2004 03:01:54 -0000 Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.83.5.18]) by krynn.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id iA331i5w019508; Wed, 3 Nov 2004 04:01:44 +0100 Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id iA331idD025285; Wed, 3 Nov 2004 04:01:44 +0100 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id iA331iFg025281; Wed, 3 Nov 2004 04:01:44 +0100 Date: Wed, 03 Nov 2004 03:01:00 -0000 Message-Id: <200411030301.iA331iFg025281@ignucius.se.axis.com> From: Hans-Peter Nilsson To: binutils@sources.redhat.com Subject: RFC: gas .warning "msg" and .error "msg" directives? X-SW-Source: 2004-11/txt/msg00041.txt.bz2 How about .error and .warning directives, matching the following texinfo snippet? In contrast to .err or just using an undefined pseudo, this allows the programmer to specify the output, similar to #warn and #error in cpp. +`.error STRING' + This directive emits an error with the message STRING. If you + don't specify STRING, it defaults to `"(unspecified)"'. + + .error "This code has not been assembled and tested." + +`.warning STRING' + Similar to the directive `.error', but just emits a warning. + The incredibly intricate code would look something like this (snippets from currently port-local implementation provided for discussion only, not indented for approval - though preapproval would of course be welcome): + {"error", s_cris_errwarn, 1}, + {"warning", s_cris_errwarn, 0}, +/* Emit an error or a warning. */ + +static void +s_cris_errwarn (err) + int err; +{ + char *msg = _("(unspecified)"); + int len; + + if (!is_it_end_of_statement ()) + { + if (*input_line_pointer != '\"') + { + msg = err + ? _(".error argument must be a string") + : _(".warning argument must be a string"); + as_bad (msg); + discard_rest_of_line (); + return; + } + + msg = demand_copy_C_string (&len); + if (msg == NULL) + return; + } + + if (err) + as_bad (msg); + else + as_warn (msg); + demand_empty_rest_of_line (); +} If not, I'll pout and keep them local to the CRIS port. brgds, H-P PS. I have a test-suite too, of course. ;-)