Deleted Added
full compact
cond.c (236769) cond.c (237578)
1/* $NetBSD: cond.c,v 1.63 2012/05/21 06:30:02 sjg Exp $ */
1/* $NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $ */
2
3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
9 *

--- 55 unchanged lines hidden (view full) ---

65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE.
70 */
71
72#ifndef MAKE_NATIVE
2
3/*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
9 *

--- 55 unchanged lines hidden (view full) ---

65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE.
70 */
71
72#ifndef MAKE_NATIVE
73static char rcsid[] = "$NetBSD: cond.c,v 1.63 2012/05/21 06:30:02 sjg Exp $";
73static char rcsid[] = "$NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $";
74#else
75#include <sys/cdefs.h>
76#ifndef lint
77#if 0
78static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
79#else
74#else
75#include <sys/cdefs.h>
76#ifndef lint
77#if 0
78static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
79#else
80__RCSID("$NetBSD: cond.c,v 1.63 2012/05/21 06:30:02 sjg Exp $");
80__RCSID("$NetBSD: cond.c,v 1.64 2012/06/12 19:21:50 joerg Exp $");
81#endif
82#endif /* not lint */
83#endif
84
85/*-
86 * cond.c --
87 * Functions to handle conditionals in a makefile.
88 *

--- 233 unchanged lines hidden (view full) ---

322 * TRUE if the given variable is defined.
323 *
324 * Side Effects:
325 * None.
326 *
327 *-----------------------------------------------------------------------
328 */
329static Boolean
81#endif
82#endif /* not lint */
83#endif
84
85/*-
86 * cond.c --
87 * Functions to handle conditionals in a makefile.
88 *

--- 233 unchanged lines hidden (view full) ---

322 * TRUE if the given variable is defined.
323 *
324 * Side Effects:
325 * None.
326 *
327 *-----------------------------------------------------------------------
328 */
329static Boolean
330CondDoDefined(int argLen __unused, const char *arg)
330CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
331{
332 char *p1;
333 Boolean result;
334
335 if (Var_Value(arg, VAR_CMD, &p1) != NULL) {
336 result = TRUE;
337 } else {
338 result = FALSE;

--- 32 unchanged lines hidden (view full) ---

371 * TRUE if the given target is being made.
372 *
373 * Side Effects:
374 * None.
375 *
376 *-----------------------------------------------------------------------
377 */
378static Boolean
331{
332 char *p1;
333 Boolean result;
334
335 if (Var_Value(arg, VAR_CMD, &p1) != NULL) {
336 result = TRUE;
337 } else {
338 result = FALSE;

--- 32 unchanged lines hidden (view full) ---

371 * TRUE if the given target is being made.
372 *
373 * Side Effects:
374 * None.
375 *
376 *-----------------------------------------------------------------------
377 */
378static Boolean
379CondDoMake(int argLen __unused, const char *arg)
379CondDoMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
380{
381 return Lst_Find(create, arg, CondStrMatch) != NULL;
382}
383
384/*-
385 *-----------------------------------------------------------------------
386 * CondDoExists --
387 * See if the given file exists.
388 *
389 * Results:
390 * TRUE if the file exists and FALSE if it does not.
391 *
392 * Side Effects:
393 * None.
394 *
395 *-----------------------------------------------------------------------
396 */
397static Boolean
380{
381 return Lst_Find(create, arg, CondStrMatch) != NULL;
382}
383
384/*-
385 *-----------------------------------------------------------------------
386 * CondDoExists --
387 * See if the given file exists.
388 *
389 * Results:
390 * TRUE if the file exists and FALSE if it does not.
391 *
392 * Side Effects:
393 * None.
394 *
395 *-----------------------------------------------------------------------
396 */
397static Boolean
398CondDoExists(int argLen __unused, const char *arg)
398CondDoExists(int argLen MAKE_ATTR_UNUSED, const char *arg)
399{
400 Boolean result;
401 char *path;
402
403 path = Dir_FindFile(arg, dirSearchPath);
404 if (DEBUG(COND)) {
405 fprintf(debug_file, "exists(%s) result is \"%s\"\n",
406 arg, path ? path : "");

--- 16 unchanged lines hidden (view full) ---

423 * TRUE if the node exists as a target and FALSE if it does not.
424 *
425 * Side Effects:
426 * None.
427 *
428 *-----------------------------------------------------------------------
429 */
430static Boolean
399{
400 Boolean result;
401 char *path;
402
403 path = Dir_FindFile(arg, dirSearchPath);
404 if (DEBUG(COND)) {
405 fprintf(debug_file, "exists(%s) result is \"%s\"\n",
406 arg, path ? path : "");

--- 16 unchanged lines hidden (view full) ---

423 * TRUE if the node exists as a target and FALSE if it does not.
424 *
425 * Side Effects:
426 * None.
427 *
428 *-----------------------------------------------------------------------
429 */
430static Boolean
431CondDoTarget(int argLen __unused, const char *arg)
431CondDoTarget(int argLen MAKE_ATTR_UNUSED, const char *arg)
432{
433 GNode *gn;
434
435 gn = Targ_FindNode(arg, TARG_NOCREATE);
436 return (gn != NULL) && !OP_NOP(gn->type);
437}
438
439/*-

--- 7 unchanged lines hidden (view full) ---

447 * it and FALSE if it does not.
448 *
449 * Side Effects:
450 * None.
451 *
452 *-----------------------------------------------------------------------
453 */
454static Boolean
432{
433 GNode *gn;
434
435 gn = Targ_FindNode(arg, TARG_NOCREATE);
436 return (gn != NULL) && !OP_NOP(gn->type);
437}
438
439/*-

--- 7 unchanged lines hidden (view full) ---

447 * it and FALSE if it does not.
448 *
449 * Side Effects:
450 * None.
451 *
452 *-----------------------------------------------------------------------
453 */
454static Boolean
455CondDoCommands(int argLen __unused, const char *arg)
455CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char *arg)
456{
457 GNode *gn;
458
459 gn = Targ_FindNode(arg, TARG_NOCREATE);
460 return (gn != NULL) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
461}
462
463/*-

--- 321 unchanged lines hidden (view full) ---

785 if (lhsFree)
786 free(lhsFree);
787 if (rhsFree)
788 free(rhsFree);
789 return t;
790}
791
792static int
456{
457 GNode *gn;
458
459 gn = Targ_FindNode(arg, TARG_NOCREATE);
460 return (gn != NULL) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
461}
462
463/*-

--- 321 unchanged lines hidden (view full) ---

785 if (lhsFree)
786 free(lhsFree);
787 if (rhsFree)
788 free(rhsFree);
789 return t;
790}
791
792static int
793get_mpt_arg(char **linePtr, char **argPtr, const char *func __unused)
793get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
794{
795 /*
796 * Use Var_Parse to parse the spec in parens and return
797 * TOK_TRUE if the resulting string is empty.
798 */
799 int length;
800 void *freeIt;
801 char *val;

--- 24 unchanged lines hidden (view full) ---

826 */
827 length = *val ? 2 : 1;
828 if (freeIt)
829 free(freeIt);
830 return length;
831}
832
833static Boolean
794{
795 /*
796 * Use Var_Parse to parse the spec in parens and return
797 * TOK_TRUE if the resulting string is empty.
798 */
799 int length;
800 void *freeIt;
801 char *val;

--- 24 unchanged lines hidden (view full) ---

826 */
827 length = *val ? 2 : 1;
828 if (freeIt)
829 free(freeIt);
830 return length;
831}
832
833static Boolean
834CondDoEmpty(int arglen, const char *arg __unused)
834CondDoEmpty(int arglen, const char *arg MAKE_ATTR_UNUSED)
835{
836 return arglen == 1;
837}
838
839static Token
840compare_function(Boolean doEval)
841{
842 static const struct fn_def {

--- 568 unchanged lines hidden ---
835{
836 return arglen == 1;
837}
838
839static Token
840compare_function(Boolean doEval)
841{
842 static const struct fn_def {

--- 568 unchanged lines hidden ---