From owner-freebsd-bugs Sat Jul 27 18:30:14 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A32237B400 for ; Sat, 27 Jul 2002 18:30:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 11D1443E5E for ; Sat, 27 Jul 2002 18:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6S1U2JU093074 for ; Sat, 27 Jul 2002 18:30:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6S1U2md093073; Sat, 27 Jul 2002 18:30:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 535C237B401 for ; Sat, 27 Jul 2002 18:21:51 -0700 (PDT) Received: from smtp.noos.fr (claudel.noos.net [212.198.2.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4A6343E65 for ; Sat, 27 Jul 2002 18:21:49 -0700 (PDT) (envelope-from root@gits.dyndns.org) Received: (qmail 35026457 invoked by uid 0); 28 Jul 2002 01:21:47 -0000 Received: from unknown (HELO gits.gits.dyndns.org) ([212.198.229.153]) (envelope-sender ) by 212.198.2.83 (qmail-ldap-1.03) with SMTP for ; 28 Jul 2002 01:21:47 -0000 Received: from gits.gits.dyndns.org (9d61i5kzo0nl121s@localhost [127.0.0.1]) by gits.gits.dyndns.org (8.12.5/8.12.5) with ESMTP id g6S1LlNc099741; Sun, 28 Jul 2002 03:21:47 +0200 (CEST) (envelope-from root@gits.dyndns.org) Received: (from root@localhost) by gits.gits.dyndns.org (8.12.5/8.12.5/Submit) id g6S1LkhD099740; Sun, 28 Jul 2002 03:21:46 +0200 (CEST) (envelope-from root) Message-Id: <200207280121.g6S1LkhD099740@gits.gits.dyndns.org> Date: Sun, 28 Jul 2002 03:21:46 +0200 (CEST) From: Cyrille Lefevre Reply-To: Cyrille Lefevre To: FreeBSD-gnats-submit@FreeBSD.org Cc: Ruslan Ermilov , Juli Mallett X-Send-Pr-Version: 3.113 Subject: bin/41070: added .warning in make(1) + two fixes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 41070 >Category: bin >Synopsis: added .warning in make(1) + two fixes >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Jul 27 18:30:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 4.6-STABLE i386 >Organization: ACME >Environment: System: FreeBSD gits 4.6-STABLE FreeBSD 4.6-STABLE #17: Tue Jul 23 08:29:49 CEST 2002 root@gits:/disk2/freebsd/stable/src/sys/compile/CUSTOM i386 >Description: this patch will be necessary for the NOFOO to NO_FOO transition. src/usr.bin/make/parce.c - saveline added to make lineno happy in `.for' loops in debug mode. - ParseDoWarning added - Var_Subst added in `.undef' to avoid inconsistencies such as : .for var in ${vars} .undef ${var} .endfor vs. .for var in ${vars} tmp=${var} .undef ${tmp} .endfor >How-To-Repeat: see above. >Fix: Index: parse.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/parse.c,v retrieving revision 1.22 diff -u -r1.22 parse.c --- parse.c 28 Aug 1999 01:03:35 -0000 1.22 +++ parse.c 26 Jul 2002 02:12:52 -0000 @@ -120,6 +120,7 @@ static char *fname; /* name of current file (for errors) */ static int lineno; /* line number in current file */ +static int savedlineno; /* saved line number */ static FILE *curFILE = NULL; /* current makefile */ static PTR *curPTR = NULL; /* current makefile */ @@ -252,6 +253,7 @@ static void ParseUnreadc __P((int)); static void ParseHasCommands __P((ClientData)); static void ParseDoInclude __P((char *)); +static void ParseDoWarning __P((char *)); static void ParseDoError __P((char *)); #ifdef SYSVINCLUDE static void ParseTraditionalInclude __P((char *)); @@ -1557,6 +1559,33 @@ } /*--------------------------------------------------------------------- + * ParseDoWarning -- + * Handle warning directive + * + * The input is the line minus the ".warning". We substitute variables + * and the message or print a warning if the ".warning" directive is + * malformed. + * + *--------------------------------------------------------------------- + */ +static void +ParseDoWarning(errmsg) + char *errmsg; /* error message */ +{ + if (!isspace(*errmsg)) { + Parse_Error(PARSE_WARNING, "invalid syntax: .warning%s", errmsg); + return; + } + + while (isspace(*errmsg)) + errmsg++; + + errmsg = Var_Subst(NULL, errmsg, VAR_GLOBAL, FALSE); + + Parse_Error(PARSE_WARNING, "%s", errmsg); +} + +/*--------------------------------------------------------------------- * ParseDoError -- * Handle error directive * @@ -1580,8 +1609,7 @@ errmsg = Var_Subst(NULL, errmsg, VAR_GLOBAL, FALSE); - /* use fprintf/exit instead of Parse_Error to terminate immediately */ - fprintf(stderr, "\"%s\", line %d: %s\n", fname, lineno, errmsg); + Parse_Error(PARSE_FATAL, "%s", errmsg); exit(1); } @@ -1801,7 +1829,7 @@ curFILE = NULL; curPTR = (PTR *) emalloc (sizeof (PTR)); curPTR->str = curPTR->ptr = str; - lineno = 0; + lineno = savedlineno; fname = estrdup(fname); } @@ -2321,6 +2349,7 @@ if (For_Eval(line)) { int ok; free(line); + savedlineno = lineno; do { /* * Skip after the matching end @@ -2421,7 +2450,10 @@ goto nextLine; } else if (strncmp (cp, "error", 5) == 0) { ParseDoError(cp + 5); - goto nextLine; + /* NOTREACHED */ + } else if (strncmp (cp, "warning", 7) == 0) { + ParseDoWarning(cp + 7); + goto nextLine; } else if (strncmp(cp, "undef", 5) == 0) { char *cp2; for (cp += 5; isspace((unsigned char) *cp); cp++) { @@ -2434,6 +2466,8 @@ } *cp2 = '\0'; + + cp = Var_Subst(NULL, cp, VAR_GLOBAL, FALSE); Var_Delete(cp, VAR_GLOBAL); goto nextLine; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message