Date: Sun, 11 Apr 2004 21:57:12 -0700 From: Luigi Rizzo <rizzo@icir.org> To: current@freebsd.org Subject: proposed "make" directive: .echo Message-ID: <20040411215712.A81465@xorpc.icir.org>
next in thread | raw e-mail | index | archive | help
Any objection to implemeting the '.echo' directive in "make", similar to .error but not causing the program to abort ? BTW, i notice that the handling of line numbers is totally broken in .for/.endfor loops -- the line number is always reset to 0 at the beginning of the loop cheers luigi Index: parse.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/parse.c,v retrieving revision 1.22.2.1 diff -u -r1.22.2.1 parse.c --- parse.c 26 Dec 2002 14:36:38 -0000 1.22.2.1 +++ parse.c 12 Apr 2004 04:26:56 -0000 @@ -252,7 +252,7 @@ static void ParseUnreadc __P((int)); static void ParseHasCommands __P((ClientData)); static void ParseDoInclude __P((char *)); -static void ParseDoError __P((char *)); +static void ParseDoError __P((char *, int)); #ifdef SYSVINCLUDE static void ParseTraditionalInclude __P((char *)); #endif @@ -1589,12 +1589,12 @@ * The input is the line minus the ".error". We substitute variables, * print the message and exit(1) or just print a warning if the ".error" * directive is malformed. + * Don't exit if second argument is true ('.echo' case) * *--------------------------------------------------------------------- */ static void -ParseDoError(errmsg) - char *errmsg; /* error message */ +ParseDoError(char *errmsg, int is_echo) { if (!isspace(*errmsg)) { Parse_Error(PARSE_WARNING, "invalid syntax: .error%s", errmsg); @@ -1608,7 +1608,8 @@ /* use fprintf/exit instead of Parse_Error to terminate immediately */ fprintf(stderr, "\"%s\", line %d: %s\n", fname, lineno, errmsg); - exit(1); + if (!is_echo) + exit(1); } /*- @@ -2446,7 +2447,10 @@ ParseDoInclude (cp + 7); goto nextLine; } else if (strncmp (cp, "error", 5) == 0) { - ParseDoError(cp + 5); + ParseDoError(cp + 5, 0); + goto nextLine; + } else if (strncmp (cp, "echo", 4) == 0) { + ParseDoError(cp + 4, 1); goto nextLine; } else if (strncmp(cp, "undef", 5) == 0) { char *cp2;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040411215712.A81465>