Subject: Re: make: syntax error on empty(NOSUCH)
To: Simon J. Gerraty <sjg@crufty.net>
From: Luke Mewburn <lukem@NetBSD.org>
List: tech-toolchain
Date: 09/06/2003 15:26:14
On Wed, Sep 03, 2003 at 12:59:24AM -0700, Simon J. Gerraty wrote:
  | There was a brief discussion a while back about whether make should 
  | give a syntax error on
  | 
  | .if empty(NOSUCH)
  | 
  | if NOSUCH is undefined.  Using:
  | 
  | .if defined(NOSUCH) && empty(NOSUCH)
  | 
  | or 
  | 
  | .if !defined(NOSUCH) || empty(NOSUCH)
  | 
  | are the canonical approaches to avoiding such errors.
  | 
  | Anyway, turns out that (as far as I can see) cond.c always passes TRUE
  | for the doEval boolean which is passed to Var_Parse as its err boolean
  | which causes it to return Var_Error for the undefined variable.  This
  | doesn't seem right.
  | The patch below causes
  | 
  | .if empty(NOSUCH)
  | 
  | to return TRUE for the undefined variable, while still throwing up an
  | error for syntax errors and such.
  | 
  | Question is... is this something worth "fixing" or given there are
  | viable work arounds leave well enough alone?


I consider it an issue worth fixing.


Luke.